# BSPWM
# Uses modifier key ALT

# Desktop
# View desktop
alt + {1-9,0}
	bspc desktop -f {1-9,10}

# Move node to desktop
alt + shift + {1-9,0}
	bspc node -d {1-9,10}


# WM
# quit/restart bspwm
alt + shift + {e,r}
	bspc {quit,wm -r}

# close/kill node
alt + {_,shift + }q
  bspc node -{c,k}

# make sxhkd reload its configuration files:
alt + shift + c
	pkill -USR1 -x sxhkd && dunstify 'sxhkd' 'Reloaded config!' 


# State and Flags
# set the window state
alt + {t,shift + t,s,f}
	bspc node -t {tiled,pseudo_tiled,floating,fullscreen}

# switch window layout
alt + space
	bsp-layout next --layouts wide,tall,tiled

# Focus/Swap Nodes
# focus the node in the given direction
alt + {_,shift + }{h,j,k,l}
	bspc node -{f,s} {west,south,north,east}

# Rotate tree
alt + shift + {d,a}
    bspc node @/ -C {forward,backward}


# Resize Node
# expand a window by moving one of its side outward
alt + ctrl + {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
alt + shift + ctrl + {h,j,k,l}
	bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}


# XF86 Keys
XF86AudioRaiseVolume 
	pamixer -i 5
XF86AudioLowerVolume 
	pamixer -d 5
XF86AudioMute
	pamixer -t

XF86AudioPlay
	[ $(playerctl -p "spotifyd,firefox" status) = "Playing" ] && playerctl -p "spotifyd,firefox" pause || playerctl -p "spotifyd,firefox" play
XF86AudioNext
	playerctl -p "spotifyd,firefox" next
XF86AudioPrev
	playerctl -p "spotifyd,firefox" previous

XF86MonBrightnessDown
	brightnessctl s 10%-
XF86MonBrightnessUp
	brightnessctl s +10%


# Programs
# Uses modifier key SUPER

# Rofi
# start rofi
super + d
	rofi -show combi

# start Networkmanager rofi
super + w
	networkmanager_dmenu

# start rofi-calc
super + c
	rofi -show calc -modi calc -no-show-match -no-sort | xclip -selection clipboard

# start rofi-bluetooth
super + b
    rofi-bluetooth

# start rofi-power-menu
super + p
    rofi -show power-menu -modi power-menu:rofi-power-menu

# Show help
super + h
	sxhkd-help

# script for sharing files
super + s
    share

# switch keyboard layout
super + l
    setxkbmap -query | grep -Eq "layout:\s+de" && setxkbmap us && dunstify "Layout US"|| (setxkbmap de && dunstify "Layout DE")

# Apps
# start firefox
super + {_,shift} + f
	firefox {_,--private-window}

# terminal emulator
super + {_,shift} + Return
	{_,bspc rule -a "kitty" -o state=floating;} kitty


# Emacs
# start emacs
super  + e
	emacsclient -c -a emacs
# emacs everywhere
super + shift + e
	bspc rule -a 'Emacs' -o state=floating sticky=on; \
	emacsclient --eval "(emacs-everywhere)"