#           _     _       _
#          | |   | |     | |
#  _____  _| |__ | | ____| |
# / __\ \/ / '_ \| |/ / _` |
# \__ \>  <| | | |   < (_| |
# |___/_/\_\_| |_|_|\_\__,_|
#
#

# Commands are procedurally added to the manual.

# To do so, for every command, add a line starting
# with `##` which has a generic description of what
# the command does.

# The pdf will associate it with the binding BELOW IT.

# `#` followed by a space will be ignored and treated
# as regular comments.

# `#-#` at the beggining of a line will be converted to
# a header in the manual.

#-# dwm #-#
## Quit dwm
super + shift + q
	dwmc quit
## Quit Current/focused App
super + q
  quitapp
## Toggle the dwm bar
super + shift + b
	dwmc togglebar
## Change layout to {tiling, bstackhoriz}
super + {_,shift} + t
	dwmc setlayoutex {0,2}
## Change layout to {nolayout, monocle}
super + {_,shift} + g
	dwmc setlayoutex {5,1}
## Change layout to {centeredmaster, tilewide}
super + {_,shift} + m
	dwmc setlayoutex {3,4}
## Make window fullscreen
super + f
	dwmc fullscreen
## Make current window floating
super + shift + space
	dwmc togglefloating
## Cycle up and down the window stack (change focus)
super + {j,k}
	dwmc focusstack {+,-}1
## Rotate clockwise/counterclockwise the window stack
super + shift + {j,k}
	dwmc rotatestack {+,-}1
## Move current window up/down the stack
super + shift + {h,l}
	dwmc movestack {-,+}1
## Change focus to/swap the master window
super + {_, shift} + s
	dwmc {focusmaster,  zoom}
## Add/Remove windows from the master stack
super + {_,shift} + i
	dwmc incnmaster {+,-}1
## Increase/Decrease master stack width
super + {h,l}
	dwmc setmfact {-,+}0.05
## Toggle view next tag
super + Tab
	dwmc view
## Cycle forward/backward through monitor focus
super + {comma,period}
	dwmc focusmon {-,+}1
## Move current window to previous/next monitor
super + shift + {comma,period}
	dwmc tagmon {-,+}1
## Set the master monitor to be the previous/next monitor
super + alt + {comma,period}
	dwmc setmastermon {-,+}1
## View all tags
super + 0
	dwmc viewall
## Move current window to tag {1-9}
super + shift + {1-9}
	dwmc tagex {0-8}
## Only view the tag {1-9}
super + {1-9}
	dwmc viewex {0-8}
## Toggle the visibility tag {1-9}
super + alt + {1-9}
	dwmc toggleviewex {0-8}
## Toggle (pin/unpin) the current window on tag {1-9}
alt + {1-9}
	dwmc toggletagex {0-8}
## Pin current window to all tags
super + shift + 0
	dwmc tagall
## Make bigger/minimize window weight
super + {bracketleft,bracketright}
	dwmc setcfact {-0.05,+0.05}
## Nullify window weight
super + n
  dwmc setcfact 0
# ## Decrease/increase gaps
super + {minus, shift + equal}
	dwmc incrgaps {-,+}1
# ## Set gaps to zero
super + equal
	dwmc defaultgaps

#-#   Miscellaneous #-#
## Lock Screen
super + BackSpace
    slock
## Quit Current App
super + q
	kill -15 `xdotool getwindowfocus getwindowpid`
## Change Keyboard Layout
alt + Return
	layouttoggle
## Toggle Compositor
super + c
		killall picom || setsid picom
## Open this manual
super + alt + shift + h
    manualgen
## Start colorpicker (Jack12816/colorpicker)
super + shift + c
		colorhandler

#-# Standard Applications #-#
## Terminal window
super + Return
    $TERMINAL
## Default Browser
super + w
    $BROWSER
## Quickly Search DuckDuckGo
super + shift + w
    ducksearch
## TUI Email Client (neomutt)
super + e
    kill -46 $(pidof dwmblocks) && killall neomutt || $TERMINAL -e neomutt && kill -46 $(pidof dwmblocks)

#-#   Floating Apps/Utilities   #-#
## Network Manager
XF86WLAN
    killall nmtui || dropdowntoggle network nmtui
## TUI Audio Mixer (pulsemixer)
super + shift + p
    killall pulsemixer || dropdowntoggle audio pulsemixer
## Display selector (connect to projector/secondary monitor)
super + p
    displayselect
## TODOs (orgmode-nvim)
super + space
    dropdowntoggle orgmode nvim +"Neorg index"
## Terminal Calculator
super + a
    dropdowntoggle calc tmux-py
## Terminal Shell
super + shift + a
    dropdowntoggle shell tmux-shell
## Terminal remote session (ssh)
super + r
    sshchoose

#-#   Prompts (dmenu)   #-#
## Application Launcher
super + d
    j4-dmenu-desktop
## Emoji & Font-Awesome Selector
alt + grave
    emoji-copy
## Mount/Unmount Devices Utility
alt + {_,shift} + m
    { mountmenu, umountmenu }
## Recording Utility
alt + r
    recordmenu kill || recordmenu
## Start SSH session
alt + s
		pickssh
## Select bright or dark .Xresources theme
alt + Escape
	theme="$(ls $HOME/.config/Xresources/ | dmenu)" && cat "$HOME/.config/Xresources/$theme" | xrdb -load

#-#   PrintScreen Utilities   #-#
## All displays
Print
    scrot && notify-send -a " Screenshot" "Stitched screenshot completed"
## Current window
alt + Print
    scrot -q 100 -u -z && notify-send -i "$HOME/.fonts/svg/image.svg" -a " Screenshot" "Window screenshot completed"
## Cursor Selection
super +  Print
    scrot -q 100 -s -z && notify-send -i "$HOME/.fonts/svg/image.svg" -a " Screenshot" "Selection screenshot completed"

#-#   Special Keys   #-#
## Control Network Manager
XF86AudioMedia
    killall nmtui || dropdowntoggle network nmtui
## Control Bluetooth
shift + XF86AudioMedia
    killall bluetuith || dropdowntoggle bluetooth bluetuith
## Increase/decrease Volume
{XF86AudioRaiseVolume, XF86AudioLowerVolume}
    volumectl 5 {+,-}
## Max-Out Volume
shift + XF86AudioRaiseVolume
    volumectl 100
## Set Volume to 5 percent
shift + XF86AudioLowerVolume
    volumectl 5
## Mute Audio
XF86AudioMute
	 volumectl mute
## Increase/decrease Brightness
{XF86MonBrightnessUp, XF86MonBrightnessDown}
    backlightctl -{i,d} 5
## Max-Out Brightness
shift + XF86MonBrightnessUp
    backlightctl -s 100
## Set Brightness to 5 percent
shift + XF86MonBrightnessDown
    backlightctl -s 0
## Fix games with MX Master mouse
ctrl + alt + Tab
  dwmc focusmon +1 && sleep 0.1 && dwmc focusmon +1

#-# Music Controls (using `playerctl`) #-#
## Next/Previous Song (using playerctl)
super + {bracketright, bracketleft}
		playerctl {next, previous}
## Toggle music playback
super + backslash
		playerctl play-pause