--##################
--## KEYBINDINGS ###
--##################

-- See https://wiki.hypr.land/Configuring/Keywords/
-- Generated by hyprlang2lua. Review TODOs before reloading Hyprland.

local mainMod = "SUPER"

-- Example binds, see https://wiki.hypr.land/Configuring/Binds/ for more
-- KeyBinds
-- Open
hl.bind(mainMod .. " + T", hl.dsp.exec_cmd(TERMINAL, {float = true, size = {1920, 1080}})) -- Open Terminal
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(FILEMANAGER)) -- Open File Manager
hl.bind(mainMod .. " + Q", hl.dsp.exec_cmd(BROWSER)) -- Open Browser
hl.bind(mainMod .. " + space", hl.dsp.exec_cmd(MENU)) -- Open Menu

-- Windows
hl.bind(mainMod .. " + C", hl.dsp.window.close()) -- Close Window
hl.bind(mainMod .. " + V", hl.dsp.window.float({ action = "toggle" })) -- Toggle Float
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo()) -- Toggle Pseudo
hl.bind(mainMod .. " + F11", hl.dsp.window.fullscreen("")) -- Toggle Fullscreen
hl.bind(mainMod .. " + SHIFT + F11", hl.dsp.window.float({action = "toggle"})) -- Toggle Fullscreen
hl.bind(mainMod .. " + SHIFT + F11", hl.dsp.window.resize({x = 2560*3, y = 1440})) -- Toggle Fullscreen
hl.bind(mainMod .. " + SHIFT + F11", hl.dsp.window.move({x = 0, y = 0})) -- Toggle Fullscreen
hl.bind(mainMod .. " + H", hl.dsp.layout("togglesplit")) -- Toggle Split

hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = "left" })) -- Focus Left
hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" })) -- Focus Right
hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = "up" })) -- Focus Up
hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = "down" })) -- Focus Down

hl.bind(mainMod .. " + TAB", hl.dsp.window.cycle_next({floating = true, tiled = true, next = true}))
hl.bind("ALT + TAB", hl.dsp.exec_cmd("snappy-switcher next"))
hl.bind("ALT + SHIFT + TAB", hl.dsp.exec_cmd("snappy-switcher prev"))

hl.bind(mainMod .. " + SHIFT + left", hl.dsp.window.move({ workspace = "e+1" })) -- Move Left
hl.bind(mainMod .. " + SHIFT + right", hl.dsp.window.move({ workspace = "e-1" })) -- Move Right
hl.bind(mainMod .. " + SHIFT + up", hl.dsp.window.move({ workspace = 2 })) -- Move Up
hl.bind(mainMod .. " + SHIFT + down", hl.dsp.window.move({ workspace = 4 })) -- Move Down

hl.bind(mainMod .. " + CTRL + left", hl.dsp.window.resize({x = -100, y = 0, relative = true})) -- Resize + horizontal
hl.bind(mainMod .. " + CTRL + right", hl.dsp.window.resize({x = 100, y = 0, relative = true})) -- Resize - horizontal
hl.bind(mainMod .. " + CTRL + up", hl.dsp.window.resize({x = 0, y = 100, relative = true})) -- Resize + vertical
hl.bind(mainMod .. " + CTRL + down", hl.dsp.window.resize({x = 0, y = -100, relative = true})) -- Resize - vertical

hl.bind("ALT + mouse:272", hl.dsp.window.drag()) -- Move with Mouse
hl.bind("ALT + mouse:273", hl.dsp.window.resize()) -- Resize with Mouse

