# wm independent hotkeys

# terminal emulator
super + Return
	kitty

super + e
    nautilus

super + f
    firefox

# program launcher
# super + space
#    dmenu_run

super + space
    ~/.config/rofi/scripts/launcher

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

# bspwm hotkeys

# quit/restart bspwm
super + alt + {q,r}
	bspc {quit,wm -r}

# close and kill
super + {w,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 window
super + g
	bspc node -s biggest.window

super + shift + s
    ~/.config/rofi/scripts/screenshot

#
# 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}

# send node to left tree and rotate 90 degrees
ctrl + alt + {h,j,k,l}
    bspc node -n {west,south,north,east}

ctrl + alt + r
    bspc node -r 90

#
# focus/swap
#

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

# focus paired desktop
super + {1-5}
    select={1-5}; \
    current="$(bspc query -M -m focused)"; \
    opposite="$(bspc query -M -m 'any.!focused')"; \
    bspc desktop -f "$opposite:^$select"; \
    bspc desktop -f "$current:^$select"

# focus or move node to single desktop 
super + ctrl + {1-9,0}
    bspc desktop -f "^{1-9,0}"

# send note to single desktop
super + shift + {1-9,0}
    bspc node -d "^{1-9,0}" --follow

# swap current desktop with target desktop and switch to paired desktop afterwards
super + alt + {1-5}
    select={1-5}; \
    current="$(bspc query -M -m focused)"; \
    opposite="$(bspc query -M -m 'any.!focused')"; \
    bspc desktop -s "$current:^$select" --follow; \
    bspc desktop -f "$opposite:^$select"

# move current window to tmp desktop // or recall tmp windows
super + m
    bspc node -d "tmp"

#
# preselect
#

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

# 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
