Skip to content

Instantly share code, notes, and snippets.

@amit08255
Created October 10, 2021 01:52
Show Gist options
  • Save amit08255/43ed6efdc1952d88f9a61e86f375e924 to your computer and use it in GitHub Desktop.
Save amit08255/43ed6efdc1952d88f9a61e86f375e924 to your computer and use it in GitHub Desktop.
Bspwm Cheatsheet

bspwm/sxhkd cheat sheet

Common keys

Super + Escape sxhkd: reload configuration
Super + Break Logoff menu
Super + Q close focused window
Super + Shift + Q kill focused window

Window management

Super M toggle tiled/monocle mode
Super Y bring marked window to current receptacle
Super G swap focused window with the biggest one on the current desktop
Super T tiled mode for focused window
Super Shift T pseudo_tiled mode for focused window
Super S floating mode for focused window
Super F fullscreen mode for focused window

Window flags

Super Ctrl M Flag: mark
Super Ctrl X Flag: locked
Super Ctrl Y Flag: sticky
Super Ctrl Z Flag: private

Focus

Super { H, J, K, L } Move focus to {west, south, north, east}
Super Shift { H, J, K, L } Move focused window to {west, south, north, east}
Super { P, B, Comma, Period } Path jump {parent, brother, first, second}
Super N select next window on active desktop
Super Shift N select previous window on active desktop
Super > select next desktop on active monitor
Super < select previous desktop on active monitor
Super O focus history: walk backwards
Super I focus history: walk forwards
Alt Tab select previous active window
Alt Shift Tab select previous active desktop

Preselection / Receptacles

Super Ctrl { H, J, K, L } preselect: {west, south, north, east}
Super Ctrl Space remove preselection for active window
Super Ctrl Shift Space remove preselection for active desktop

Window size/position

Ctrl Alt { H, J, K, L } resize active window outwards {west, south, north, east}
Ctrl Alt Shift { H, J, K, L } resize active window inwards {west, south, north, east}
Ctrl Alt { , , , } move current window (floating mode only)

Desktop management

Super { ^, 0-9, ß, ´ } select desktop {0-12}
Super Shift { ^, 0-9, ß, ´ } move active window to desktop {0-12}
Super Ctrl { ^, 0-9, ß, ´ } swap active destop and desktop {0-12}
Super Ctrl Shift { ^, 0-9, ß, ´ } move active destop to the monitor of desktop {0-12}
Super Ctrl Shift { +, - } move active destop to the {next,prev} monitor
Super Ctrl Shift { H, J, K, L } move active destop to the {western,southern,northern,eastern} monitor

Applications

Super Tab Rofi: open bookmarks
Super Break Rofi: shutdown/sleep
Super Printscreen ksnapshot
Super Enter urxvt
Hyper R ranger
Hyper K krusader
Hyper F Rofi: FontAwesome-selection
Hyper P Rofi: Asterisk (dial a phone number)
Hyper D Rofi: combi
Hyper Shift D Rofi: drun
Hyper Ctrl D Rofi: ssh
Hyper Ctrl C Rofi: edit config files
Hyper S Rofi: Screen-Layout
Hyper O Pseudo-terminal

Work

Super A Toggle CCWF-RDP visibility
Hyper A Rofi: CCWF-RDP

~/.config/sxhkd/sxhkdrc

# WM INDEPENDENT KEYBINDINGS

# make sxhkd reload its configuration files:
super + Escape
	pkill -USR1 -x sxhkd

hyper + g
  gvim

# BSPWM HOTKEYS

# quit/restart bspwm
super + shift + {Escape}
	bspc {quit}

# close and kill
super + {_,shift + }q
	bspc node -{c,k}

# alternate between the tiled and monocle layout
super + m
	bspc desktop -l next

# send the newest marked node to the newest preselected node
super + y
	bspc node newest.marked.local -n newest.!automatic.local

# swap the current node and the biggest node
super + g
	bspc node -s biggest.local

# STATE/FLAGS

# set the window state
super + {t,shift + t,s,f}
	bspc node -t {tiled,pseudo_tiled,floating,fullscreen}

# set the node flags
super + ctrl + {m,x,y,z}
	bspc node -g {marked,locked,sticky,private}

# SCRATCHPAD
super + a
	/home/olly/bin/bspwm_scratchpad.sh CCWF_RDP

# FOCUS/SWAP

# focus the node in the given direction
super + {_,shift + }{h,j,k,l}
	bspc node -{f,s} {west,south,north,east}

# focus the node for the given path jump
super + {p,b,comma,period}
	bspc node -f @{parent,brother,first,second}

# focus the next/previous node in the current desktop
super + {_,shift + }n
	bspc node -f {next,prev}.local

# focus the next/previous desktop in the current monitor
super + {less,greater}
	bspc desktop -f {prev,next}.local

# focus the last node/desktop
alt + Tab
	bspc node -f last

alt + shift + Tab
	bspc desktop -f last

# focus the older or newer node in the focus history
super + {o,i}
	bspc wm -h off; \
	bspc node {older,newer} -f; \
	bspc wm -h on

# PRESELECT

# preselect the direction
super + ctrl + {h,j,k,l}
	bspc node -p {west,south,north,east}

# preselect the ratio
#super + ctrl + {1-9}
#	bspc node -o 0.{1-9}

