####################
# WM independent hotkeys
####################

# mic
super + BackSpace
	$HOME/.scripts/toggle-mute.sh

super + ctrl + alt + f
	pactl list sources | grep -qi 'Active Port: analog-input-rear-mic' && pactl set-source-port 2 analog-input-front-mic || pactl set-source-port 2 analog-input-rear-mic

#Volume Control
{XF86AudioLowerVolume,super + Next}
	amixer -D pulse sset Master 5%-
{XF86AudioRaiseVolume,super + Prior}
	amixer -D pulse sset Master 5%+
{XF86AudioMute}
	amixer -D pulse set Master 1+ toggle

{_, super} + XF86MonBrightnessDown
    light -U {10,1}
{_, super} + XF86MonBrightnessUp
    light -A {10,1}



super + r
    $HOME/.scripts/launcher

super + shift + r
	rofi -show ssh -show-icons

super + ctrl + Tab
	rofi -show window

super + g
	$HOME/.scripts/toggle-gap.sh

super + shift + g
	$HOME/.scripts/toggle-size-hints.sh

# open terminal
super + Return
	$TERMINAL

# open pdf viewer
super + z
		curl -SsL --output - $(xsel) | zathura -
# open video player
super + v
	mpv --player-operation-mode=pseudo-gui $(xsel)

# open browser
super + b
	$BROWSER

# open xlinks
super + x
	$HOME/.scripts/links-launcher

# open email
super + m
	$EMAIL_CLIENT

# open file manager
super + n
	$FILE_MANAGER

# open dmenu iwd
super + i
	$HOME/.scripts/dmenu-iwd


# open audio mixer
super + semicolon
	bspc rule -a \* -o state=floating && $TERMINAL -e pulsemixer 

# xkill
ctrl + alt + Escape
	xkill

# top
meta + Escape
	$TERMINAL -e htop

# screenshot
super + s
	$HOME/.scripts/screenshot
super + shift + s
	$HOME/.scripts/screenshot_fs
super + ctrl + s
	$HOME/.scripts/screenshot_floating

# lock screen
super + ctrl + l
	$HOME/.scripts/lock

# power menu
super + ctrl + Escape
	$HOME/.scripts/powermenu

# emoji
super + ctrl + e
	$HOME/.scripts/dmenuemoji insert

# kaomoji
super + ctrl + c
	$HOME/.scripts/dmenukaomoji insert

# stuff
super + ctrl + m
	dmenu -p "i am stuff" | xargs /usr/bin/stuff 

super + ctrl + n
	dmenu -p "i am big chungus" | xargs /usr/bin/chungus

super + ctrl + t
	dmenu -p "toilet" | toilet --font mono12 | sed 's/ /_  _ /g' | xclip -selection clipboard
super + ctrl + b
	dmenu -p "eminem says" | xargs /usr/bin/eminem

# iocane
super + shift + Return 
	iocane -i

# switch monitor input sources
ctrl + super + apostrophe
    ddc-switch-inputs 1
ctrl + super + shift + apostrophe
    ddc-switch-inputs 2

# dim all but main monitor
super + alt + c 
	$HOME/.scripts/cinema.sh

# control gamma
super + alt + f
	$HOME/.scripts/gamma.sh 0.8
super + alt + g
	$HOME/.scripts/gamma.sh 1.2
super + alt + r
	$HOME/.scripts/gamma.sh
super + alt + t
	bspc rule -a \* -o state=floating && gamma

# record screen
super + alt + s
	$HOME/.scripts/screenrecord

#bring up calculator
super + period
	$HOME/.scripts/calculator

# file search and open
super + slash
   websearch 
shift + super + slash
	bspc rule -a \* -o state=floating && $TERMINAL -e $HOME/.scripts/fzf_menu.sh 

# Calendar
super + c
	$HOME/.scripts/calendar

super + comma
	$HOME/.scripts/notepad

###################
# mpd server	  #
###################

# play/pause, prev, next
super + alt + ctrl + o
	mpc toggle

{XF86AudioNext, super + alt + ctrl + p
	mpc next 

{XF86AudioPrev,super + alt + ctrl + i}
	mpc prev
super + alt + ctrl + apostrophe
	mpc shuffle
# stop
super + alt + ctrl + BackSpace
	mpc stop

#ncmpcpp
super + alt + ctrl + backslash
	bspc rule -a \* -o state=floating && $TERMINAL -e ncmpcpp 

# chooser
super + alt + ctrl + slash
	$HOME/.scripts/mpc_picker
# volume
super + alt + ctrl + Next
	mpc volume -10
super + alt + ctrl + Prior
	mpc volume +10

# show cover art
super + alt + ctrl + y
    kunst --music_dir ~/music/ --size 1000x1000

###################
# bspwm hotkeys
###################

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

# close / kill
super + {_,shift +}w
	bspc node -{c,k}

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

#
# state/flags
#

# float the window
super + f
    [ -z "$(bspc query -N -n focused.floating)" ] && \
        bspc node focused -t floating || \
        bspc node focused -t tiled;

# make the node sticky
super + d
    [ -z "$(bspc query -N -n focused.sticky)" ] && \
        bspc node focused -g sticky=on || \
        bspc node focused -g stick=off;

super + ctrl + f
	bspc node -t \~fullscreen

# pseudotile
super + p
    bspc node focused -t pseudo_tiled


#
# 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 next/previous window in the current desktop
super + ctrl + {_, shift +} Tab
	bspc node -f {next,prev}.local.!hidden.window

# focus the next/previous desktop in the current monitor
super + {Left,Right}
	bspc desktop -f {prev,next}.local

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

# focus or send to the given desktop
super + {_,shift + }{1,2,3,4,5,6,7,8,9}
	bspc {desktop -f,node -d} '{a1,a2,a3,a4,a5,a6,a7,a8,a9}'
super + ctrl + {_,shift + }{1,2,3,4,5,6,7,8,9}
	bspc {desktop -f,node -d} '{b1,b2,b3,b4,b5,b6,b7,b8,b9}'
super + alt + {_,shift + }{1,2,3,4,5,6,7,8,9}
	bspc {desktop -f,node -d} '{c1,c2,c3,c4,c5,c6,c7,c8,c9}'


#Toggle between vertical and horizontal split
super + alt + Return
	bspc node @parent -R 90

#
# 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
ctrl + super + {Left,Down,Up,Right}
	bspc node -v {-20 0,0 20,0 -20,20 0}