# node manager shortcuts

# kill the node manager
super + ctrl + Escape
	bspc quit

# kill the current node
super + c
	bspc node -c

# swap layouts
#super + y
#  bspc desktop -l next

# balance node surface area on current desktop
super + b
	bspc desktop -B

# toggle floating/fullscreen modes for current node
super + {s,f}
	bspc node -t {floating,fullscreen}

# focus the last node/desktop
super + {grave,Tab}
	bspc {node,desktop} -f last

# swap positions with the previous node
super + apostrophe
	bspc node -s last

# swap the current node with the biggest node on the current desktop
super + m
	bspc node -s biggest

# move/swap between nodes using vim-style arrows
super + {_,shift + }{h,j,k,l}
	bspc node -{f,s} {west,south,north,east}

# swap previous/next desktops
super + bracket{left,right}
	bspc desktop -f {prev,next}

super + {p,n}
	bspc desktop -f {prev,next}

# rotate node placement on current desktop
super + r
  bspc desktop -R 90

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

# clear the splitting area
super + ctrl + {_,shift + }space
	bspc {node -p cancel,desktop -c}

# expand the current node
super + alt + {h,j,k,l}
	bspc node -e {left -10,down +10,up -10,right +10}

# shrink the current node
super + alt + shift + {h,j,k,l}
	bspc node -e {right -10,up +10,down -10,left +10}

# set node split ratio
super + ctrl + {1-9,0}
	bspc node -r 0.{1-9,10}

# focus/move node to the selected desktop
super + {_,shift + }{1-9,0}
	bspc {desktop -f,node -d} ^{1-9,10}

# focus clicked node
~button1
	bspc pointer -g focus

# mouse controls for node movement and resizing
super + button{1-3}
	bspc pointer -g {move,resize_side,resize_corner}

# simulate mouse2
shift + super + button1
  bspc pointer -g resize_corner

# ???
super + !button{1-3}
	bspc pointer -t %i %i

# ???
super + @button{1-3}
	bspc pointer -u

# change node gap and desktop padding
super + plus
    bspc config -d focused node_gap $((`bspc config -d focused node_gap` + 5 ))

super + equal
    bspc config -m $(bspc query -M | head -n 1) top_padding $BAR_HEIGHT; bspc config -d focused node_gap $node_GAP

super + minus
    bspc config -d focused node_gap $((`bspc config -d focused node_gap` - 5 ))

super + alt + r
    bspc config -m $(bspc query -M | head -n 1) top_padding $BAR_HEIGHT; bspc config -d focused node_gap 0

super + alt + plus
    bspwm_padding +5

super + alt + minus
    bspwm_padding -5

# wm-independant shortcuts

# spawn a transparent node
super + alt + t
  urxvtc && compton-trans -c -o 0

# make current node transparent
super + t
  compton-trans -c -o 0

# make current node fully opaque
super + shift + t
  compton-trans -c -o 100

# swap sxhkx config with an alternate file and reload the new one
super + shift + alt + ctrl + r
  if [ -e ~/.config/sxhkd/altsxhkdrc ]; then mv ~/.config/sxhkd/sxhkdrc ~/.config/sxhkd/origsxhkdrc && mv ~/.config/sxhkd/altsxhkdrc ~/.config/sxhkd/sxhkdrc && pkill -USR1 -x sxhkd; fi

# spawn a terminal
super + Return
	urxvtc

# spawn the app launcher
super + space
	dmenu_run -fn "$PRIMARY_FONT_FAMILY_WITH_SIZE" -i -nb "#$(get_color 00)" -sb "#$(get_color 00)" -sf "#$(get_color 0A)" -nf "#$(get_color 04)" -h "$BAR_HEIGHT"

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

# lock the desktop
super + ctrl + shift + l
  slock

# spawn gui file explorer
super + e
    thunar

# volumes controls and media navigation for media keys
{_,shift + }XF86AudioLowerVolume
  ADJ={10,1} && amixer -c 1 sset Speaker $ADJ%- && amixer -c 1 sset Headphone $ADJ%- && amixer -c 1 sset Master $ADJ%- && update_bar_MasterVolume

{_,shift + }XF86AudioRaiseVolume
  ADJ={10,1} && amixer -c 1 sset Speaker $ADJ%+ && amixer -c 1 sset Headphone $ADJ%+ && amixer -c 1 sset Master $ADJ%+ && update_bar_MasterVolume

XF86AudioMute
  amixer -c 1 sset Master toggle && update_bar_MasterVolume

XF86AudioPlay
  mpc toggle

XF86AudioNext
  mpc next

XF86AudioPrev
  mpc prev

# monitor brightness controls for monitor birghtness keys
{_,shift + }XF86MonBrightnessUp
  add_percent_brightness {0.1,0.01} && update_bar_DisplayBrightness

{_,shift + }XF86MonBrightnessDown
  sub_percent_brightness {0.1,0.01} && update_bar_DisplayBrightness