-- Workspaces
hl.bind(mainMod .. " + J", hl.dsp.focus({ workspace = "name:" })) -- Focus left Workspace
hl.bind(mainMod .. " + K", hl.dsp.focus({ workspace = "name:" })) -- Focus bottom Workspace
hl.bind(mainMod .. " + CTRL + K", hl.dsp.focus({ workspace = "name:[]" })) -- Focus [bottom] Workspace
hl.bind(mainMod .. " + L", hl.dsp.focus({ workspace = "name:" })) -- Focus right Workspace
hl.bind(mainMod .. " + I", hl.dsp.focus({ workspace = "name:" })) -- Focus top Workspace
hl.bind(mainMod .. " + 1", hl.dsp.focus({ workspace = 1 })) -- Focus Workspace 1
hl.bind(mainMod .. " + 2", hl.dsp.focus({ workspace = 2 })) -- Focus Workspace 2
hl.bind(mainMod .. " + 3", hl.dsp.focus({ workspace = 3 })) -- Focus Workspace 3
hl.bind(mainMod .. " + 4", hl.dsp.focus({ workspace = 4 })) -- Focus Workspace 4
hl.bind(mainMod .. " + 5", hl.dsp.focus({ workspace = 5 })) -- Focus Workspace 5
hl.bind(mainMod .. " + 6", hl.dsp.focus({ workspace = 6 })) -- Focus Workspace 6
hl.bind(mainMod .. " + 7", hl.dsp.focus({ workspace = 7 })) -- Focus Workspace 7
hl.bind(mainMod .. " + 8", hl.dsp.focus({ workspace = 8 })) -- Focus Workspace 8
hl.bind(mainMod .. " + 9", hl.dsp.focus({ workspace = 9 })) -- Focus Workspace 9
hl.bind(mainMod .. " + 0", hl.dsp.focus({ workspace = 10 })) -- Focus Workspace 10


hl.bind(mainMod .. " + SHIFT + J", hl.dsp.window.move({ workspace = "name:" })) -- Focus left Workspace
hl.bind(mainMod .. " + SHIFT + K", hl.dsp.window.move({ workspace = "name:" })) -- Focus bottom Workspace
hl.bind(mainMod .. " + SHIFT + CTRL + K", hl.dsp.window.move({ workspace = "name:[]" })) -- Focus [bottom] Workspace
hl.bind(mainMod .. " + SHIFT + L", hl.dsp.window.move({ workspace = "name:" })) -- Focus right Workspace
hl.bind(mainMod .. " + SHIFT + I", hl.dsp.window.move({ workspace = "name:" })) -- Focus top Workspace

hl.bind(mainMod .. " + SHIFT + 1", hl.dsp.window.move({ workspace = 1 })) -- Move to Workspace 1
hl.bind(mainMod .. " + SHIFT + 2", hl.dsp.window.move({ workspace = 2 })) -- Move to Workspace 2
hl.bind(mainMod .. " + SHIFT + 3", hl.dsp.window.move({ workspace = 3 })) -- Move to Workspace 3
hl.bind(mainMod .. " + SHIFT + 4", hl.dsp.window.move({ workspace = 4 })) -- Move to Workspace 4
hl.bind(mainMod .. " + SHIFT + 5", hl.dsp.window.move({ workspace = 5 })) -- Move to Workspace 5
hl.bind(mainMod .. " + SHIFT + 6", hl.dsp.window.move({ workspace = 6 })) -- Move to Workspace 6
hl.bind(mainMod .. " + SHIFT + 7", hl.dsp.window.move({ workspace = 7 })) -- Move to Workspace 7
hl.bind(mainMod .. " + SHIFT + 8", hl.dsp.window.move({ workspace = 8 })) -- Move to Workspace 8
hl.bind(mainMod .. " + SHIFT + 9", hl.dsp.window.move({ workspace = 9 })) -- Move to Workspace 9
hl.bind(mainMod .. " + SHIFT + 0", hl.dsp.window.move({ workspace = 10 })) -- Move to Workspace 10

hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic")) -- Focus Magic Workspace
hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" })) -- Move to Magic Workspace

-- Capture
hl.bind(mainMod .. " + F9", hl.dsp.exec_cmd("hyprshot -m region"))
hl.bind(mainMod .. " + SHIFT + F9", hl.dsp.exec_cmd("hyprshot -m window"))
-- Media Keys
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd(SCRIPT_DIR .. "/volume up"), { locked = true, repeating = true }) -- Volume Up
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd(SCRIPT_DIR .. "/volume down"), { locked = true, repeating = true }) -- Volume Down
hl.bind("XF86AudioMute", hl.dsp.exec_cmd(SCRIPT_DIR .. "/volume mute"), { locked = true, repeating = true }) -- Volume Mute
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true, repeating = true }) -- Mic Mute
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"), { locked = true, repeating = true }) -- Increase Brightness
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { locked = true, repeating = true }) -- Decrease Brightness

hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true }) -- Next Song
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) -- Play/Pause
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) -- Play/Pause
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true }) -- Previous Song

-- System
hl.bind(mainMod .. " + F1", hl.dsp.exec_cmd("keybinds")) -- Show Keybinds
hl.bind(mainMod .. " + Escape", hl.dsp.exec_cmd("hyprlock")) -- Lock the System
