---------------------
---- KEYBINDINGS ----
---------------------
-- Version 1
-- Last change: Sun 2026-06-14 using Hyprland v0.55.3-1
-- Git repo: https://git.fennek.xyz/fennek182/dotfiles

-- See https://wiki.hypr.land/Configuring/Basics/Binds/ for more

---- App variables
local terminal = "~/.local/bin/alacritty"
local fileManager = "nautilus"
local browser  = "~/.local/bin/firefox"
local editor_gui = "~/.local/bin/zed"
local editor_cli  = "env -u VIMINIT nvim"
local vpn = "/opt/ivpn/ui/bin/ivpn-ui"
local mediaPlayer = "/opt/ivpn/ui/bin/ivpn-ui"

local mainMod = "SUPER" -- Sets "Windows" key as main modifier

-- Example bind:
-- hl.bind("SUPER + Q", hl.dsp.exec_cmd("kitty"), { description = "Open my favourite terminal" })

-- TODO: Global keybinds for apps
-- hl.bind("ALT" .. " + " .. 0, hl.dsp.pass("^(com\\.obsproject\\.Studio)$"))
-- hl.bind("ALT" .. " + " .. "p", hl.dsp.pass("^(com\\.obsproject\\.Studio)$"))


-- For ALT + TAB between workspaces
hl.config({
    binds = {
        workspace_back_and_forth = true,
        allow_workspace_cycles = true,
    },
})


-- ========== Apps ==========
-- TODO: old - remove on next commit:
-- bind = $mainMod, D, exec, ~/.local/bin/fzf-search-fennix
-- bind = $mainMod SHIFT, D, exec, nautilus --new-window ~/dl
-- bind = $mainMod SHIFT, G, exec, flatpak run com.valvesoftware.Steam
-- bind = $mainMod SHIFT, S, exec, flatpak run io.github.dweymouth.supersonic
-- bind = $mainMod ALT, G, exec, glava
-- bind = $mainMod ALT, J, exec, flatpak run io.github.dweymouth.supersonic
-- bind = $mainMod ALT, J, exec, flatpak run com.logseq.Logseq
-- bind = $mainMod, R, exec, ~/.local/bin/hyprland_rename_ws
-- bind = $mainMod SHIFT, L, exec, mpv --no-audio --loop -fs --osc=no --osd-bar=no --config=no ~/.local/share/screensavers/bad_apple.mkv

hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(terminal))
hl.bind(mainMod .. " + N", hl.dsp.exec_cmd(editor_gui))
hl.bind(mainMod .. " + ALT + N", hl.dsp.exec_cmd(editor_gui .. " /mnt/ssd/dox/todo.txt"))
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager .. " --new-window"))
hl.bind(mainMod .. " + F", hl.dsp.exec_cmd(browser))
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.exec_cmd(browser .. " --private-window"))
hl.bind("CTRL + ALT + N", hl.dsp.exec_cmd(mediaPlayer .. " --player-operation-mode=pseudo-gui"))


-- ========== Scripts ==========
hl.bind(mainMod .. " + ALT + P", hl.dsp.exec_cmd("~/.local/bin/firefox2tv &"))
hl.bind(mainMod .. " + ALT + P", hl.dsp.exec_cmd("~/.local/bin/firefox2mpv --current &"))
hl.bind(mainMod .. " + ALT + P", hl.dsp.exec_cmd("~/.local/bin/firefox2mpv --select &"))


-- ========== Hyprland ==========
-- TODO: old - remove on next commit:
-- bind = SUPER, Tab, hyprexpo:expo, toggle
-- bind = SUPER, dead_circumflex, hyprexpo:expo, toggle
-- bind = SUPER, Escape, hyprexpo:expo, toggle
-- bind = ALT, dead_circumflex, overview:toggle
-- bind = ALT, Escape, overview:toggle
-- bind = $mainMod SHIFT, E, exit

hl.bind(mainMod .. " + SHIFT + R", hl.dsp.exec_cmd("hyprctl reload"))
hl.bind(mainMod .. " + ALT + R", hl.dsp.exec_cmd("pkill waybar; hyprctl dispatch exec waybar"))

