#
# Meta
#

# Reload SXHKD
super + Escape
	le-keyboard &&
	pkill -USR1 -x sxhkd &&
	notify-send 'Key daemon reloaded'

# Show keybinds
super + slash
	sxh-help

#
# Media
#

# Play/pause track
XF86AudioPlay
    playerctl play-pause

# Play/pause track
Pause
    playerctl play-pause

# Previus track
XF86AudioNext
    playerctl next
 
# Previous track
XF86AudioPrev
    playerctl previous
 
# Stop track
XF86AudioStop
    playerctl stop

#
# Applications
#

# Open terminal
super + Return
	xfce4-terminal

# Launch program (drun)
super + @space
	rofi -show drun -show-icons

# Launch floating program
super + shift + button2
	slop

# Open window management context menu
super + button2
	bspc-context-menu
	
# Run command
super + shift + @space
	rofi -show run

#
# XFCE
# 

# Show clipboard
super + v
	xfce4-popup-clipman

# Lock screen
super + q
	xflock4

# Session options
super + shift + q
	xfce4-session-logout

#
# Screen capturing
#

# Grab color and put in clipboard
shift + XF86Launch5
	flameshot gui
	

# Screenshot region
XF86Launch5
	commentmenu 'grabc | xclip -sel clipboard # Put color in clipboard\nflameshot gui # Capture region' | sh

#
# Qutebrowser
#

# Make a qutebrowser search
super + o
	qutesearch

# # Preselect below and make a qutebrowser search
# super + p
# 	bspc node -p south -o 0.01 \
# 		&& qutesearch \
# 		|| bspc node -p cancel

#
# Focus
#

# Move focus west/south/north/east
super + {h,j,k,l,Left,Down,Up,Right}
	bspc node -{f} {west,south,north,east,west,south,north,east}

# Move focus forward/backward in stack
super + {d,a}
    bspc node -f {next,prev}.local.window

# Focus or send to desktop
super + {_,shift + }{1-9}
	bspc {desktop -f,node -d} '^{1-9}'

#
# Window management
#

# Close or kill window
super + {_,shift + }w
	bspc node -{c,k}

# Move window west/south/north/east
super + shift + {h,j,k,l,Left,Down,Up,Right}
	bspc-smart-move {west,south,north,east,west,south,north,east}

# Maximize below/above
super + {x,z}
	bspc-column {up,down}

# Toggle floating/tiled
super + c
	bspc node 'focused.!tiled' -t tiled || bspc node 'focused.!floating' -t floating

# Toggle fullscreen
super + f
	bspc node 'focused.!fullscreen' -t fullscreen || bspc node 'focused.!tiled' -t tiled


# Switch between tiled and stacked layout
super + m
	bspc desktop -l next

#
#   Preselection
#

# Preselect in a direction
super + ctrl + shift {h,j,k,l,Left,Down,Up,Right}
	bspc node -p {west,south,north,east,west,south,north,east}
	
# Cancel all preselections in desktop
super + ctrl + space
	bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel

# Swap current window with preselection
super + s
	bspc node -n last.\!automatic -t tiled
