#===============XF86==========================
#Increase Brightness
XF86MonBrightnessUp
  light -A 10 || xbacklight -inc 10

#Decrease Brightness
XF86MonBrightnessDown
  light -U 10 || xbacklight -dec 10



#Decrease/Increase,mute Volume
{XF86AudioLowerVolume,XF86AudioRaiseVolume,XF86AudioMute}
  amixer -q sset 'Master' {2%-, 2%+,0}

#next, Pause/unpause mpd
#{XF86AudioStop, XF86AudioNext,XF86AudioPlay, XF86AudioPrev}
  #mpc {stop, next,toggle,prev}
XF86AudioPlay
  ~/bin/pause-mpv

#Mail, Browser
{XF86Mail,XF86HomePage}
  {thunderbird, qutebrowser || palemoon ||firefox}

# Screenshot, shift: copy to clipboard, copy: save to screenshots folder
{_,shift,ctrl} Print
   flameshot {gui ,full --clipboard, full --path "$HOME/Pictures/screenshots"}

#==================Progs======================
#super + space
   #tdrop -ma -w 75% -x 12% -y  "$PANEL_HEIGHT"  -s dropdown emacsclient --eval "(emacs-everywhere)"
# wm independent hotkeys
#
F8
 warpd --normal

Pause
  transformers_ocr recognize


# terminal emulator
super + Return
	alacritty
	#mlterm -e zsh || alacritty

# make sxhkd reload its configuration files:
#super + Escape
	#pkill -usr1 -x sxhkd && notify-send 'sxhkd' 'Reloaded Config'

# Doom Emacs Capture
#super + ctrl + space
	#~/.emacs.d/bin/org-capture

# emacs
super + e
  emacsclient -nc -alternate-editor="emacs"
  #emacsclient -nc -alternate-editor=""

super + shift + e
  ~/bin/org-capture
# show poly-bar
super + b
  polybar-msg cmd show; bspc config -m focused top_padding 20
  #polybar-msg cmd hide; bspc config -m focused bottom_padding $((`bspc config -m focused top_padding` - 27 ))

# hide poly-bar
super + shift + b
  polybar-msg cmd hide; bspc config -m focused top_padding 0
  #polybar-msg cmd show; bspc config -m focused bottom_padding $((`bspc config -m focused top_padding` + 27 ))

# scratchpad tdrop
super + g
    tdrop -ma -w 75% -x 12% -y  "$PANEL_HEIGHT"  -s dropdown alacritty --class wmpin -o background_opacity=0.6

#editor everywhere (vimclip)
#super + shift + g
    #tdrop -ma -w 75% -x 12% -y "$PANEL_HEIGHT"  alacritty  -o background_opacity=0.6 --command ~/bin/wm/editor-everywhere

#======================== scripts and  other =====
# Lockscreen + lock keepassxc
super + Home
  ~/bin/wm/lockscreen --lock-keepassxc --lock-desktop --image ~/Pictures/wall.png

# lockscreen only
super + End
  ~/bin/wm/lockscreen --lock-desktop --image ~/Pictures/wall2.png

#=============================


#
# bspwm hotkeys
#
#================WM=============================

# Show Help
#super + slash
	#~/bin/wm/sxhkd-help

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

# close and kill
super + {shift, ctrl } + 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 -n newest.\!automatic

   #bspc node newest.marked.local -n newest.!automatic.local

# swap the current node and the biggest window
#super + g
	#bspc node -s biggest.window

# Window Gap
super + ctrl + {equal, minus}
  bspc config window_gap $(( $(bspc config window_gap) {+,-} 1 ))

#
# Launchers
#

# program launcher
super + r
 ~/.config/polybar/forest/scripts/launcher.sh ||	dmenu_run

# program launcher
super + shift + r
 	rofi -show run || dmenu_run
super + v
  rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'

# program launcher
super + {bracketleft,bracketright}
 	{rofi -show calc -modi calc -no-show-match -no-sort,~/bin/rofi_bin_launcher.py}

super + shift + bracketleft
 	rofi -show spell -modes "spell:rofi-spellcheck.sh"
super + ctrl + bracketleft
 	qalculate-gtk


#
# state/flags
#
#Sticky , hide
super + {p,n}
   bspc node -g {sticky,hidden,}

# unhide
super + shift + n
  bspc node $(bspc query -N -n .hidden.local | head -n 1) -g hidden=off

# 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,z}
	bspc node -g {marked,locked,private}

#
# focus/swap
#

# focus the node in the given direction, if no node then focus monitor
super + {_,shift + }{h,j,k,l}
    bspc node -{f,s} {west,south,north,east}
    #~/bin/wm/focus -{f,s} {west,south,north,east}

# focus the node for the given path jump
super + {p,comma,period}
	bspc node -f @{parent,first,second}

# Desktop===========================================================

# next/prev desktop or move window, or desktop 
super + {_, shift +, ctrl + }{i,u}
  bspc {desktop -f,node -d,desktop -f -s } {next,prev}.local

# focus the next/previous window in the current desktop
#super + {_,shift + }c
	#bspc node -f {next,prev}.local.!hidden.window

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

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

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

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

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

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