--- layouts
hl.bind(mainMod .. " + S", hl.dsp.exec_cmd("hyprctl keyword general:layout dwindle"))
hl.bind(mainMod .. " + A", hl.dsp.exec_cmd("hyprctl keyword general:layout master"))

--- windows
local closeWindowBind = hl.bind(mainMod .. " + Q", hl.dsp.window.close())
-- closeWindowBind:set_enabled(false)
hl.bind(mainMod .. " + SHIFT + Q", hl.dsp.exec_cmd("hyprctl kill"))
hl.bind("ALT + TAB", hl.dsp.focus({ workspace = "previous" }))
hl.bind(mainMod .. " + ALT + I", hl.dsp.exec_cmd("dunstify $(hyprctl activewindow -j | jq -r .title)"))

--- windows > floating
--- TODO: fix toggle_floating script with new syntax
hl.bind(mainMod .. " + Y", hl.dsp.window.float({ action = "toggle" }))
-- hl.bind(mainMod .. " + Y", hl.dsp.exec_cmd("~/.local/bin/toggle_floating"))
hl.bind(mainMod .. " + SHIFT + Y", hl.dsp.exec_cmd("hyprctl dispatch togglefloating active && hyprctl dispatch pin active"))
hl.bind(mainMod .. " + SHIFT + V", hl.dsp.exec_cmd("hyprctl dispatch workspaceopt allfloat"))

--- windows > split (dwindle layout)
hl.bind(mainMod .. " + SHIFT + J", hl.dsp.layout("togglesplit"))        -- dwindle only

--- windows > fullscreen / maximize / fake fullscreen
hl.bind(mainMod .. " + SHIFT + P", hl.dsp.window.pseudo())       -- dwindle only
hl.bind(mainMod .. " + M", hl.dsp.window.fullscreen({ action = "toggle" }))
hl.bind(mainMod .. " + SHIFT + M", hl.dsp.window.fullscreen_state({ internal = 0, client = 2 }))
--     ^-- keeps the window non-fullscreen, but the client goes into fullscreen mode within the window

--- move focus with mainMod + arrow keys
hl.bind(mainMod .. " + left",  hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" }))
hl.bind(mainMod .. " + up",    hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. " + down",  hl.dsp.focus({ direction = "down" }))

--- workspaces
-- switch workspaces with mainMod + [0-9]
-- move active window to a workspace with mainMod + SHIFT + [0-9]:
-- for i = 1, 10 do
--     local key = i % 10 -- 10 maps to key 0
--     hl.bind(mainMod .. " + " .. key,             hl.dsp.focus({ workspace = i}))
--     hl.bind(mainMod .. " + SHIFT + " .. key,     hl.dsp.window.move({ workspace = i }))
-- end

-- switch workspaces with mainMod + [0-9]
hl.bind(mainMod .. " + " .. 1, hl.dsp.focus({ workspace = 5 }))
hl.bind(mainMod .. " + " .. 2, hl.dsp.focus({ workspace = 6 }))
hl.bind(mainMod .. " + " .. 3, hl.dsp.focus({ workspace = 7 }))
hl.bind(mainMod .. " + " .. 4, hl.dsp.focus({ workspace = 8 }))
hl.bind(mainMod .. " + " .. 5, hl.dsp.focus({ workspace = 1 }))
hl.bind(mainMod .. " + " .. 6, hl.dsp.focus({ workspace = 2 }))
hl.bind(mainMod .. " + " .. 7, hl.dsp.focus({ workspace = 3 }))
hl.bind(mainMod .. " + " .. 8, hl.dsp.focus({ workspace = 4 }))
hl.bind(mainMod .. " + " .. 9, hl.dsp.focus({ workspace = 9 }))
hl.bind(mainMod .. " + " .. 0, hl.dsp.focus({ workspace = 10 }))
hl.bind(mainMod .. " + " .. "ssharp", hl.dsp.focus({ workspace = 11 }))
hl.bind(mainMod .. " + " .. "dead_acute", hl.dsp.focus({ workspace = 12 }))

-- switch workspaces with mainMod + pageUp/pageDown
hl.bind(mainMod .. " + " .. "Next", hl.dsp.focus({ workspace = -1 }))
hl.bind(mainMod .. " + " .. "Prior", hl.dsp.focus({ workspace = "+1" }))

-- Move active window to a workspace with mainMod + SHIFT + [0-9]
-- TODO: check syntax of dsp.widnow.move
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 1, hl.dsp.window.move(5))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 2, hl.dsp.window.move(6))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 3, hl.dsp.window.move(7))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 4, hl.dsp.window.move(8))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 5, hl.dsp.window.move(1))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 6, hl.dsp.window.move(2))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 7, hl.dsp.window.move(3))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 8, hl.dsp.window.move(4))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 9, hl.dsp.window.move(9))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 0, hl.dsp.window.move(10))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "ssharp", hl.dsp.window.move(11))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "dead_acute", hl.dsp.window.move(12))

