User:Malcolm Farmer/Keyboard shortcuts in Linux

From DPWiki
Jump to navigation Jump to search
  • reference for when I need to replace a dead hard drive. Possibly useful to others. This is on Slackware. KDE or Gnome users may have somewhat higher level tools to do this.

This is for proofers using X on a Linux PC. Besides the dropdown menu for special characters, there are keyboard shortcuts for entering characters. Thes eare far, far, quicker than using the dropdown menu, and much easier to remember than the ALt-arbitrary number coding in Windows: generally, think of an ISO8559-1 character, and what you would use to type it, and that generally turns out to be the code.

Redefine a key you don't want to use as the more useful "Multi" key. I redefined Capslock, as I find it more trouble than it's worth. This is done in a file .Xmodmap in the home directory.

This is my .Xmodmap file

! clear capslock and make it into the multi key
remove lock = Caps_Lock
keycode 66 = Multi_key

First line is a comment, so I can remember what I'm doing. Second line undefines the Caps_lock key. Third line defines the key that generates keycode 66 (Caps_lock) as the Multi key.

So you've now got a file that defines the new key function. Next, tell your xserver to use the new definition. (from a command prompt in an x terminal)

xmodmap $HOme/.Xmodmap


When that's run, try out keycodes.

  • Capslock-a-e gives æ
  • Capslock-/-O gives ø
  • Capslock-^-0 gives °
  • Capslock-^-O gives Ô
  • Capslock-~-n gives ñ
    • Capslock-n-~ will also give ñ : generally, it doesn't matter what order the keys are after Multi.

etc.etc. Generally, the key sequence to produce the special character is just about the first sequence you think you would define it.

A table listing key sequences can be seen here: [1]

This redefinition only lasts for your current X session. If you want it to be the default setting from one session to the next, put the command in your startx file. Example: my startx file loads the changed key definition, then starts my window manager:

xmodmap $HOME/.Xmodmap
exec afterstep