Keyboard input

From ArchWiki
Jump to navigation Jump to search

There are many ways to get Extra Keys to work.

In Gnome

Users of the Gnome Desktop Environment may find their extra keys are recognised by Gnome's keybindings tool. This is part of the Control-Center package, and can be accessed via System->Preferences->Keyboard Shortcuts, or by running gnome-keybinding-preferences. Gnome has a handy on-screen display of volume levels if your multimedia keys are configured this way. However, many extra keys will not be configurable in this manner.


Of the alternative methods, Keytouch is probably the easiest.


# pacman -S keytouch

Alternative way (build it yourself)

  • Download the keytouch PKGBUILD from here. Don't forget the files 'keytouch.install', 'keytouch.daemon', and 'keytouch.desktop' as well - they are used by the PKGBUILD in the 'source' list, and may be accessible from the same url given. Put these 3 files and the PKGBUILD in the same directory.
  • Run makepkg
  • Install Package Using Pacman
pacman -A keytouch-$VERSION.pkg.tar.gz

Make Keyboard File

Note: You need a keyboard file for your keyboard model. The package build includes some of them. You can also check

If your model is not included in the keytouch package you will need to create one for yourself:

  • Install keytouch-editor:
# pacman -S keytouch-editor
  • Make sure you have evdev loaded (you should not need to do this if you using the stock kernel)
# modprobe evdev
  • We are going to need to make a keyboard file which is very simple. You need to find out which input device is your keyboard first:
# ls /dev/input/

Every event device (like a keyboard or a mouse) is related to one of these files. To find out which file belongs to your keyboard, run:

# keytouch-editor /dev/input/eventX mykeyboardconfig

Replace the X by a number. KeyTouch editor will first show some information about the device, including its name (”Input device name”) that can tell you if you have chosen the correct event device. KeyTouch editor asks you to press one of the extra function keys. If the program continues after pressing the extra function key, you have chosen the right event device. If not terminate the program by pressing Ctrl+C and try another event device. Note that when your keyboard is connected via USB there are two event devices: /dev/input/eventA (where A is replaced by a number) for all ”normal” keys and /dev/input/eventB (where B = A+1) for the extra function keys.

  • After you have found the correct device, follow the steps. keytouch-editor asks your name and the name of the manufacturer and model of your keyboard.
  • Now it is time to tell keytouch-editor about your extra function keys. You will see the following message:
Press an extra function key or press enter to finish...

If your keyboard is connected via USB or you started keyTouch editor with the ”–acpi” option, you will not see this message, but instead:

Press return to a new key or enter F followed by return to finish...
  • First you will have to press the extra function key so that the program knows which key you mean. It is important that you do not press any other key than the extra function key. After pressing the key you will be asked to enter the keys name, keycode and default action.
  • Key name

Choose an appropriate name for the key. If there is for example a text label on the key, use the label as the key’s name.

  • Keycode

Use one of the keycodes listed below. It actually doesn’t matter which keycode you choose. However it is recommended that you choose a keycode that matches the best the function of the key. A keycode may only be used once in a keyboard file.

AGAIN               EJECTCLOSECD        MAIL              REFRESH
ALTERASE            EMAIL               MEDIA             REWIND
BACK                EXIT                MENU              RIGHTMETA
BASSBOOST           FASTFORWARD         MOVE              SCROLLDOWN
BOOKMARKS           FILE                MSDOS             SCROLLUP
BRIGHTNESSDOWN      FINANCE             MUTE              SEARCH
BRIGHTNESSUP        FIND                NEXTSONG          SENDFILE
CALC                FORWARD             OPEN              SETUP
CAMERA              FRONT               PASTE             SHOP
CANCEL              HANGUEL             PAUSE             SLEEP
CHAT                HANJA               PAUSECD           SOUND
CLOSE               HELP                PHONE             SPORT
CLOSECD             HOMEPAGE            PLAY              STOP
COFFEE              HP                  PLAYCD            STOPCD
COMPOSE             ISO                 PLAYPAUSE         SUSPEND
CONNECT             KBDILLUMUP          PRINT             VOLUMEDOWN
COPY                KPCOMMA             PROG1             VOLUMEUP
CUT                 KPEQUAL             PROG2             WAKEUP
CYCLEWINDOWS        KPLEFTPAREN         PROG3             WWW
DELETEFILE          KPPLUSMINUS         PROG4             XFER
DIRECTION           KPRIGHTPAREN        PROPS             YEN
EDIT                LEFTMETA            QUESTION
EJECTCD             MACRO               RECORD

You can find the correct keycodes from here:

  • Default action

It is important to realize that the default action for a key, is not the action you want to use for this key, but one that corresponds to the function of the key. The default action can be a program or a plugin. If it is a program, just fill in the name of the program. If it is a plugin type ”plugin” (without the quotes) instead. Then fill in the name of the plugin. To get a list of all available plugins, run keyTouch and go to the ”Preferences” part. Select the plugin and click the ”Information...” button to get a list of the functions of the selected plugin. After entering the plugins name in keytouch-editor, fill in the function name. Note that the name and function you fill in are case sensitive.

  • When you entered the information, the program asks again to press an extra function key. If there are no more extra function keys, just press enter to write the output file and terminate the program.
  • After you made the file and tested it, it would be a good idea to send it to the author of keytouch so he can include it in the next release.

(You know there's a missing @ because of spam bots ;))

Configure keytouch

  • We now need to run keytouch
  • What to do...
  1. When you see the list of keyboards select import and find where you put the keyboard config file you just made.
  2. Now you should see your keyboard module and manufactor. Select it and click ok.
  3. Now you get to the keytouch configuration theme. I think this is pretty self explanatory.

Starting the keytouch deamon

  • You should start the keytouch deamon at boot time (add keytouch to the deamons array in /etc/rc.conf)
  • You have to load keytouchd together with X. There is a script /etc/X11/Xsession which runs all daemons located in /etc/X11/Xsession.d/ including the keytouchd.
    • You can add /etc/X11/Xsession into your ~/.xinitrc if you log in from console
    • If you, however, use KDM as your login manager .xinitrc will not be parsed. There is a file /opt/kde/share/config/kdm/Xstartup which is parsed when KDM starts so you can add there instead and it will work for all users.
# vi /opt/kde/share/config/kdm/Xstartup

and add at the end of the file:

    • You can add keytouchd to your session list of your DE. (Gnome, Kde, Xfce-svn)

Additional docs

For more information look at the programs's homepage: