-- shutdown hyprland and lock
hl.bind(
	"CTRL + ALT + M",
	hl.dsp.exec_cmd("command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || hyprctl dispatch 'hl.dsp.exit()'")
)
hl.bind("CTRL + ALT + L", hl.dsp.exec_cmd(lockscreen))
-- launchers
hl.bind("ALT + D", hl.dsp.exec_cmd(fileManager))
hl.bind("ALT + D", hl.dsp.exec_cmd(fileManager2))
hl.bind("ALT + Q", hl.dsp.exec_cmd(terminal))
hl.bind("ALT + N", hl.dsp.exec_cmd("kitty -e nvim"))
hl.bind("ALT + F", hl.dsp.exec_cmd(browser))
hl.bind("ALT + Z", hl.dsp.exec_cmd("zotero"))
hl.bind("ALT + T", hl.dsp.exec_cmd("thunderbird"))
-- rofi
hl.bind("ALT + W", hl.dsp.exec_cmd(rofi_launcher))
hl.bind("ALT + X", hl.dsp.exec_cmd(rofi_window))
hl.bind("ALT + C", hl.dsp.exec_cmd(rofi_file))
-- window management
hl.bind("ALT + V", hl.dsp.window.float({ action = "toggle" }))
hl.bind("ALT + F4", hl.dsp.window.close())
-- move focus
hl.bind("ALT + L", hl.dsp.focus({ direction = "right" }))
hl.bind("ALT + H", hl.dsp.focus({ direction = "left" }))
hl.bind("ALT + J", hl.dsp.focus({ direction = "up" }))
hl.bind("ALT + K", hl.dsp.focus({ direction = "down" }))
-- move window
hl.bind("CTRL + SUPER + L", hl.dsp.window.move({ direction = "right" }))
hl.bind("CTRL + SUPER + H", hl.dsp.window.move({ direction = "left" }))
hl.bind("CTRL + SUPER + K", hl.dsp.window.move({ direction = "up" }))
hl.bind("CTRL + SUPER + J", hl.dsp.window.move({ direction = "down" }))
-- move to monitor
hl.bind("ALT +  A", hl.dsp.focus({ monitor = monitorA }))
hl.bind("ALT +  B", hl.dsp.focus({ monitor = monitorB }))
hl.bind("ALT +  B", hl.dsp.focus({ monitor = monitorC }))
hl.bind("CTRL + SUPER + A", hl.dsp.window.move({ monitor = monitorA }))
hl.bind("CTRL + SUPER + B", hl.dsp.window.move({ monitor = monitorB }))
hl.bind("CTRL + SUPER + B", hl.dsp.window.move({ monitor = monitorC }))

-- change workspace
hl.bind("SUPER + L", hl.dsp.focus({ workspace = "r+1" }))
hl.bind("SUPER + H", hl.dsp.focus({ workspace = "r-1" }))
hl.bind("SUPER + K", hl.dsp.window.move({ workspace = "r+1" }))
hl.bind("SUPER + J", hl.dsp.window.move({ workspace = "r-1" }))
-- screenshot
hl.bind(
	"Print",
	hl.dsp.exec_cmd(
		[[mkdir -p ~/Screenshots && filename=~/Screenshots/"$(date +'%F-%T').png" && grim -g "$(slurp)" "$filename" && wl-copy < "$filename" && gwenview "$filename"]]
	)
)
hl.bind("SUPER + V", hl.dsp.exec_cmd("cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy"))

-- mouse resize
hl.bind("ALT + mouse:272", hl.dsp.window.drag(), { mouse = true })
hl.bind("ALT + mouse:273", hl.dsp.window.resize(), { mouse = true })

-- brightness
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"))
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"))
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"))
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"))
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"))
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"))
