Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is it possible to assign Shift + Tab to the control key on the right?

share|improve this question
    
You know how you're on an Open/Save Dialog box? And you need to navigate backwards? That's shift+tab. I found when I was using Windows that remapping the right control key to shift+tab I was far more likely to use the keyboard to navigate through fields. –  begtognen Oct 17 '10 at 12:53
add comment

1 Answer

up vote 5 down vote accepted

In X11 jargon, the name for a key is called its keysym (short for: key symbol). The keysym generated by Shift+Tab is ISO_Left_Tab. So, in theory, one could just assign the ISO_Left_Tab keysym to any key (which you can do with the command xmodmap) and this would do the trick.

Unfortunately, some applications (for instance: Firefox) explicitly look for the Shift keypress, and this breaks it, because you cannot assign two keysyms (Shift and Tab) to one single key.

Fortunately, Roger Pate's answer to this AskUbuntu question provides a way around it: bind a shortcut to a program that will simulate the simultaneous pressing of Shift and Tab.

  1. Install the xvkbd package

  2. From the System->Preferences->Keyboard shortcuts menu, create a new shortcut, name it e.g. "Shift+Tab" and insert the following command:

    sh -c "xvkbd -text '\S\[ISO_Left_Tab]'"
    

    The purpose of this command is just to send a virtual Shift+Tab keystroke to the currently focused window. (Consult the xvbkd man page for more information.)

  3. Bind this shortcut to any key you want. Note that, to bind a shortcut to a modifier key (i.e., one that is only meaningful in combination with another key, for instance Shift or Alt) you need to deprive it of its modifier status. For example, before binding right-Control, you need to issue this command in a terminal:

    xmodmap -e 'remove control = Control_R'
    

    (See this other AskUbuntu question for another way to bind modifier keys.)

    Note: the xmodmap line above will only have effect until next reboot/logout. To make it persistent, you would have to either put that line into the ~/.gnomerc file, or add remove control = Control_R to the ~/.Xmodmap file.

share|improve this answer
    
Thanks so much for your help. I did follow the instructions, but strangely it only worked once, then stopped altogether. Control_R is definitely stripped of its modifier status, so I'm at a bit of a loss. (Could this have something to do with having Autokey installed?) –  begtognen Oct 19 '10 at 9:41
    
@begtognen I do not know much about Autokey, so I cannot help there. However, the xmodmap line that I pasted will only last until next reboot/logout. To make it persistent, you would have to either put that line into the ~/.gnomerc file, or add remove control = Control_R to the ~/.Xmodmap file. –  Riccardo Murri Oct 19 '10 at 9:43
    
Oops! Sorry, I wasn't very clear - I meant that it literally worked one time, then never worked again. Not that I restarted the computer, but that it worked once, then I immediately tried it again, and no luck. –  begtognen Oct 23 '10 at 10:54
    
@begtognen Does it work consistently, if you bind it to a different, non-modifier key? E.g., Pause –  Riccardo Murri Oct 23 '10 at 11:24
    
I tried binding it to a few different non-modifier keys. While I couldn't get it to even work once, oddly I did see that something was happening: the field I was in would flash whenever I hit the keyboard shortcut. –  begtognen Oct 26 '10 at 10:38
show 2 more comments

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.