PRIMARY CATEGORY → DESKTOP 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
INFO
Note that
checkProcess
andlaunchProcess
are shell functions declared in the~/.config/bspwm/src/bspwmrc.sh
source fileAbove implementation would be something similar to the usual approach through
pgrep --exact process_name || binary|script_path &
#!/usr/bin/env sh pgrep --exact sxhkd > /dev/null 2>&1 || 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
CAUTION
First, see the bspwm’s installation before proceeding with this one related to
sxhkd
There are some dependencies that are needed in the following installation steps
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 !$
IMPORTANT
Be aware that
sxhkdrc
’s example/template file is copied from thebspwm
repository rather than from thesxhkd
one
That’s it
$ command -V sxhkd
sxhkd is /usr/local/bin/sxhkd
TL;DR ⌨
Shorcuts’ Meaning
Key | Meaning | |
---|---|---|
C | Control | C-c → Control+c |
M | Alt | M-a → Alt+a |
S | Shift | S-o → Shift+o |
Super | Windows | Super-s → Windows+s |
Return | Enter | C-S-Return → Control+Shift+Enter |
- | + | C-z → Control+z |
{a,b,c,d} | a b c d | C-{a,b,c,d} → C-a C-b C-c C-d |
Sxhkd
Action | Shortcut |
---|---|
Reload Sxhkd Configuration File | Super-Esc |
Bspwm
Action | Shortcut |
---|---|
Quit Bspwm (Return to the greeter) | Super-S-q |
Restart Bspwm | Super-S-r |
OS Window
Action | Shortcut |
---|---|
OS Windows Closing | Super-q |
OS Windows - Monocle Layout | Super-m |
OS Windows - Tiled Layout | Super-t |
OS Windows - Floating Layout | Super-s |
OS Windows - Full Screen | Super-f |
Os Windows Focus ⬅️⬇️⬆️➡️ | Super-{h,j,k,l} |
OS Windows Movement ⬅️⬇️⬆️➡️ | Super-S-{h,j,k,l} |
OS Windows Resize ⬅️⬇️⬆️➡️ | Super-M-{h,j,k,l} |
OS Windows to another Desktop | Super-S-DESKTOP_NUMBER |
Desktop Focus | Super-DESKTOP_NUMBER |
Last Desktop Focus | Super-TAB |
Program Launch
Action | Shortcut |
---|---|
Kitty | Super-Return |
Rofi | Super-d |
Firefox | Super-S-f |
Burpsuite | Super-S-b |
I3Lock-Fancy | Super-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 thesxhkdrc
file are in the link above
Quit/Restart → Super-S-{q,r}
To Return to the greeter closing the Windows Manager → W-S-q
To Restart the Windos Manager → W-S-r
super + shift + {q,r}
bspc {quit,wm -r}
OS Windows - Open/Close → Super-Return/Super-q
- Open → Check the Kitty Section
- Close, as follows →
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 Desktop → Super-Tab
super + {grave,Tab}
bspc {node,desktop} -f last
Kitty Section
Launch kitty Terminal → Super-Return
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