-- Move active window to a workspace with mainMod + SHIFT + pageUp/pageDown
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "Next", hl.dsp.window.move(-1))
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "Prior", hl.dsp.window.move("+1"))

-- Move workspaces between dual screen setup
hl.bind(mainMod .. " + ALT + left", hl.dsp.exec_cmd("hyprctl dispatch movecurrentworkspacetomonitor DP-1"))
hl.bind(mainMod .. " + ALT + right", hl.dsp.exec_cmd("hyprctl dispatch movecurrentworkspacetomonitor DP-4"))

-- Scroll through existing workspaces with mainMod + scroll
hl.bind(mainMod .. " + " .. "mouse_down", hl.dsp.focus({ workspace = "e+1" }))
hl.bind(mainMod .. " + " .. "mouse_up", hl.dsp.focus({ workspace = "e-1" }))

--- TODO: add device specific binds
-- thinkpad:
-- gpd:


-- ========== Rofi ==========
-- TODO: formatting/string cleanup
hl.bind("CTRL + ALT" .. " + " .. "B", hl.dsp.exec_cmd("~/.local/bin/poweroptions_rofi"))
hl.bind(mainMod .. " + " .. "B", hl.dsp.exec_cmd("notify-send CPU-Profil gewechselt Performance && sudo /usr/bin/cpupower frequency-set -g performance"))
hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "B", hl.dsp.exec_cmd("notify-send CPU-Profil gewechselt Powersave && sudo /usr/bin/cpupower frequency-set -g powersave"))
hl.bind(mainMod .. " + " .. "C", hl.dsp.exec_cmd("~/.local/bin/rofi_calc"))
hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "C", hl.dsp.exec_cmd("~/.local/bin/rofi_calc --normal-window"))
hl.bind("CTRL + ALT" .. " + " .. "P", hl.dsp.exec_cmd("hyprctl dispatch exec ~/.config/rofi/bin/menu_powermenu"))
hl.bind(mainMod .. " + " .. "U", hl.dsp.exec_cmd("~/.local/bin/bemoji"))
-- bind = $mainMod, U, exec, rofi -show emoji -modi emoji:/usr/bin/rofimoji --single

hl.bind(mainMod .. " + " .. "space", hl.dsp.exec_cmd("~/.local/bin/rofi_drun"))
hl.bind("SUPER" .. " + " .. "SUPER_L", hl.dsp.exec_cmd("~/.local/bin/rofi_drun"), { repeating = true })
hl.bind("CTRL + ALT" .. " + " .. "minus", hl.dsp.exec_cmd("~/.local/bin/mount_rofi"))
hl.bind("ALT" .. " + " .. "space", hl.dsp.exec_cmd("zsh -c rofi -show run"))

