Difference between revisions of "Extra keyboard keys in Xorg"

From ArchWiki
Jump to: navigation, search
m (actkbd: replace old AUR link)
(style, wording)
Line 11: Line 11:
 
{{Related articles end}}
 
{{Related articles end}}
  
When we are in a graphical environment we may want to execute a command when certain key combination is pressed. There are some ways of doing that and they are covered on this page.
+
== Mapping keysyms to actions ==
 
+
== Map keysyms to actions ==
+
  
 
{{Merge|Keyboard Shortcuts#X11_2|same topic}}
 
{{Merge|Keyboard Shortcuts#X11_2|same topic}}
  
There are multiple ways to do that:
+
When we are in a graphical environment we may want to execute a command when certain key combination is pressed. There are multiple ways to do that:
 +
 
 
* The most portable way using low level tools, such as [[acpid]]. Not all keys are supported, but configuration in uniform way is possible for keyboard keys, power adapter connection and even headphone jack (un)plugging events.
 
* The most portable way using low level tools, such as [[acpid]]. Not all keys are supported, but configuration in uniform way is possible for keyboard keys, power adapter connection and even headphone jack (un)plugging events.
* The universal way using [[Xorg]] utilities (e.g. [[Xbindkeys]]) and eventually your desktop environment or window manager tools.
+
* The universal way using [[Xorg]] utilities (e.g. [[xbindkeys]]) and eventually your desktop environment or window manager tools.
 
* The quicker way using a third-party program to do everything in GUI, such as the Gnome Control Center or [[Keytouch]].
 
* The quicker way using a third-party program to do everything in GUI, such as the Gnome Control Center or [[Keytouch]].
  
=== Using your Desktop Environment tools ===
+
=== Desktop environment tools ===
  
 
==== Gnome ====
 
==== Gnome ====
Line 39: Line 38:
  
 
See [[Xfce#Manage Keyboard Shortcuts]]
 
See [[Xfce#Manage Keyboard Shortcuts]]
 +
 +
=== Window manager tools ===
  
 
==== Openbox ====
 
==== Openbox ====
Line 65: Line 66:
 
  bindsym Print                  exec  scrot
 
  bindsym Print                  exec  scrot
  
=== Using third-party programs ===
+
=== Third-party tools ===
  
 
==== sxhkd ====
 
==== sxhkd ====
Line 77: Line 78:
 
KeyTouch is a program which allows you to easily configure the extra function keys of your keyboard. This means that you can define, for every individual function key, what to do if it is pressed.
 
KeyTouch is a program which allows you to easily configure the extra function keys of your keyboard. This means that you can define, for every individual function key, what to do if it is pressed.
  
''See the detailed article: [[keytouch]].''
+
See the main article: [[keytouch]].
  
 
==== actkbd ====
 
==== actkbd ====

Revision as of 15:30, 15 December 2013

Mapping keysyms to actions

Merge-arrows-2.pngThis article or section is a candidate for merging with Keyboard Shortcuts#X11_2.Merge-arrows-2.png

Notes: same topic (Discuss in Talk:Extra keyboard keys in Xorg#)

When we are in a graphical environment we may want to execute a command when certain key combination is pressed. There are multiple ways to do that:

  • The most portable way using low level tools, such as acpid. Not all keys are supported, but configuration in uniform way is possible for keyboard keys, power adapter connection and even headphone jack (un)plugging events.
  • The universal way using Xorg utilities (e.g. xbindkeys) and eventually your desktop environment or window manager tools.
  • The quicker way using a third-party program to do everything in GUI, such as the Gnome Control Center or Keytouch.

Desktop environment tools

Gnome

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: I am quite certain that GNOME does not override Xorg that much... (Discuss in Talk:Extra keyboard keys in Xorg#)

Gnome Control Center is quite complete for the extra keyboard keys management. In fact it can directly detect scancodes which means that it can map any key seen by the kernel.

KDE

Merge-arrows-2.pngThis article or section is a candidate for merging with KDE.Merge-arrows-2.png

Notes: KDE currently does not provide any information about mapping actions; provide only link after the merge. (Discuss in Talk:Extra keyboard keys in Xorg#)

Keyboard shortcuts can be configured in System Settings -> Shortcuts and Gestures.

Xfce4

See Xfce#Manage Keyboard Shortcuts

Window manager tools

Openbox

See Openbox#Keybinds

PekWM

See PekWM#Hotkeys

Xmonad

Merge-arrows-2.pngThis article or section is a candidate for merging with Xmonad.Merge-arrows-2.png

Notes: Provide only link after the merge. (Discuss in Talk:Extra keyboard keys in Xorg#)

If you use Xmonad as a stand alone window manager, you can edit the xmonad.hs to add unbound keyboard keys. You just need to find the Xf86 name of the key (such as XF86PowerDown) and look it up in /usr/include/X11/XF86keysym.h. It will give you a keycode (like 0x1008FF2A) which you can use to add a line like the following in the keybindings section of your xmonad.hs:

((0,               0x1008FF2A), spawn "sudo pm-suspend")

i3

Merge-arrows-2.pngThis article or section is a candidate for merging with i3.Merge-arrows-2.png

Notes: Provide only link after the merge. (Discuss in Talk:Extra keyboard keys in Xorg#)

Open your ~/.i3/config and just bind the keysym to a command:

bindsym XF86MonBrightnessDown  exec  xbacklight -dec 10
bindsym Print                  exec  scrot

Third-party tools

sxhkd

A simple X hotkey daemon with a powerful and compact configuration syntax.

Available as sxhkd-gitAUR and sxhkdAUR in AUR.

keytouch

KeyTouch is a program which allows you to easily configure the extra function keys of your keyboard. This means that you can define, for every individual function key, what to do if it is pressed.

See the main article: keytouch.

actkbd

From actkbd home page:

actkbdAUR (available in AUR) is a simple daemon that binds actions to keyboard events. It recognises key combinations and can handle press, repeat and release events. Currently it only supports the linux-2.6 evdev interface. It uses a plain-text configuration file which contains all the bindings.

A sample configuration and guide is available here.

xbindkeys

xbindkeys allows advanced mapping of keysyms to actions independently of the Desktop Environment.