#
# wm independent hotkeys
#

# show help on key bindings
super + F1
  sh -c "$HOME/.config/bspwm/show_keys"
  #$HOME/.config/bspwm/bspwmfloat urxvt -name Float -e ~/.config/bspwm/show_keys

# terminal emulator
alt + Return
  sh -c "$HOME/.bin/draw"

# terminal emulator Tiled
super + Return
  urxvt -name Tiled

# terminal emulator Float
alt + t
  $HOME/.config/bspwm/bspwmfloat urxvt -name Float

# program launcher rofi
alt + d
  rofi -show drun

# firefox
alt + w
  firefox

# sublime text3
alt + e
  subl3

# thunar
alt + f
  thunar

# telegram
alt + m
  telegram-desktop

# ranger
alt + r
  urxvt -name Ranger -e ranger

# alt + c
#   rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'

# polybar toggle
super + ctrl + p
  polybar-msg cmd toggle

# multilock.sh
super + Delete
  sh -c "$HOME/.bin/multilock.sh -l blur"

# power menu rofi
super + alt + Delete
  sh -c "$HOME/.config/bspwm/power"

# flameshot full save ~/Pictures
Print
  flameshot full -c -p "$(xdg-user-dir PICTURES)"

# flameshot gui
super + Print
  flameshot gui

# flameshot delay 5s save PICTURES
super + alt + Print
  flameshot full -c -d 5000 -p "$(xdg-user-dir PICTURES)"

# mpc current
super + alt + m
  notify-send "Now Playing ♫" "$(mpc current)"

# alt + r
  # $HOME/.config/bspwm/popup Ranger ranger

# Balance desktop
super + b
  bspc node @focused:/ -B

# 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 + {_,shift + }z
  bspc node -{c,k}

# gaps/monocle toggle
super + c
  sh -c "~/.config/bspwm/gaps-monocle.sh"

# gaps toggle
super + v
  sh -c "~/.config/bspwm/gaps.sh"

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

# hide current node, or restore a queried hidden node
super + {_,shift} + minus
  bspc node {,$(bspc query -N -d -n .hidden | head -n 1)} -g hidden

# Focused desktop window gap
super + alt + {Up,Down}
  bspc config -d focused window_gap $((`bspc config -d focused window_gap` {-,+} 5 ))

# Focused desktop window gaps scroll
super + button{4,5}
  bspc config -d focused window_gap $((`bspc config -d focused window_gap` {-,+} 5 ))

# Global window gaps scroll
super + alt + button{4,5}
  bspc config window_gap $(( $(bspc config window_gap) {-,+} 5 ))

# 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 + alt + n
  bspc node -s biggest

#
# state/flags
#

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

# window floating/tiled toggle
alt + space
  bspc node -t "~"{floating,tiled}

# window sticky
super + g
  bspc node -g sticky

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

#
# 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
alt + {_,shift + }Tab
  bspc node -f {next,prev}.local

# focus desktop prev,next
super + alt + {Left,Right}
  bspc desktop -f {prev,next}.local

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

# focus desktop 1-10
super + {q,w,e,r,t,y,u,i,o,0}
  bspc desktop -f '^{1-9,10}'

# focus or send to the given desktop
super + {_,alt + }{1-9,0}
  bspc {desktop -f,node -d} '^{1-9,10}'

# focus or send desktop next,prev
super + ctrl + {Right,Left}
  bspc node -d {next,prev} -f

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

#
# 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
ctrl + alt + 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
super + 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
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}

# audio control
XF86AudioLowerVolume
  amixer set Master 5%-
XF86AudioRaiseVolume
  amixer set Master 5%+
XF86AudioMute
  amixer set Master toggle

# Brightness control
XF86MonBrightnessDown
  xbacklight -dec 5
XF86MonBrightnessUp
  xbacklight -inc 5
