-- Filename:	program_launcher.lua
-- Author:		Nina Chloe Kassandra Reiß <nina.reiss@nickr.eu>
-- Copyright:	MIT-License
-- Description:	Program launcher with shortcuts, direct keybinds and categorized program search.

-- Direct binds
local mainMod = "SUPER"

-- Applications
hl.bind(mainMod .. " + Q", hl.dsp.exec_cmd("kitty"))
hl.bind(mainMod .. " + C", hl.dsp.window.close())
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd("nemo"))
hl.bind(mainMod .. " + R", hl.dsp.exec_cmd("wofi --show drun"))
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.exec_cmd("firefox"))
hl.bind(mainMod .. " + SHIFT + P", hl.dsp.exec_cmd("firefox --private-window"))

-- Screenshots
hl.bind(
	mainMod .. " + S",
	hl.dsp.exec_cmd(
		[[hyprshot -m window -m active -z -o ~/Pictures/screenshots -f $(date +"sc_%Y-%m-%d_%H-%M-%s").png]]
	)
)

hl.bind(
	mainMod .. " + SHIFT + S",
	hl.dsp.exec_cmd(
		[[hyprshot --clipboard-only -m window -m active -z -o ~/Pictures/screenshots -f $(date +"sc_%Y-%m-%d_%H-%M-%s").png]]
	)
)

hl.bind(
	mainMod .. " + ALT + S",
	hl.dsp.exec_cmd([[hyprshot -m region -z -o ~/Pictures/screenshots -f $(date +"sc_%Y-%m-%d_%H-%M-%s").png]])
)

hl.bind(
	mainMod .. " + SHIFT + ALT + S",
	hl.dsp.exec_cmd(
		[[hyprshot --clipboard-only -m region -z -o ~/Pictures/screenshots -f $(date +"sc_%Y-%m-%d_%H-%M-%s").png]]
	)
)

-- Window management
hl.bind(mainMod .. " + T", hl.dsp.window.float({ action = "toggle" }))
hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen({ mode = "fullscreen", action = "toggle" }))
hl.bind(mainMod .. " + P", hl.dsp.window.pin())

-- Brightness
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl set 5%+"), { locked = true, repeating = true })
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl set 5%-"), { locked = true, repeating = true })

-- Volume
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("pamixer -d 4"), { locked = true, repeating = true })
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("pamixer -i 4"), { locked = true, repeating = true })
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("pamixer -t"), { locked = true })
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("pamixer --default-source -t"), { locked = true })

hl.bind(mainMod .. " + XF86AudioLowerVolume", hl.dsp.exec_cmd("pamixer --default-source -d 4"))
hl.bind(mainMod .. " + XF86AudioRaiseVolume", hl.dsp.exec_cmd("pamixer --default-source -i 4"))

-- Lock
hl.bind(mainMod .. " + N", hl.dsp.exec_cmd("swaylock -c 000000 -e -i ~/.config/hypr/wallpaper/background.png"))

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

return {}
