sxhkd-rc

[fork] simple X hotkey daemon (but for the rc shell)
Log | Files | Refs | README | LICENSE

commit 1e7c52071fead991562b41662da7b280b787f9b2
parent 9b17187c158badb2ea2ff9e73783036fae6d94da
Author: Bastien Dejean <nihilhill@gmail.com>
Date:   Sun, 23 Jun 2013 22:40:19 +0200

Only use bold and italic whenever possible

Diffstat:
MREADME.rst | 88++++++++++++++++---------------------------------------------------------------
Mdoc/README.md | 71++++++++++++-----------------------------------------------------------
Aexample/sxhkdrc | 46++++++++++++++++++++++++++++++++++++++++++++++
Msxhkd.1 | 94++++++++++++++++++++-----------------------------------------------------------
4 files changed, 99 insertions(+), 200 deletions(-)

diff --git a/README.rst b/README.rst @@ -49,11 +49,11 @@ General syntax: CHORD_i := [MODIFIER_i][@|!|:]KEYSYM_i MODIFIER_i := MODIFIER_i1 + MODIFIER_i2 + … + MODIFIER_ik -The valid modifier names are: ``super``, ``hyper``, ``meta``, ``alt``, -``control``, ``ctrl``, ``shift``, ``mode_switch``, ``lock``, ``mod1``, -``mod2``, ``mod3``, ``mod4`` and ``mod5``. +The valid modifier names are: *super*, *hyper*, *meta*, *alt*, +*control*, *ctrl*, *shift*, *mode\_switch*, *lock*, *mod1*, *mod2*, +*mod3*, *mod4* and *mod5*. -The keysym names are given by the output of ``xev``. +The keysym names are given by the output of **xev**. Hotkeys and commands can be spread across multiple lines by ending each partial line with a backslash character. @@ -62,89 +62,37 @@ When multiple chords are separated by semicolons, the hotkey is a chord chain: the command will only be executed after receiving each chord of the chain in consecutive order. -If ``@`` is added at the beginning of the keysym, the command will be +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 +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``). +button keysyms for this type of hotkeys are: *button1*, …, *button5*). -If ``:`` is added at the beginning of the keysym, the captured event +If **:** is added at the beginning of the keysym, the captured event will be replayed for the other clients. Mouse hotkeys can be defined by using one of the following special -keysym names: ``button1``, ``button2``, ``button3``, …, ``button24``. +keysym names: *button1*, *button2*, *button3*, …, *button24*. The hotkey and the command may contain sequences of the form -``{STRING_1,…,STRING_N}``. +**{*STRING\_1*,\ *…*,\ *STRING\_N*}**. -In addition, the sequences can contain ranges of the form ``A-Z`` where +In addition, the sequences can contain ranges of the form *A*-*Z* where *A* and *Z* are alphanumeric characters. The underscore character represents an empty sequence element. -What is actually executed is ``SHELL -c COMMAND``, which means you can -use environment variables in ``COMMAND``. +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``. +**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 +If **sxhkd** receives a *SIGUSR1* signal, it will reload its configuration file. -If no configuration file is specified via the ``-c`` option, the -following is used: ``$XDG_CONFIG_HOME/sxhkd/sxhkdrc``. - -Example Configuration -===================== - -:: - - XF86Audio{Prev,Next} - mpc -q {prev,next} - - @XF86LaunchA - scrot -s -e 'image_viewer $f' - - super + shift + equal - sxiv -rt "$HOME/image" - - XF86LaunchB - xdotool selectwindow | xsel -bi - - super + {h,j,k,l} - bspc focus {left,down,up,right} - - super + alt + {0-9} - mpc -q seek {0-9}0% - - super + {alt,ctrl,alt + ctrl} + XF86Eject - sudo systemctl {suspend,reboot,poweroff} - - :button1 - bspc grab_pointer focus - - super + button{1-3} - bspc grab_pointer {move,resize_side,resize_corner} - - super + !button{1-3} - bspc track_pointer %i %i - - super + @button{1-3} - bspc ungrab_pointer - - super + {_,shift + }{h,j,k,l} - bspc {focus,shift} {left,down,up,right} - - {_,shift + ,super + }XF86MonBrightness{Down,Up} - bright {-1,-10,min,+1,+10,max} - - super + o ; {e,w,m} - {gvim,firefox,thunderbird} - - super + alt + control + {h,j,k,l} ; {0-9} - bspc fence_ratio {left,down,up,right} 0.{0-9} - +If no configuration file is specified via the *-c* option, the following +is used: *$XDG\_CONFIG\_HOME/sxhkd/sxhkdrc*. diff --git a/doc/README.md b/doc/README.md @@ -46,79 +46,32 @@ General syntax: CHORD_i := [MODIFIER_i][@|!|:]KEYSYM_i MODIFIER_i := MODIFIER_i1 + MODIFIER_i2 + … + MODIFIER_ik -The valid modifier names are: `super`, `hyper`, `meta`, `alt`, `control`, `ctrl`, `shift`, `mode_switch`, `lock`, `mod1`, `mod2`, `mod3`, `mod4` and `mod5`. +The valid modifier names are: *super*, *hyper*, *meta*, *alt*, *control*, *ctrl*, *shift*, *mode_switch*, *lock*, *mod1*, *mod2*, *mod3*, *mod4* and *mod5*. -The keysym names are given by the output of `xev`. +The keysym names are given by the output of **xev**. Hotkeys and commands can be spread across multiple lines by ending each partial line with a backslash character. When multiple chords are separated by semicolons, the hotkey is a chord chain: the command will only be executed after receiving each chord of the chain in consecutive order. -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 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`). +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*). -If `:` is added at the beginning of the keysym, the captured event will be replayed for the other clients. +If **:** is added at the beginning of the keysym, the captured event will be replayed for the other clients. -Mouse hotkeys can be defined by using one of the following special keysym names: `button1`, `button2`, `button3`, …, `button24`. +Mouse hotkeys can be defined by using one of the following special keysym names: *button1*, *button2*, *button3*, …, *button24*. -The hotkey and the command may contain sequences of the form `{STRING_1,…,STRING_N}`. +The hotkey and the command may contain sequences of the form **{*STRING\_1*,*…*,*STRING\_N*}**. -In addition, the sequences can contain ranges of the form `A-Z` where *A* and *Z* are alphanumeric characters. +In addition, the sequences can contain ranges of the form *A*-*Z* where *A* and *Z* are alphanumeric characters. The underscore character represents an empty sequence element. -What is actually executed is `SHELL -c COMMAND`, which means you can use environment variables in `COMMAND`. +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`. +**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. +If **sxhkd** receives a *SIGUSR1* signal, it will reload its configuration file. -If no configuration file is specified via the `-c` option, the following is used: `$XDG_CONFIG_HOME/sxhkd/sxhkdrc`. - -# Example Configuration - - XF86Audio{Prev,Next} - mpc -q {prev,next} - - @XF86LaunchA - scrot -s -e 'image_viewer $f' - - super + shift + equal - sxiv -rt "$HOME/image" - - XF86LaunchB - xdotool selectwindow | xsel -bi - - super + {h,j,k,l} - bspc focus {left,down,up,right} - - super + alt + {0-9} - mpc -q seek {0-9}0% - - super + {alt,ctrl,alt + ctrl} + XF86Eject - sudo systemctl {suspend,reboot,poweroff} - - :button1 - bspc grab_pointer focus - - super + button{1-3} - bspc grab_pointer {move,resize_side,resize_corner} - - super + !button{1-3} - bspc track_pointer %i %i - - super + @button{1-3} - bspc ungrab_pointer - - super + {_,shift + }{h,j,k,l} - bspc {focus,shift} {left,down,up,right} - - {_,shift + ,super + }XF86MonBrightness{Down,Up} - bright {-1,-10,min,+1,+10,max} - - super + o ; {e,w,m} - {gvim,firefox,thunderbird} - - super + alt + control + {h,j,k,l} ; {0-9} - bspc fence_ratio {left,down,up,right} 0.{0-9} +If no configuration file is specified via the *-c* option, the following is used: *$XDG_CONFIG_HOME/sxhkd/sxhkdrc*. diff --git a/example/sxhkdrc b/example/sxhkdrc @@ -0,0 +1,46 @@ +XF86Audio{Prev,Next} + mpc -q {prev,next} + +@XF86LaunchA + scrot -s -e 'image_viewer $f' + +super + shift + equal + sxiv -rt "$HOME/image" + +XF86LaunchB + xdotool selectwindow | xsel -bi + +super + {h,j,k,l} + bspc focus {left,down,up,right} + +super + alt + {0-9} + mpc -q seek {0-9}0% + +super + {alt,ctrl,alt + ctrl} + XF86Eject + sudo systemctl {suspend,reboot,poweroff} + +:button1 + bspc grab_pointer focus + +super + button{1-3} + bspc grab_pointer {move,resize_side,resize_corner} + +super + !button{1-3} + bspc track_pointer %i %i + +super + @button{1-3} + bspc ungrab_pointer + +super + {_,shift + }{h,j,k,l} + bspc {focus,shift} {left,down,up,right} + +{_,shift + ,super + }XF86MonBrightness{Down,Up} + bright {-1,-10,min,+1,+10,max} + +super + o ; {e,w,m} + {gvim,firefox,thunderbird} + +super + alt + control + {h,j,k,l} ; {0-9} + bspc fence_ratio {left,down,up,right} 0.{0-9} + +# vim: set ft=sxhkdrc: diff --git a/sxhkd.1 b/sxhkd.1 @@ -57,12 +57,12 @@ MODIFIER_i\ :=\ MODIFIER_i1\ +\ MODIFIER_i2\ +\ \&...\ +\ MODIFIER_ik \f[] .fi .PP -The valid modifier names are: \f[C]super\f[], \f[C]hyper\f[], -\f[C]meta\f[], \f[C]alt\f[], \f[C]control\f[], \f[C]ctrl\f[], -\f[C]shift\f[], \f[C]mode_switch\f[], \f[C]lock\f[], \f[C]mod1\f[], -\f[C]mod2\f[], \f[C]mod3\f[], \f[C]mod4\f[] and \f[C]mod5\f[]. +The valid modifier names are: \f[I]super\f[], \f[I]hyper\f[], +\f[I]meta\f[], \f[I]alt\f[], \f[I]control\f[], \f[I]ctrl\f[], +\f[I]shift\f[], \f[I]mode_switch\f[], \f[I]lock\f[], \f[I]mod1\f[], +\f[I]mod2\f[], \f[I]mod3\f[], \f[I]mod4\f[] and \f[I]mod5\f[]. .PP -The keysym names are given by the output of \f[C]xev\f[]. +The keysym names are given by the output of \f[B]xev\f[]. .PP Hotkeys and commands can be spread across multiple lines by ending each partial line with a backslash character. @@ -71,92 +71,44 @@ When multiple chords are separated by semicolons, the hotkey is a chord chain: the command will only be executed after receiving each chord of the chain in consecutive order. .PP -If \f[C]\@\f[] is added at the beginning of the keysym, the command will +If \f[B]\@\f[] is added at the beginning of the keysym, the command will be run on key release events, otherwise on key press events. .PP -If \f[C]!\f[] is added at the beginning of the keysym, the command will +If \f[B]!\f[] 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 \f[I]x\f[] and \f[I]y\f[] coordinates of the pointer relative to the root window referential (the only valid button keysyms for this type of hotkeys are: -\f[C]button1\f[], \&..., \f[C]button5\f[]). +\f[I]button1\f[], \&..., \f[I]button5\f[]). .PP -If \f[C]:\f[] is added at the beginning of the keysym, the captured +If \f[B]:\f[] is added at the beginning of the keysym, the captured event will be replayed for the other clients. .PP Mouse hotkeys can be defined by using one of the following special -keysym names: \f[C]button1\f[], \f[C]button2\f[], \f[C]button3\f[], -\&..., \f[C]button24\f[]. +keysym names: \f[I]button1\f[], \f[I]button2\f[], \f[I]button3\f[], +\&..., \f[I]button24\f[]. .PP The hotkey and the command may contain sequences of the form -\f[C]{STRING_1,\&...,STRING_N}\f[]. +\f[B]{\f[I]STRING_1\f[],\f[I]\&...\f[],\f[I]STRING_N\f[]}\f[]. .PP -In addition, the sequences can contain ranges of the form \f[C]A\-Z\f[] -where \f[I]A\f[] and \f[I]Z\f[] are alphanumeric characters. +In addition, the sequences can contain ranges of the form +\f[I]A\f[]\-\f[I]Z\f[] where \f[I]A\f[] and \f[I]Z\f[] are alphanumeric +characters. .PP The underscore character represents an empty sequence element. .PP -What is actually executed is \f[C]SHELL\ \-c\ COMMAND\f[], which means -you can use environment variables in \f[C]COMMAND\f[]. +What is actually executed is \f[B]SHELL\f[] \f[I]\-c\f[] +\f[B]COMMAND\f[], which means you can use environment variables in +\f[B]COMMAND\f[]. .PP -\f[C]SHELL\f[] will be the content of the first defined environment -variable in the following list: \f[C]SXHKD_SHELL\f[], \f[C]SHELL\f[]. +\f[B]SHELL\f[] will be the content of the first defined environment +variable in the following list: \f[B]SXHKD_SHELL\f[], \f[B]SHELL\f[]. .PP -If \f[I]sxhkd\f[] receives a \f[C]SIGUSR1\f[] signal, it will reload its +If \f[B]sxhkd\f[] receives a \f[I]SIGUSR1\f[] signal, it will reload its configuration file. .PP -If no configuration file is specified via the \f[C]\-c\f[] option, the -following is used: \f[C]$XDG_CONFIG_HOME/sxhkd/sxhkdrc\f[]. -.SH EXAMPLE CONFIGURATION -.IP -.nf -\f[C] -XF86Audio{Prev,Next} -\ \ \ \ mpc\ \-q\ {prev,next} - -\@XF86LaunchA -\ \ \ \ scrot\ \-s\ \-e\ \[aq]image_viewer\ $f\[aq] - -super\ +\ shift\ +\ equal -\ \ \ \ sxiv\ \-rt\ "$HOME/image" - -XF86LaunchB -\ \ \ \ xdotool\ selectwindow\ |\ xsel\ \-bi - -super\ +\ {h,j,k,l} -\ \ \ \ bspc\ focus\ {left,down,up,right} - -super\ +\ alt\ +\ {0\-9} -\ \ \ \ mpc\ \-q\ seek\ {0\-9}0% - -super\ +\ {alt,ctrl,alt\ +\ ctrl}\ +\ XF86Eject -\ \ \ \ sudo\ systemctl\ {suspend,reboot,poweroff} - -:button1 -\ \ \ \ bspc\ grab_pointer\ focus - -super\ +\ button{1\-3} -\ \ \ \ bspc\ grab_pointer\ {move,resize_side,resize_corner} - -super\ +\ !button{1\-3} -\ \ \ \ bspc\ track_pointer\ %i\ %i - -super\ +\ \@button{1\-3} -\ \ \ \ bspc\ ungrab_pointer - -super\ +\ {_,shift\ +\ }{h,j,k,l} -\ \ \ \ bspc\ {focus,shift}\ {left,down,up,right} - -{_,shift\ +\ ,super\ +\ }XF86MonBrightness{Down,Up} -\ \ \ \ bright\ {\-1,\-10,min,+1,+10,max} - -super\ +\ o\ ;\ {e,w,m} -\ \ \ \ {gvim,firefox,thunderbird} - -super\ +\ alt\ +\ control\ +\ {h,j,k,l}\ ;\ {0\-9} -\ \ \ \ bspc\ fence_ratio\ {left,down,up,right}\ 0.{0\-9} -\f[] -.fi +If no configuration file is specified via the \f[I]\-c\f[] option, the +following is used: \f[I]$XDG_CONFIG_HOME/sxhkd/sxhkdrc\f[]. .SH AUTHOR .MT baskerville@lavabit.com Bastien Dejean