Difference between revisions of "Sxhkd"

From ArchWiki
Jump to: navigation, search
m (Configuration: typographical fixes)
(Gnome autostart: trivial, contact the packager(s) if you want a desktop file)
 
(19 intermediate revisions by 11 users not shown)
Line 1: Line 1:
 
[[Category:Keyboards]]
 
[[Category:Keyboards]]
[[Category:X Server]]
+
[[Category:X server]]
[https://github.com/baskerville/sxhkd sxhkd] is a simple X hotkey daemon. It is intended to replace [[xbindkeys]]. Its forum thread is [https://bbs.archlinux.org/viewtopic.php?id=155613 here].
+
[[ja:Sxhkd]]
 +
{{Related articles start}}
 +
{{Related|Xbindkeys}}
 +
{{Related|Xmodmap}}
 +
{{Related articles end}}
 +
From [https://github.com/baskerville/sxhkd sxhkd's Github page]:
 +
:'' sxhkd is a simple X hotkey daemon with a powerful and compact configuration syntax.''
  
 
==Installation==
 
==Installation==
Download the {{AUR|sxhkd-git}} package from the [[AUR]]. Then, as a non-root user, run:
+
[[Install]] {{Pkg|sxhkd}} or {{AUR|sxhkd-git}}.
 
+
$ makepkg -i
+
 
+
while in the directory of the saved PKGBUILD. All the files will be retrieved, and the package will be built and installed.
+
  
 
==Configuration==
 
==Configuration==
sxhkd defaults to {{ic|$XDG_CONFIG_HOME/sxhkd/sxhkdrc}} for its configuration file. An alternate configuration file can be specified with the {{ic|-e}} option.  
+
sxhkd defaults to {{ic|$XDG_CONFIG_HOME/sxhkd/sxhkdrc}} for its configuration file. An alternate configuration file can be specified with the {{ic|-c}} option.  
  
Each line of the configuration file is inerpreted as so:
+
Each line of the configuration file is interpreted as so:
  
 
* If it starts with {{ic|#}}, it is ignored.
 
* If it starts with {{ic|#}}, it is ignored.
Line 23: Line 25:
 
  [MODIFIER + ]*[@|!]KEYSYM
 
  [MODIFIER + ]*[@|!]KEYSYM
 
     COMMAND
 
     COMMAND
Where {{ic|MODIFIER}} is one of the following names: {{ic|super}}, {{ic|hyper}}, {{ic|meta}}, {{ic|alt}}, {{ic|control}}, {{ic|ctrl}}, {{ic|shift}}, {{ic|mode_switch}}, {{ic|lock}}, {{ic|mod1}}, {{ic|mod2}}, {{ic|mod3}}, {{ic|mod4}}, {{ic|mod5}}.
 
 
If {{ic|@}} is added at the beginning of the keysym, the command will be run on key release events, otherwise on key press events.
 
 
If {{ic|!}} is added at the beginning of the keysym, the command will be run on motion notify events and must contain two integer conversion specifications which will be replaced by the x and y coordinates of the pointer relative to the root window referential (the only valid button keysyms for this type of hotkeys are: {{ic|button1}}, ..., {{ic|button5}}).
 
 
The {{ic|KEYSYM}} names are those your will get from {{ic|xev}}.
 
 
Mouse hotkeys can be defined by using one of the following special keysym names: {{ic|button1}}, {{ic|button2}}, {{ic|button3}}, ..., {{ic|button24}}.
 
  
The hotkey can contain a sequence of the form ({{ic|STRING_1}},,{{ic|STRING_N}}), in which case, the command must also contain a sequence with ''N'' elements: the pairing of the two sequences generates ''N'' hotkeys.
+
Where {{ic|MODIFIER}} is one of the following names: {{ic|super}}, {{ic|hyper}}, {{ic|meta}}, {{ic|alt}}, {{ic|control}}, {{ic|ctrl}}, {{ic|shift}}, {{ic|mode_switch}}, {{ic|lock}}, {{ic|mod1}}, {{ic|mod2}}, {{ic|mod3}}, {{ic|mod4}}, {{ic|mod5}}. If {{ic|@}} is added at the beginning of the keysym, the command will be run on key release events, otherwise on key press events. If {{ic|!}} is added at the beginning of the keysym, the command will be run on motion notify events and must contain two integer conversion specifications which will be replaced by the x and y coordinates of the pointer relative to the root window referential (the only valid button keysyms for this type of hotkeys are: {{ic|button1}}, ..., {{ic|button5}}). The {{ic|KEYSYM}} names are those your will get from {{ic|xev}}.
  
In addition, the sequences can contain ranges of the form {{ic|A-Z}} where ''A'' and ''Z'' are alphanumeric characters.
+
Mouse hotkeys can be defined by using one of the following special keysym names: {{ic|button1}}, {{ic|button2}}, {{ic|button3}}, ..., {{ic|button24}}. The hotkey can contain a sequence of the form ({{ic|STRING_1}},…,{{ic|STRING_N}}), in which case, the command must also contain a sequence with ''N'' elements: the pairing of the two sequences generates ''N'' hotkeys. In addition, the sequences can contain ranges of the form {{ic|A-Z}} where ''A'' and ''Z'' are alphanumeric characters.
  
What is actually executed is {{ic|SHELL -c COMMAND}}, which means you can use environment variables in {{ic|COMMAND}}.
+
What is actually executed is {{ic|SHELL -c COMMAND}}, which means you can use environment variables in {{ic|COMMAND}}. {{ic|SHELL}} will be the content of the first defined environment variable in the following list: {{ic|SXHKD_SHELL}}, {{ic|SHELL}}. If sxhkd receives a {{ic|SIGUSR1}} signal, it will reload its configuration file.
  
{{ic|SHELL}} will be the content of the first defined environment variable in the following list: {{ic|SXHKD_SHELL}}, {{ic|SHELL}}.
+
== Usage ==
 +
After configuring it, you may wish to setup sxhkd to [[autostart]].
 +
{{Tip | An example [[systemd]] service file is found [https://github.com/baskerville/sxhkd/blob/master/contrib/systemd/sxhkd.service here].}}
  
If sxhkd receives a {{ic|SIGUSR1}} signal, it will reload its configuration file.
+
== See Also ==
 +
*[https://github.com/baskerville/sxhkd Official website] - includes configuration options, example bindings, and source code.
 +
*[https://bbs.archlinux.org/viewtopic.php?id=155613 ArchLinux forum thread]

Latest revision as of 19:52, 19 August 2015

Related articles

From sxhkd's Github page:

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

Installation

Install sxhkd or sxhkd-gitAUR.

Configuration

sxhkd defaults to $XDG_CONFIG_HOME/sxhkd/sxhkdrc for its configuration file. An alternate configuration file can be specified with the -c option.

Each line of the configuration file is interpreted as so:

  • If it starts with #, it is ignored.
  • If it starts with one or more white space commands, it is read as a command.
  • Otherwise, it is parsed as a hotkey: each key name is separated by spaces and/or + characters.

General syntax:

[MODIFIER + ]*[@|!]KEYSYM
    COMMAND

Where MODIFIER is one of the following names: super, hyper, meta, alt, control, ctrl, shift, mode_switch, lock, mod1, mod2, mod3, mod4, mod5. If @ is added at the beginning of the keysym, the command will be run on key release events, otherwise on key press events. If ! is added at the beginning of the keysym, the command will be run on motion notify events and must contain two integer conversion specifications which will be replaced by the x and y coordinates of the pointer relative to the root window referential (the only valid button keysyms for this type of hotkeys are: button1, ..., button5). The KEYSYM names are those your will get from xev.

Mouse hotkeys can be defined by using one of the following special keysym names: button1, button2, button3, ..., button24. The hotkey can contain a sequence of the form (STRING_1,…,STRING_N), in which case, the command must also contain a sequence with N elements: the pairing of the two sequences generates N hotkeys. In addition, the sequences can contain ranges of the form A-Z where A and Z are alphanumeric characters.

What is actually executed is SHELL -c COMMAND, which means you can use environment variables in COMMAND. SHELL will be the content of the first defined environment variable in the following list: SXHKD_SHELL, SHELL. If sxhkd receives a SIGUSR1 signal, it will reload its configuration file.

Usage

After configuring it, you may wish to setup sxhkd to autostart.

Tip: An example systemd service file is found here.

See Also