Files
dotfiles/dot_config/hypr/hyprland.d.lua/keybinds.lua.tmpl
T
mpuchstein d53bc5dadb hypr: migrate to Lua config (v0.55) with custom scroll layouts
Replace hyprlang hyprland.d/ with Lua-based hyprland.d.lua/ modules:
- theme.lua.tmpl: apex-neon + apex-aeon color tables, col.* bracket keys
- general.lua: config, bezier curves, animations (bezier=/spring= fixed)
- monitors.lua.tmpl, workspaces.lua.tmpl, input.lua.tmpl, rules.lua.tmpl
- keybinds.lua.tmpl: +/SHIFT/CTRL format, monitor focus (Super+I/O),
  scroll binds for custom layouts
- layout.lua: master-scroll, slave-master-scroll, center-master-scroll
  (peek-hint scrolling slave columns, focus-triggered auto-scroll)

Entry point uses package.path + require() for per-file error isolation.
Old hyprlang configs preserved under hyprland.conf.bak/.
Add .luarc.json for hyprland stub autocompletion in editors.
2026-05-12 01:00:42 +02:00

157 lines
7.2 KiB
Cheetah

local mainMod = "SUPER"
-- Apps
local terminal = "uwsm app -- kitty"
local term_tmux = "uwsm app -- kitty -e tmux"
local term_tmux_append = "uwsm app -- kitty -e tmux a"
local editor = "uwsm app -- kitty -e nvim"
local alteditor = "uwsm app -- zeditor"
local filemanager = "uwsm app -- nautilus"
local launcher = "uwsm app -- owlry -p app,cmd,system,ssh"
local clipman = "uwsm app -- owlry -m clipboard"
local browser = "uwsm app -- firefox"
local taskman = "uwsm app -- owlry -m uuctl"
local pwdmgr = "uwsm app -- bitwarden-desktop"
local soundctl = "uwsm app -- pwvucontrol"
local notcenter = "uwsm app -- swaync-client -t -sw"
local notdnd = "uwsm app -- swaync-client -d"
local nothide = "uwsm app -- swaync-client --hide-latest"
-- First-class launchers
hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(terminal))
hl.bind(mainMod .. " + SHIFT + Return", hl.dsp.exec_cmd(term_tmux))
hl.bind(mainMod .. " + CTRL + Return", hl.dsp.exec_cmd(term_tmux_append))
hl.bind(mainMod .. " + F1", hl.dsp.exec_cmd("hypr-show-binds"))
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(filemanager))
hl.bind(mainMod .. " + W", hl.dsp.exec_cmd(browser))
hl.bind(mainMod .. " + Space", hl.dsp.exec_cmd(launcher))
-- Secondary launchers
hl.bind(mainMod .. " + SHIFT + E", hl.dsp.exec_cmd(editor))
hl.bind(mainMod .. " + CTRL + E", hl.dsp.exec_cmd(alteditor))
hl.bind(mainMod .. " + X", hl.dsp.exec_cmd(taskman))
hl.bind(mainMod .. " + C", hl.dsp.exec_cmd(clipman))
hl.bind(mainMod .. " + F4", hl.dsp.exec_cmd(soundctl))
-- Quick Workspaces submap
hl.bind(mainMod .. " + A", hl.dsp.submap("quickws"))
hl.define_submap("quickws", function()
hl.bind("z", function() hl.dispatch(hl.dsp.focus({ workspace = 1 })); hl.dispatch(hl.dsp.submap("reset")) end)
hl.bind("d", function() hl.dispatch(hl.dsp.focus({ workspace = 2 })); hl.dispatch(hl.dsp.submap("reset")) end)
hl.bind("a", function() hl.dispatch(hl.dsp.focus({ workspace = 3 })); hl.dispatch(hl.dsp.submap("reset")) end)
hl.bind("x", function() hl.dispatch(hl.dsp.focus({ workspace = 4 })); hl.dispatch(hl.dsp.submap("reset")) end)
hl.bind("s", function() hl.dispatch(hl.dsp.focus({ workspace = 5 })); hl.dispatch(hl.dsp.submap("reset")) end)
hl.bind("c", function() hl.dispatch(hl.dsp.focus({ workspace = 6 })); hl.dispatch(hl.dsp.submap("reset")) end)
hl.bind("Escape", hl.dsp.submap("reset"))
hl.bind("Return", hl.dsp.submap("reset"))
end)
-- Notifications
hl.bind(mainMod .. " + grave", hl.dsp.exec_cmd(notcenter))
hl.bind(mainMod .. " + SHIFT + grave", hl.dsp.exec_cmd(notdnd))
hl.bind(mainMod .. " + CTRL + grave", hl.dsp.exec_cmd(nothide))
-- Session
hl.bind(mainMod .. " + Pause", hl.dsp.exec_cmd("hyprlock"))
hl.bind(mainMod .. " + SHIFT + Pause", hl.dsp.exec_cmd("owlry-power-menu"))
hl.bind(mainMod .. " + End", hl.dsp.exec_cmd("hyprlock"))
hl.bind(mainMod .. " + SHIFT + End", hl.dsp.exec_cmd("owlry-power-menu"))
-- Window management
hl.bind(mainMod .. " + Q", hl.dsp.window.kill())
hl.bind(mainMod .. " + SHIFT + Q", hl.dsp.window.kill())
hl.bind(mainMod .. " + F", hl.dsp.window.float())
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.window.fullscreen({ action = "toggle" }))
hl.bind(mainMod .. " + P", hl.dsp.window.pin())
hl.bind(mainMod .. " + U", hl.dsp.focus({ urgent_or_last = true }))
hl.bind(mainMod .. " + V", hl.dsp.window.center())
-- Special workspaces
hl.bind(mainMod .. " + SHIFT + Space", hl.dsp.workspace.toggle_special())
hl.bind(mainMod .. " + CTRL + Space", hl.dsp.window.move({ workspace = "special" }))
hl.bind(mainMod .. " + N", hl.dsp.workspace.toggle_special("passwordmgr"))
-- Monitor focus
hl.bind(mainMod .. " + I", hl.dsp.focus({ monitor = "l" }))
hl.bind(mainMod .. " + O", hl.dsp.focus({ monitor = "r" }))
hl.bind(mainMod .. " + SHIFT + I", hl.dsp.workspace.move({ monitor = "l" }))
hl.bind(mainMod .. " + SHIFT + O", hl.dsp.workspace.move({ monitor = "r" }))
-- Layout
hl.bind(mainMod .. " + comma", hl.dsp.exec_cmd("hypr-workspace-layout toggle-ms"))
hl.bind(mainMod .. " + period", hl.dsp.exec_cmd("hypr-workspace-layout cycle"))
-- Smart Gaps Toggle
hl.bind(mainMod .. " + SHIFT + G", function()
local gapsIn = hl.get_config("general.gaps_in")
local current = type(gapsIn) == "table" and (gapsIn.top or 0) or (gapsIn or 0)
if current ~= 0 then
hl.config({ general = { gaps_in = 0, gaps_out = 0 } })
hl.notification.create({ text = "Gaps: OFF", timeout = 2000, icon = "info" })
else
hl.config({ general = { gaps_in = 5, gaps_out = 5 } })
hl.notification.create({ text = "Gaps: ON", timeout = 2000, icon = "ok" })
end
end)
-- Global Focus Notification (Lua Event)
hl.on("window.active", function(w)
if w ~= nil and w.title ~= nil then
print("Focused: " .. w.title)
end
end)
-- Vim-like navigation
hl.bind(mainMod .. " + H", hl.dsp.focus({ direction = "l" }))
hl.bind(mainMod .. " + L", hl.dsp.focus({ direction = "r" }))
hl.bind(mainMod .. " + K", hl.dsp.focus({ direction = "u" }))
hl.bind(mainMod .. " + J", hl.dsp.focus({ direction = "d" }))
-- Move window
hl.bind(mainMod .. " + SHIFT + H", hl.dsp.exec_cmd("hypr-workspace-layout move-left"))
hl.bind(mainMod .. " + SHIFT + L", hl.dsp.exec_cmd("hypr-workspace-layout move-right"))
hl.bind(mainMod .. " + SHIFT + K", hl.dsp.exec_cmd("hypr-workspace-layout move-up"))
hl.bind(mainMod .. " + SHIFT + J", hl.dsp.exec_cmd("hypr-workspace-layout move-down"))
-- Resize submap
hl.bind(mainMod .. " + R", hl.dsp.submap("resize"))
hl.define_submap("resize", function()
hl.bind("h", hl.dsp.window.resize({ x = -25, y = 0, relative = true }), { repeating = true })
hl.bind("l", hl.dsp.window.resize({ x = 25, y = 0, relative = true }), { repeating = true })
hl.bind("k", hl.dsp.window.resize({ x = 0, y = -25, relative = true }), { repeating = true })
hl.bind("j", hl.dsp.window.resize({ x = 0, y = 25, relative = true }), { repeating = true })
hl.bind("Escape", hl.dsp.submap("reset"))
end)
-- Workspace cycling
hl.bind(mainMod .. " + Tab", hl.dsp.focus({ workspace = "m+1" }))
hl.bind(mainMod .. " + SHIFT + Tab", hl.dsp.focus({ workspace = "m-1" }))
-- Switch Workspaces 1-10 (IDs 21-30 in setup)
for i = 1, 9 do
hl.bind(mainMod .. " + " .. i, hl.dsp.focus({ workspace = 20 + i }))
hl.bind(mainMod .. " + SHIFT + " .. i, hl.dsp.window.move({ workspace = 20 + i }))
end
hl.bind(mainMod .. " + 0", hl.dsp.focus({ workspace = 30 }))
hl.bind(mainMod .. " + SHIFT + 0", hl.dsp.window.move({ workspace = 30 }))
-- Groups
hl.bind(mainMod .. " + Z", hl.dsp.group.next())
hl.bind(mainMod .. " + SHIFT + Z", hl.dsp.group.prev())
-- Mouse binds
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
-- master-scroll slave scrolling (mouse wheel + bracket fallback)
hl.bind(mainMod .. " + mouse_down", hl.dsp.layout("scrollup"), { mouse = true })
hl.bind(mainMod .. " + mouse_up", hl.dsp.layout("scrolldown"), { mouse = true })
hl.bind(mainMod .. " + bracketright", hl.dsp.layout("scrolldown"))
hl.bind(mainMod .. " + bracketleft", hl.dsp.layout("scrollup"))
-- Multimedia
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"), { repeating = true })
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { repeating = true })
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true })