#
# bspwm hotkeys
#


grave ; shift + c
	~/.ratpoison/wp change

grave ; f
	~/.ratpoison/spotlight

grave ; alt + Escape
	bspc quit

grave ; x
	bspc window -c

grave ; X
	bspc window -k

grave ; o
	bspc desktop -l next

grave ; b
	bspc desktop -B

# banish mouse
grave ; B
	xdotool mousemove 10000 100000

grave ; {u,U,O}
	bspc window -t {floating,pseudo_tiled,fullscreen}

grave ; {grave,Tab}
	bspc {window,desktop} -f last

grave ; apostrophe
	bspc window -s last

#grave ; {o,i}
#	bspc control --record-history off; \
#	bspc window {older,newer} -f; \
#	bspc control --record-history on

#grave ; y
#	bspc window -w last.manual

grave ; m
	bspc window -s biggest

grave ; {h,j,k,l}
	bspc window -f {left,down,up,right}

grave ; c; {h,j,k,l}
	bspc window -s {left,down,up,right}

#grave ; {_,shift + }c
#	bspc window -f {next,prev}

grave ; {comma,period}
	bspc desktop -C {backward,forward}

grave ; bracket{left,right}
	bspc desktop -f {prev,next}

grave ; s ; {h,j,k,l}
	bspc window -p {left,down,up,right}

grave ; ctrl + {_,shift + }space
	bspc {window -p cancel,desktop -c}

hyper + {h,j,k,l}
	bspc window -e {left -10,down +10,up -10,right +10}

hyper + alt + {h,j,k,l}
	bspc window -e {right -10,up +10,down -10,left +10}

grave ; {1-9}
	bspc window -f {1-9}


grave ; ctrl + {1-9}
	bspc window -r 0.{1-9}

{_,alt + }{F1,F2,F3,F4,F5,F6,F7,F8,F9,F11,F12}
	bspc {desktop -f,window -d} ^{1-9,11,12}

{_,alt + } F10
	bspc {desktop -f,window -d} ^10 && xset -led named "Scroll Lock"


{_,alt + } shift + F12
	bspc {desktop -f,window -d} ^13

~button1
	bspc pointer -g focus

hyper + button{1-3}
	bspc pointer -g {move,resize_side,resize_corner}

# Move floating windows (requires baskerville's xdo pacacur -S xdo-git)
alt + {h,l,k,j}
    xdo move {-x -20,-x +20,-y -20,-y +20}

# Resize floating windows
alt + shift + {h,l,k,j}
    xdo resize {-w -20,-w +20,-h -20,-h +20}

grave ; !button{1-3}
	bspc pointer -t %i %i

grave ; @button{1-3}
	bspc pointer -u

#
# wm independent hotkeys
#

grave ; i
	~/bin/paste

grave ; space
	urxvt

grave ; slash
	~/.ratpoison/create_frame

super + u
	uzbl-browser

super + f
	firefox

super + s
	skype

super + shift + L
	~/.ratpoison/lock


#
# Clipboard hotkeys
#

# Open youtube video in mpv
grave ; Y
	sleep 0.2 && xdotool key y && mpv "$(xclip -o)"


grave ; p ; {1-9}
	~/.ratpoison/clipboard paste {1-9}

grave ; p ; p
	~/.ratpoison/clipboard menu_paste 

grave ; p ; u
	~/.ratpoison/clipboard push

grave ; p ; o
	~/.ratpoison/clipboard pop

grave ; y ; {1-9}
	~/.ratpoison/clipboard set {1-9}

grave ; y ; y
	~/.ratpoison/clipboard menu_set 

grave ; shift + p
	xclip -o | curl -F 'sprunge=<-' http://sprunge.us | xclip 

#
# Sprunge and Imgur hotkeys
#

grave ; P
	xclip -o | curl -F 'sprunge=<-' http://sprunge.us | xclip 


grave;  g 
	exec ~/bin/imgur
#
# music control
#

super + space 
	mpc -h 127.0.0.1 toggle 

super + Right 
	mpc -h 127.0.0.1 next 

super + Left  
	mpc -h 127.0.0.1 prev

super + Up    
	mpc -h 127.0.0.1 volume +5

super + Down  
	mpc -h 127.0.0.1 volume -5

XF86AudioRaiseVolume
	amixer -q set Master 5+ && volume -f 'V%i' > /tmp/panel-fifo 

XF86AudioLowerVolume 
	amixer -q set Master 5- && volume -f 'V%i' > /tmp/panel-fifo

super + Prior
	amixer -q set Master 5+ && volume -f 'V%i' > /tmp/panel-fifo 

super + Next 
	amixer -q set Master 5- && volume -f 'V%i' > /tmp/panel-fifo
#
#
# brightness controls
#


XF86MonBrightnessUp
	xbacklight -inc 10

XF86MonBrightnessDown
	xbacklight -dec 2

XF86KbdBrightnessUp
	kbdlight up 1

XF86KbdBrightnessDown	
	kbdlight down 1


# Keyboard layouts
super + q 
	setxkbmap us 

super + c 
	setxkbmap us -variant colemak

# Password
grave ; t
	~/bin/passenter

grave ; T
	~/bin/passmake

# make sxhkd reload its configuration files:
grave ; Escape
	pkill -USR1 -x sxhkd