PRIMARY CATEGORY → SETUP

sxhkd → Simple X Hotkey Daemon

sxhkd process is listen and reacts to input events and execute commands according to them

Most of that commands are bspc invocations. That bspc commands write in bspwm’s socket

$ pgrep --list-full --exact sxhkd
1643 /usr/local/bin/sxhkd

sxhkd is launched by bspwm from bspwmrc script →

# ~/.config/bspwm/bspwmrc - sxhkd Binary Launch
checkProcess sxhkd || launchProcess sxhkd

All input events such as hotkeys are defined within its configuration file.

It declares all hotkeys related to launch and deploy processes and its functionalities such as:

  • bspwm → Windows Generation, Configuration Daemon Reload, Shortcuts…
  • kitty → Launchs Terminal Emulator
  • roffi → Deploys Program Launcher
  • Other processes such as Firefox, Burpsuite…

Configuration File → ~/.config/sxhkd/sxhkdrc

More information here


Installation

Clone the sxhkd’s Github Repository

$ cd ~/Downloads
$ git clone https://github.com/baskerville/sxhkd.git sxhkd
$ cd !$ # cd ~/Downloads/sxhkd
$ make
$ sudo make install

~/.config/sxhkd directory and sxhkdrc file →

$ mkdir -p ~/.config/sxhkd
$ cp ~/Downloads/bspwm/examples/sxhkdrc !$

That’s it

$ command -V sxhkd
sxhkd is /usr/local/bin/sxhkd

Custom Shortcuts ~ TL;DR

Sxhkd

Reference

ActionShortcut
Reload Sxhkd Configuration FileSuper-Esc
Bspwm

Reference

ActionShortcut
Quit Bspwm (Return to the greeterSuper-S-q
Restart BspwmSuper-S-r
OS Window

Reference

Program Launch

Reference ~ Reference ~ Reference

ActionShortcut
KittySuper-Enter
RofiSuper-d
FirefoxSuper-S-f
BurpsuiteSuper-S-b
I3Lock-FancySuper-S-x

Configuration File

Copy from here the sxhkdrc Full Customised Configuration File

sxhkd Section
Reload sxhkd’s Configuration File → Super-Esc

Note that super refers to the Windows key

super + Escape
  pkill -USR1 -x sxhkd
bspwm Section

The rest of the key bindings related to bspwm in the sxhkdrc file are in the link above

Quit/Restart → Super-S-{q,r}

To Return to the greeter closing the Windows ManagerW-S-q

To Restart the Windos ManagerW-S-r

super + shift + {q,r}
    bspc {quit,wm -r}
OS Windows - Open/Close → Super-Enter/Super-q
super + {_,shift + }q
    bspc node -{c,k}
OS Windows State - Monocle Layout (Zoom {in,out}) → Super-m

See the different OS Windows Layouts/States for bspwm here

It switches the Focused Windows display to a Monocle State

super + z
    bspc desktop -l next
OS Windows State - Tiled → Super-t

bspwm Layouts/States here

It switches the Focused Windows display to its default state, the Tiled one

super + {t,shift + t,s,f}
    bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
OS Windows State - Floating → Super-s

bspwm Layouts/States here

It switches the Focused Windows display to a Floating State

super + {t,shift + t,s,f}
    bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
OS Windows State - Full-Screen → Super-f

bspwm Layouts/States here

It switches the Focused Windows display to a Full-Screen State

super + {t,shift + t,s,f}
    bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
OS Windows - Focus → Super-{h,j,k,l}

To change the focus between the different OS Windows on a specific Desktop

super + {_,shift + }{h,j,k,l}
    bspc node -{f,s} {west,south,north,east}

OS Windows - Movement → Super-S-{h,j,k,l}

Moves the focused OS Window in the specificed direction. It is like a Windows Exchange

super + shift + {Left,Down,Up,Right}
    bspc node -v {-20 0,0 20,0 -20,20 0}

OS Windows - Resize → Super-M-{h,j,k,l}

In the bspwm keybinding section, a custom bash script is set as the command to be executed when the following input events (hotkeys) are performed →

super + alt + {h,j,k,l}
    /home/al3xbb/.config/bspwm/bin/bspwm_resize.sh {west,south,north,east}

The above code allows to resize an OS Window with the super + alt shortcut regardless of the state

Create a directory inside ~/.config/bspwm called bin and store the bspwm_resize.sh’s content as a script (i.e. an executable file)

bspwm_resize.sh Content here

$ mkdir ~/.config/bspwm/bin
$ touch bspwm_resize.sh
$ chmod +x !$
$ nvim $
OS Windows - Move it to another Desktop → Super-S-desktop_number

Moves the focused OS Windows to another bspwm Desktop

super + {_,shift + }{1-9,0}
    bspc {desktop -f,node -d} '^{1-9,10}'
OS Desktop - Focus → Super-desktop_number

To move between the different OS Desktops via the Desktop Number → Super-desktop_number

super + {_,shift + }{1-9,0}
    bspc {desktop -f,node -d} '^{1-9,10}'

To move to the last OS DesktopSuper-Tab

super + {grave,Tab}
    bspc {node,desktop} -f last
Kitty Section
Launch kitty Terminal → Super-Enter
super + Return
  /opt/kitty/bin/kitty
Rofi Section
Launch Rofi → Super-d
super + d
  /usr/bin/rofi -show run
Other Processess Section
Launch Firefox → Super-S-f
super + shift + f
    /usr/bin/firefox
Launch Burpsuite → Super-S-b
super + shift + b
    /usr/bin/burpsuite-launcher
Launch I3Lock-Fancy → Super-S-x
super + shift + x
    /usr/bin/i3lock-fancy