################################################################################################
# SXHKD

# Restart sxhkd (Apply config)
super + p
	pkill -USR1 -x sxhkd;\
	notify-send Reload


################################################################################################
# BSPWM

# Restart BSPWM
super + shift + p
	bspc {wm -r}

# Close / Kill focused window
super + {_,shift} + q
	bspc node -{c,k}

# Tiled / Monocle layout
super + f
	bspc desktop -l next

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

# Swap current and last node
super + g
	bspc node -s last

# Swap current and biggest node
super + shift + g
	bspc node -s biggest


################################################################################################
# BSPWM States / Flags

# Window state
super + shift + f
	bspc node -t \~floating
super + {_,shift} + v
	bspc node -t \~{fullscreen,tiled}

# Node flags
super + shift + {s,u,i,p}
	bspc node -g {sticky,marked,locked,private}


################################################################################################
# BSPWM Focus / Move

# Focus / Move node in direction
super + {_,shift + }{h,j,k,l}
	bspc node -{f,s} {west,south,north,east}

# Send to and focus desktop
super + shift + {1-9,0}
    ID=$(bspc query -N -n); bspc node -d ^{1-9,10}; bspc node -f ${ID}

# Focus desktop / Send to desktop
super + {_,ctrl + }{1-9,0}
	bspc {desktop -f,node -d} '^{1-9,10}'

# Focus next / previous desktop (Current monitor)
super + bracket{left,right}
	bspc desktop -f {prev,next}.local

# Focus last / current node
super + {e,r}
	bspc wm -h off; \
	bspc node {older,newer} -f; \
	bspc wm -h on


################################################################################################
# BSPWM Preselect

# Preselect node in direction
super + space + {h,j,k,l}
	bspc node -p {west,south,north,east}

# Preselect ratio
super + space + {1-9}
	bspc node -o 0.{1-9}

# Deselect focused node
super + ctrl + space
	bspc node -p cancel

# Deselect Desktop
super + ctrl + shift + space
	bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel


################################################################################################
# BSPWM Move / Resize

# Expand
super + alt + {h,j,k,l}
	bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}

# Contract
super + 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
super + {Left,Down,Up,Right}
	bspc node -v {-20 0,0 20,0 -20,20 0}




################################################################################################
# Music

# Pavucontrol GUI
super + m
	setsid pavucontrol

# Player control (Spotify)
super + shift + slash
	setsid alacritty -e sh -c 'ncspot'
super + slash
	playerctl play-pause
super + period
	playerctl next
super + comma
	playerctl previous

# Volume control
XF86AudioMute
	amixer sset 'Master' toggle
XF86AudioLowerVolume
	amixer sset 'Master' 5%-;
XF86AudioRaiseVolume
	amixer sset 'Master' 5%+;


################################################################################################
# Screen

# Kill Window on click (xkill)
super + ctrl + x 
	xkill
super + ctrl + shift + x 
	killall xkill

# Polybar
super + b
	sh -c 'polybar-msg cmd toggle'
super + shift + b
	setsid sh "$HOME/.config/polybar/launch_polybar.sh"

# Brightness
XF86MonBrightnessUp
	xbacklight -inc 10
XF86MonBrightnessDown
	xbacklight -dec 10


################################################################################################
# Applications

# Terminal emulator (Alacritty)
super + Return
	alacritty

# Rofi
super + d
	rofi -show drun -show-icons -icon-theme Adwaita -drun-display-format \{name\} -sort -sort-method fzf
super + Tab
	rofi -show window -show-icons -icon-theme Adwaita -drun-display-format \{name\} -sort -sort-method fzf
super + shift + d
	bwmenu

# Screenshot (Flameshot)
Print
	flameshot gui
super + Print
	flameshot full

# Browser (Firefox)
super + F2
	setsid firefox

# File Manager (Nautilus)
super + F3 
	setsid nautilus

# Chat Programs (Telegram, Whatsapp Web)
super + F4
	setsid telegram-desktop

super + shift + F4
	setsid 'firefox -new-window web.whatsapp.com'