-- ========== System control ==========
-- TODO: formatting/string cleanup
hl.bind("CTRL + ALT" .. " + " .. "A", hl.dsp.exec_cmd("alacritty -e alsamixer"))
hl.bind("CTRL + ALT + SHIFT" .. " + " .. "B", hl.dsp.exec_cmd("sh ~/.local/bin/blue_light_filter"))
hl.bind("CTRL + ALT" .. " + " .. "S", hl.dsp.exec_cmd("pavucontrol"))
hl.bind(mainMod .. " + " .. "V", hl.dsp.exec_cmd("dunstctl history-pop"))
hl.bind("CTRL + ALT" .. " + " .. "V", hl.dsp.exec_cmd("dunstctl history-pop"))
hl.bind("CTRL + ALT + SHIFT" .. " + " .. "V", hl.dsp.exec_cmd("dunstctl set-paused toggle && pkill -RTMIN+2 waybar"))
hl.bind(mainMod .. " + " .. "CTRL + ALT" .. " + " .. "V", hl.dsp.exec_cmd("dunstctl close && pkill -RTMIN+2 waybar"))
hl.bind(mainMod .. " + " .. "ALT" .. " + " .. "V", hl.dsp.exec_cmd("dunstctl close && pkill -RTMIN+2 waybar"))
hl.bind("CTRL + ALT + SHIFT" .. " + " .. "W", hl.dsp.exec_cmd("python ~/.local/src/setbg-gui/azote/azote/v10_abhier.py"))
hl.bind("CTRL + SHIFT" .. " + " .. "W", hl.dsp.exec_cmd("python ~/.local/src/setbg-gui/azote/azote/v10_abhier.py"))
hl.bind("CTRL + ALT" .. " + " .. "W", hl.dsp.exec_cmd("sh ~/.local/bin/setbg --random"))
hl.bind("CTRL + SHIFT" .. " + " .. "Escape", hl.dsp.exec_cmd("~/.local/bin/alacritty --class floating -e btop"))
-- bind = CTRL ALT, O, exec, switch_output


-- ========== Volume control ==========
-- TODO: formatting/string cleanup
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("pactl set-sink-volume @DEFAULT_SINK@ -1%"))
hl.bind("CTRL + ALT" .. " + " .. "numbersign", hl.dsp.exec_cmd("pactl set-sink-volume @DEFAULT_SINK@ -1%"))
hl.bind("CTRL + SHIFT" .. " + " .. "numbersign", hl.dsp.exec_cmd("pactl set-sink-volume @DEFAULT_SINK@ -3%"))

hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("pactl set-sink-volume @DEFAULT_SINK@ +1%"))
hl.bind("CTRL + ALT" .. " + " .. "plus", hl.dsp.exec_cmd("pactl set-sink-volume @DEFAULT_SINK@ +1%"))
hl.bind("CTRL + SHIFT" .. " + " .. "plus", hl.dsp.exec_cmd("pactl set-sink-volume @DEFAULT_SINK@ +3%"))

hl.bind("XF86AudioMute", hl.dsp.exec_cmd("pactl set-sink-mute @DEFAULT_SINK@ toggle"))
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("pactl set-source-mute @DEFAULT_SOURCE@ toggle"))
hl.bind("CTRL + ALT" .. " + " .. "M", hl.dsp.exec_cmd("pactl set-sink-mute @DEFAULT_SINK@ toggle"))
hl.bind("CTRL + ALT + SHIFT" .. " + " .. "M", hl.dsp.exec_cmd("pactl set-source-mute @DEFAULT_SOURCE@ toggle"))


-- ========== Media control ==========
-- TODO: formatting/string cleanup
hl.bind(mainMod .. " + " .. "ALT" .. " + " .. "comma", hl.dsp.exec_cmd("playerctl previous"))
hl.bind(mainMod .. " + " .. "ALT" .. " + " .. "left", hl.dsp.exec_cmd("playerctl previous"))
hl.bind(mainMod .. " + " .. "F7", hl.dsp.exec_cmd("playerctl previous"))

hl.bind(mainMod .. " + " .. "ALT" .. " + " .. "minus", hl.dsp.exec_cmd("playerctl pause"))
-- bind = $mainMod ALT, up, exec, playerctl pause
-- bind = $mainMod ALT, down, exec, playerctl pause
hl.bind(mainMod .. " + " .. "F8", hl.dsp.exec_cmd("playerctl pause"))

hl.bind(mainMod .. " + " .. "ALT" .. " + " .. "period", hl.dsp.exec_cmd("playerctl next"))
-- bind = $mainMod ALT, right, exec, playerctl next
hl.bind(mainMod .. " + " .. "F9", hl.dsp.exec_cmd("playerctl next"))