# cancel the preselection for the focused node
super + ctrl + space
	bspc node -p cancel

# cancel the preselection for the focused desktop
super + ctrl + shift + space
	bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel

# MOVE/RESIZE

# expand a window by moving one of its side outward
ctrl + alt + {h,j,k,l}
	bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}

# contract a window by moving one of its side inward
ctrl + alt + shift + {h,j,k,l}
	bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}

# move a floating window
ctrl + alt + {Left,Down,Up,Right}
	bspc node -v {-20 0,0 20,0 -20,20 0}

# SPECIALKEYS
XF86MonBrightness{Up,Down}
 xbacklight -{inc,dec} 5 &

XF86TouchpadToggle
 ~/bin/toggleAsusTouchpad &

# on the asus this needs kernel module asus-wireless to be loaded
XF86RFKill
  ~/bin/toggleAsusAirplaneMode

XF86AudioMute
 amixer -q -D pulse sset Master toggle &

XF86Audio{Lower,Raise}Volume
 amixer -q -D pulse sset Master 5%{-,+} unmute &

XF86Audio{Play,Prev,Next,Stop}
 ~/bin/mediacontrolkeys.sh {PlayPause,Previous,Next,Stop} &

XF86Sleep
	~/bin/i3/i3lock.sh && systemctl suspend -i

XF86WakeUp
	~/bin/i3/i3lock.sh

# heres comes a dirty hack: KeepassXC won't handle Scroll_Lock...
# so KeepassXC will autotype on ctrl+shift+alt+greater. We use xdotool
# to send those keys on Scroll_Lock:
XF86LaunchF
	xdotool key --window `xdotool search "oliver-main - KeePassX" | head -n1` --delay 25 --clearmodifiers ctrl+alt+shift+greater

# APPLICATION KEYBINDINGS (Super + Alt + Key)
super + Return
	/usr/bin/urxvt

super + Pause
	~/bin/rofi-shutdown.sh

super + Tab
 ~/Projekte/bookmark/bookmarks.sh

super + Print
 /usr/bin/spectacle

hyper + r
 /usr/bin/urxvt -e ranger

hyper + k
 /usr/bin/krusader

hyper + f
 ~/bin/i3/rofi-font-awesome.sh

# ROFI SCRIPTS
hyper + control + c
	~/bin/rofi-config-files.sh

hyper + d
	~/bin/i3/i3rofi.sh combi

hyper + shift + d
	~/bin/i3/i3rofi.sh drun

hyper + ctrl + d
	~/bin/i3/i3rofi.sh ssh

hyper + p
  ~/bin/rofi-asterisk.sh

hyper + s
	~/bin/rofi-screen-setup.sh

hyper + m; {m,u}
	~/bin/rofi-mount.sh {start,stop}

hyper + o
  urxvt -shading 100 -title 'pseudoframe' -name 'pseudoframe' -e sh -c 'tput civis; sleep 365d'

hyper + a
 ~/bin/rofi-ccwf.sh

# https://protesilaos.com
# Dynamic desktop behaviour:  this invokes a script of mine that
# implements dynamic desktops (see dotfiles).  If the given desktop
# number is missing, it is created on the spot.  Empty desktops are then
# removed automatically.
#
# mod3 +  = focus the given desktop
# mod3 + shift +  = send focused window to given desktop
# mod3 + ctrl + shift +  = as above, but send to next monitor
# mod3 + ctrl + = switches the active (visible) desktop of the
# unfocused monitor, without focusing it (focus stays on the current
# desktop/monitor).  It also inserts a receptacle, meaning that the next
# created window will go there without calling focus to itself (see my
# bspwm_external_rules).
#
# Commands for receptacles are defined in the "advanced operations"
# section.
#
# NOTE the leading `;` runs this command asynchronously.
#super + {_,shift + ,ctrl + shift +,ctrl +}{asciicircum,1-9,0,ssharp,acute}
#	;bspwm_dynamic_desktops {--df,--ns,--nm,--da} {0,1-9,10,11,12}
#super + {_,shift + }{asciicircum,1-9,0,ssharp,acute}
#	;bspwm_dynamic_desktops {--df,--ns} {0,1-9,10,11,12}

#focus or send to the given desktop
super + {_,shift + }{grave,asciicircum,1-9,0,ssharp,minus,equal,acute}
	bspc {desktop -f,node -d} {0,0,1-9,10,11,11,12,12}

#swap desktops
super + ctrl + {grave,asciicircum,1-9,0,ssharp,minus,equal,acute}
	bspc desktop -s {0,0,1-9,10,11,11,12,12} --follow

#send focused desktop to the monitor of target desktop
super + ctrl + shift + {grave,asciicircum,1-9,0,ssharp,minus,equal,acute}
	bspc desktop -m `bspc query -M -d {0,0,1-9,10,11,11,12,12} --names` --follow

#send focused desktop to next/previous/{dir} monitor
super + ctrl + shift + {n,p,h,j,k,l}
	bspc desktop -m {next,prev,west,south,north,east} --follow

super + F1
	surf -BS "https://www.la-familia-grande.de/index.php?site=bspwm" 
@AdskiyPonchik
Copy link

Impressive. Thanks!

@nishantvarma
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment