Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

After using the Ctrl + "arrow keys" for 13 years to switch virtual desktops in X windows, I've been convinced recently to change to using the Super keys instead (the windows key and the context menu key, which I've remapped). This all works fine for the most part. However, something is still picking up the key events that these keys are sending as if they are a normal alphanumeric like key.

For example, I first noticed this in Google Docs spreadsheet that if I press the windows key alone over top of a cell, that it starts editing that cell. It doesn't insert anything, it just sends a key event that Firefox sees and starts editing the cell. This caused problems on a collaborative document I was working on as the way Google docs works, it led to me accidentally erasing the data in a few fields before I realised what was going on.

I like using the super keys, but I want them to behave more like a Ctrl or Alt key does in that its a modifier key and doesn't send anything until a second key is pressed.

My setup is the following:

  • Ubuntu 10.10
  • XFCE 4
  • Microsoft Natural Ergo 4000 keyboard (with the logo scratched out of course)
  • The following is my .Xmodmap file:

remove Lock = Caps_Lock

keycode 66 = Escape

! The below maps my other windows context menu key.

keycode 135 = Super_R

Edit: As requested, here is the relevant output from xev for a keypress and keyrelease of my Super_L (left windows key)

KeyPress event, serial 34, synthetic NO, window 0x8200001,
    root 0x15d, subw 0x0, time 2428849342, (177,174), root:(182,228),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x8200001,
    root 0x15d, subw 0x0, time 2428849430, (177,174), root:(182,228),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
share|improve this question
1  
Run xev and post the lines produced when you press the Win key. –  Juliano Feb 18 '11 at 1:27
    
@Juliano: Posted in my question as requested. I had looked at this output before and couldn't find anything helpful to my problem, but that doesn't mean you or someone else won't. –  deltaray Feb 18 '11 at 15:46
    
From your xev output, nothing is produced when the Win key is pressed. So, it is a mystery for me why Firefox is interpreting it as input. –  Juliano Feb 18 '11 at 16:01
add comment

1 Answer 1

up vote 6 down vote accepted
+50

Non XFCE-related stuff

It won't be exactly an answer to your problem, sorry for that, but still should be useful for someone at least. In Gnome it was fixed in recent Ubuntus. By it I mean treating Win not as a modifier key. In the old days, e.g. in Ubuntu 9.04, you had to do following change:

Go to System -> Preferences -> Keyboard, under Layouts tab click Layout options... button and in Alt/Win key behavior list choose Meta is mapped to Win keys (or Meta is mapped to Left Win) instead of Default.

What it really does? Changes altwin option in $HOME/.gconf/desktop/gnome/peripherals/keyboard/kbd/%gconf.xml file (or creates it if it does not exist):

<?xml version="1.0"?>
<gconf>
        <entry name="options" mtime="1298496603" type="list" ltype="string">
                <li type="string">
                        <stringvalue>altwin     altwin:meta_win</stringvalue>
                </li>
        </entry>
</gconf>

If you've chosen Left Win, then there will be following string value:

altwin     altwin:left_meta_win

In Ubuntu 10.10 it's not needed as Default apparently has changed.

But you have XFCE, not Gnome, so this rather won't help you.

XFCE-related stuff

I've downloaded Xubuntu (9.10), played with it a bit and finally found a solution.

Firstly, though, I must say that keyboard settings are really screwed in XFCE. In Settings -> Keyboard under Layout tab you don't have too many options. You cannot change XkbOptions there and even if you do it manually in ~/.config/xfce4/xfconf/xfce-perchannel-xml/keyboard-layout.xml, it will be overwritten. So I've changed /etc/default/console-setup by adding altwin:meta_win to XKBOPTIONS (use comma as separator if there are some other option(s) already). Still, no luck.

tl;dr

What's the solution?

Do not care about XFCE way of handling keyboard, because it's apparently broken. Use setxkbmap directly:

setxkbmap -option altwin:meta_win

(or left_meta_win, whatever you prefer)

Now you have to check that it really solved your problem. :)

How to apply it permanently?

echo -option altwin:meta_win >>~/.Xkbmap

It can be also done for all users by writing to /etc/X11/Xkbmap instead.

How can I quickly check if altwin:meta_win or altwin:left_meta_win has been applied?

setxkbmap -print

Line with xkb_symbols should have something like altwin(meta_win).

share|improve this answer
    
I've added real solution in my answer. Please check it out. –  przemoc Feb 24 '11 at 0:59
    
Yes the setxkbmap -option altwin:meta_win command worked. Thank you very much for working through to a solution. Hopefully this will help others, I'll post it to @climagic tomorrow since it was people there who encouraged me to use the windows key in the first place. –  deltaray Feb 24 '11 at 4:23
    
@deltaray: You also need to click on the Bounty button. The bounty is not awarded automatically. –  harrymc Feb 24 '11 at 9:47
    
Thanks @harrymc I didn't realize that. I clicked on it. –  deltaray Feb 24 '11 at 14:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.