-- ========== Brightness control ==========
-- TODO: formatting/string cleanup
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl set 3%-"))
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl set 3%+"))
hl.bind(mainMod .. " + " .. "XF86AudioLowerVolume", hl.dsp.exec_cmd("~/.local/bin/monitor --dimmer"))
hl.bind(mainMod .. " + " .. "XF86AudioRaiseVolume", hl.dsp.exec_cmd("~/.local/bin/monitor --brighter"))
hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "XF86AudioLowerVolume", hl.dsp.exec_cmd("~/.local/bin/monitor --one_dimmer"))
hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "XF86AudioRaiseVolume", hl.dsp.exec_cmd("~/.local/bin/monitor --one_brighter"))
hl.bind("CTRL + ALT" .. " + " .. "Prior", hl.dsp.exec_cmd("~/.local/bin/monitor --brighter"))
hl.bind("CTRL + ALT + SHIFT" .. " + " .. "Prior", hl.dsp.exec_cmd("~/.local/bin/monitor --one_brighter"))
hl.bind("CTRL + ALT" .. " + " .. "Next", hl.dsp.exec_cmd("~/.local/bin/monitor --dimmer"))
hl.bind("CTRL + ALT + SHIFT" .. " + " .. "Next", hl.dsp.exec_cmd("~/.local/bin/monitor --one_dimmer"))

-- ========== Screenshots ==========
-- TODO: formatting/string cleanup
-- ---- full ----
hl.bind("Print", hl.dsp.exec_cmd("~/.local/bin/screenshot --full"))

-- screenshot of all monitors
hl.bind("CTRL" .. " + " .. "Print", hl.dsp.exec_cmd("~/.local/bin/screenshot --full_clipboard"))

-- ---- Window ----
hl.bind("ALT" .. " + " .. "Print", hl.dsp.exec_cmd("~/.local/bin/screenshot --window"))
hl.bind("ALT" .. " + " .. "ssharp", hl.dsp.exec_cmd("~/.local/bin/screenshot --window"))
hl.bind("CTRL + ALT" .. " + " .. "Print", hl.dsp.exec_cmd("~/.local/bin/screenshot --window_clipboard"))
hl.bind("CTRL + ALT" .. " + " .. "ssharp", hl.dsp.exec_cmd("~/.local/bin/screenshot --window_clipboard"))

-- ---- Selection ----
hl.bind("SHIFT" .. " + " .. "Print", hl.dsp.exec_cmd("~/.local/bin/screenshot --selection"))
hl.bind("SHIFT" .. " + " .. "Print", hl.dsp.exec_cmd("~/.local/bin/screenshot --selection"))
hl.bind("CTRL + SHIFT" .. " + " .. "Print", hl.dsp.exec_cmd("~/.local/bin/screenshot --selection_clipboard"))
hl.bind("CTRL + SHIFT" .. " + " .. "ssharp", hl.dsp.exec_cmd("~/.local/bin/screenshot --selection_clipboard"))

-- ---- Monitor ----
hl.bind(mainMod .. " + " .. "print", hl.dsp.exec_cmd("~/.local/bin/screenshot --monitor"))
hl.bind(mainMod .. " + " .. "CTRL" .. " + " .. "print", hl.dsp.exec_cmd("~/.local/bin/screenshot --monitor_clipboard"))

-- ---- Open file / folder ----
hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "Print", hl.dsp.exec_cmd("nautilus --new-window ~/pix/screenshots/nightfury/"))
hl.bind(mainMod .. " + " .. "CTRL + SHIFT" .. " + " .. "Print", hl.dsp.exec_cmd("imv-dir ~/pix/screenshots/nightfury/$(ls -Art ~/pix/screenshots| tail -n 1)"))

-- TODO:
-- dunstify actions to open file in imv or nautlus
-- SUPER + SHIFT + print                 open image in imv (or standard image viewer) - if already image in clipboard, save to tmp and open
-- super + ALT+ print                    open latest file in gimp, if already in clipboard, then open that
-- dismissed idea - copy latest file to clipboard, ignore if theres already a picture in the clipboard
-- use copy montor to clipboard instead - (just copy/paste or open folder)
-- CTRL + SUPER + PRINT  copy latest screenshot to clipboard


-- ========== window management ==========
-- TODO: formatting/string cleanup
-- Move focus with mainMod + j i k l
hl.bind(mainMod .. " + " .. "j", hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod .. " + " .. "k", hl.dsp.focus({ direction = "down" }))
hl.bind(mainMod .. " + " .. "i", hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. " + " .. "l", hl.dsp.focus({ direction = "right" }))

-- Move focus with mainMod + vim keys
-- bind = $mainMod, h, movefocus, l
-- bind = $mainMod, j, movefocus, d
-- bind = $mainMod, k, movefocus, u
-- bind = $mainMod, l, movefocus, r

-- Move focus with mainMod + arrow keys
hl.bind(mainMod .. " + " .. "left", hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod .. " + " .. "right", hl.dsp.focus({ direction = "right" }))
hl.bind(mainMod .. " + " .. "up", hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. " + " .. "down", hl.dsp.focus({ direction = "down" }))

-- Toggle split direction
hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "minus", hl.dsp.layout("togglesplit"))
hl.bind(mainMod .. " + " .. "minus", hl.dsp.layout("togglesplit"))
hl.bind(mainMod .. " + " .. "x", hl.dsp.layout("togglesplit"))

-- Resize windows, standard was 50 without animations
-- TODO: manual review (unknown dispatcher: resizeactive)
-- hl.bind("$mainMod + CTRL + left", hl.dsp.resizeactive("-70 0"))

-- TODO: manual review (unknown dispatcher: resizeactive)
-- hl.bind("$mainMod + CTRL + right", hl.dsp.resizeactive("70 0"))

-- TODO: manual review (unknown dispatcher: resizeactive)
-- hl.bind("$mainMod + CTRL + up", hl.dsp.resizeactive("0 -70"))

-- TODO: manual review (unknown dispatcher: resizeactive)
-- hl.bind("$mainMod + CTRL + down", hl.dsp.resizeactive("0 70"))

-- Move windows
-- TODO: check syntax of dispatcher
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "left", { direction = "l" })
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "right", { direction = "r" })
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "up", { direction = "u" })
-- hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "down", { direction = "d" })

-- Move/resize windows with mainMod + LMB/RMB and dragging
hl.bind(mainMod .. " + " .. "mouse:272", hl.dsp.window.drag(), { mouse = true })
hl.bind(mainMod .. " + " .. "mouse:273", hl.dsp.window.resize(), { mouse = true })
hl.bind("SUPER" .. " + " .. "g", hl.dsp.group.toggle())
hl.bind("SUPER" .. " + " .. "tab", hl.dsp.group.next({ forward = false }))


-- TODO: check example config
-- -- Example special workspace (scratchpad)
-- hl.bind(mainMod .. " + S",         hl.dsp.workspace.toggle_special("magic"))
-- hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" }))

-- -- Scroll through existing workspaces with mainMod + scroll
-- hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
-- hl.bind(mainMod .. " + mouse_up",   hl.dsp.focus({ workspace = "e-1" }))

-- -- Move/resize windows with mainMod + LMB/RMB and dragging
-- hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(),   { mouse = true })
-- hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })

-- -- Laptop multimedia keys for volume and LCD brightness
-- hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true, repeating = true })
-- hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"),      { locked = true, repeating = true })
-- hl.bind("XF86AudioMute",        hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"),     { locked = true, repeating = true })
-- hl.bind("XF86AudioMicMute",     hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"),   { locked = true, repeating = true })
-- hl.bind("XF86MonBrightnessUp",  hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"),                  { locked = true, repeating = true })
-- hl.bind("XF86MonBrightnessDown",hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"),                  { locked = true, repeating = true })

-- -- Requires playerctl
-- hl.bind("XF86AudioNext",  hl.dsp.exec_cmd("playerctl next"),       { locked = true })
-- hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
-- hl.bind("XF86AudioPlay",  hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
-- hl.bind("XF86AudioPrev",  hl.dsp.exec_cmd("playerctl previous"),   { locked = true })


-- TODO (from Hyprland dev Vaxry):
--  open a (small) flatpak app on a hidden workspace at startup and then close it,
--  so the flatpak stuff is preloaded and app startup is faster
--  bind = $mainMod SHIFT, Return, exec, [workspace 2 silent;float;noanim] alacritty
