249 lines
9.9 KiB
Lua
249 lines
9.9 KiB
Lua
local var = require("modules.variables")
|
|
local command = require("modules.shell_commands")
|
|
local env = require("env")
|
|
-- bind/exec wrap hl.bind so each keybind also records a runnable command for
|
|
-- the show-keybinds picker (see modules/keybind_registry.lua).
|
|
local reg = require("modules.keybind_registry")
|
|
local bind = reg.bind
|
|
local exec = reg.exec
|
|
-- See https://wiki.hypr.land/Configuring/Keywords/
|
|
|
|
-- Example binds, see https://wiki.hypr.land/Configuring/Binds/ for more
|
|
bind(var.mainMod .. " + RETURN", exec(var.terminal), { description = "Open terminal" })
|
|
bind(var.mainMod .. " + ALT + RETURN", exec(var.terminal_tmux), { description = "Open tmux in terminal" })
|
|
bind(var.mainMod .. " + Q", hl.dsp.window.close(), { description = "Close focused window" })
|
|
bind(
|
|
var.mainMod .. " + ESCAPE",
|
|
exec(command.session),
|
|
{ description = "Session menu (logout/reboot/shutdown)" }
|
|
)
|
|
bind(var.mainMod .. " + SHIFT + ESCAPE", exec(command.logout), { description = "Session: logout" })
|
|
bind(var.mainMod .. " + CTRL + ESCAPE", exec(command.shutdown), { description = "Session: power off" })
|
|
bind(var.mainMod .. " + ALT + ESCAPE", exec(command.reboot), { description = "Session: reboot" })
|
|
bind(var.mainMod .. " + E", exec(var.fileManager), { description = "Open file manager" })
|
|
bind(var.mainMod .. " + V", hl.dsp.window.float({ action = "toggle" }), { description = "Floating window toggle" })
|
|
bind(var.mainMod .. " + SPACE", exec(command.menu), { description = "Open app launcher" })
|
|
bind(var.mainMod .. " + P", hl.dsp.window.pseudo(), { description = "Pseudo-tiling toggle" })
|
|
bind(var.mainMod .. " + SHIFT + J", hl.dsp.layout("togglesplit"), { description = "Split layout toggle" })
|
|
bind(var.mainMod .. " + I", exec(var.internet_explorer), { description = "Open internet explorer" })
|
|
bind(var.mainMod .. " + n", exec("nm-connection-editor"), { description = "Open network manager" })
|
|
bind(var.mainMod .. " + comma", exec(command.settings), { description = "Open settings" })
|
|
bind(var.mainMod .. " + S", exec(command.control_center), { description = "Open start menu" })
|
|
bind(var.mainMod .. " + ALT + H", exec("hyprmod"), {description = "Open hyprmod (hyprland config GUI)"})
|
|
bind(var.mainMod .. " + period", exec(command.emoji), { description = "Open emoji picker" })
|
|
bind(var.mainMod .. " + ALT + S", exec(var.systemmonitor), {description = "Open systemmonitor"})
|
|
|
|
bind(var.mainMod .. " + TAB", function()
|
|
hl.plugin.hyprtasking.toggle("cursor")
|
|
end, { description = "Workspace: overview" })
|
|
|
|
-- Move focus with mainMod or Vim-style
|
|
bind(var.mainMod .. " + CTRL + h", hl.dsp.focus({ direction = "left" }), { description = "Window: focus left" })
|
|
bind(var.mainMod .. " + CTRL + l", hl.dsp.focus({ direction = "right" }), { description = "Window: focus right" })
|
|
bind(var.mainMod .. " + CTRL + k", hl.dsp.focus({ direction = "up" }), { description = "Window: focus up" })
|
|
bind(var.mainMod .. " + CTRL + j", hl.dsp.focus({ direction = "down" }), { description = "Window: focus down" })
|
|
|
|
-- Move windows with mainMod or Vim-style
|
|
bind(var.mainMod .. " + SHIFT + h", hl.dsp.window.move({ direction = "left" }), { description = "Window: move left" })
|
|
bind(
|
|
var.mainMod .. " + SHIFT + l",
|
|
hl.dsp.window.move({ direction = "right" }),
|
|
{ description = "Window: move right" }
|
|
)
|
|
bind(var.mainMod .. " + SHIFT + k", hl.dsp.window.move({ direction = "up" }), { description = "Window: move up" })
|
|
bind(var.mainMod .. " + SHIFT + j", hl.dsp.window.move({ direction = "down" }), { description = "Window: move down" })
|
|
|
|
-- Resize focused window with mainMod + Arrows
|
|
bind(
|
|
var.mainMod .. " + left",
|
|
hl.dsp.window.resize({ x = -10, y = 0, relative = true }),
|
|
{ description = "Window: resize left" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + right",
|
|
hl.dsp.window.resize({ x = 10, y = 0, relative = true }),
|
|
{ description = "Window: resize right" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + up",
|
|
hl.dsp.window.resize({ x = 0, y = -10, relative = true }),
|
|
{ description = "Window: resize up" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + down",
|
|
hl.dsp.window.resize({ x = 0, y = 10, relative = true }),
|
|
{ description = "Window: resize down" }
|
|
)
|
|
|
|
-- Switch workspaces with mainMod + [0-9]
|
|
bind(var.mainMod .. " + 1", hl.dsp.focus({ workspace = 1 }), { description = "Workspace: switch to 1" })
|
|
bind(var.mainMod .. " + 2", hl.dsp.focus({ workspace = 2 }), { description = "Workspace: Switch to 2" })
|
|
bind(var.mainMod .. " + 3", hl.dsp.focus({ workspace = 3 }), { description = "Workspace: Switch to 3" })
|
|
bind(var.mainMod .. " + 4", hl.dsp.focus({ workspace = 4 }), { description = "Workspace: Switch to 4" })
|
|
bind(var.mainMod .. " + 5", hl.dsp.focus({ workspace = 5 }), { description = "Workspace: Switch to 5" })
|
|
bind(var.mainMod .. " + 6", hl.dsp.focus({ workspace = 6 }), { description = "Workspace: Switch to 6" })
|
|
bind(var.mainMod .. " + 7", hl.dsp.focus({ workspace = 7 }), { description = "Workspace: Switch to 7" })
|
|
bind(var.mainMod .. " + 8", hl.dsp.focus({ workspace = 8 }), { description = "Workspace: Switch to 8" })
|
|
bind(var.mainMod .. " + 9", hl.dsp.focus({ workspace = 9 }), { description = "Workspace: Switch to 9" })
|
|
bind(var.mainMod .. " + 0", hl.dsp.focus({ workspace = 10 }), { description = "Workspace: Switch to 10" })
|
|
|
|
-- Move active window to a workspace with mainMod + SHIFT + [0-9]
|
|
bind(
|
|
var.mainMod .. " + SHIFT + 1",
|
|
hl.dsp.window.move({ workspace = 1 }),
|
|
{ description = "Window: move to workspace 1" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + SHIFT + 2",
|
|
hl.dsp.window.move({ workspace = 2 }),
|
|
{ description = "Window: move to workspace 2" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + SHIFT + 3",
|
|
hl.dsp.window.move({ workspace = 3 }),
|
|
{ description = "Window: move to workspace 3" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + SHIFT + 4",
|
|
hl.dsp.window.move({ workspace = 4 }),
|
|
{ description = "Window: move to workspace 4" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + SHIFT + 5",
|
|
hl.dsp.window.move({ workspace = 5 }),
|
|
{ description = "Window: move to workspace 5" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + SHIFT + 6",
|
|
hl.dsp.window.move({ workspace = 6 }),
|
|
{ description = "Window: move to workspace 6" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + SHIFT + 7",
|
|
hl.dsp.window.move({ workspace = 7 }),
|
|
{ description = "Window: move to workspace 7" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + SHIFT + 8",
|
|
hl.dsp.window.move({ workspace = 8 }),
|
|
{ description = "Window: move to workspace 8" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + SHIFT + 9",
|
|
hl.dsp.window.move({ workspace = 9 }),
|
|
{ description = "Window: move to workspace 9" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + SHIFT + 0",
|
|
hl.dsp.window.move({ workspace = 10 }),
|
|
{ description = "Window: move to workspace 10" }
|
|
)
|
|
|
|
-- # Example special workspace (scratchpad)
|
|
|
|
-- bind = $mainMod, S, togglespecialworkspace, magic
|
|
|
|
-- bind = $mainMod SHIFT, S, movetoworkspace, special:magic
|
|
|
|
-- Scroll through existing workspaces with mainMod + scroll
|
|
bind(
|
|
var.mainMod .. " + mouse_down",
|
|
hl.dsp.focus({ workspace = "e+1" }),
|
|
{ description = "Workspace: next (scroll down)" }
|
|
)
|
|
bind(
|
|
var.mainMod .. " + mouse_up",
|
|
hl.dsp.focus({ workspace = "e-1" }),
|
|
{ description = "Workspace: previous (scroll up)" }
|
|
)
|
|
|
|
-- Move/resize windows with mainMod + LMB/RMB and dragging
|
|
bind(var.mainMod .. " + mouse:272", hl.dsp.window.drag(), {
|
|
mouse = true,
|
|
description = "Window: move with mouse",
|
|
})
|
|
bind(var.mainMod .. " + mouse:273", hl.dsp.window.resize(), {
|
|
mouse = true,
|
|
description = "Window: resize with mouse",
|
|
})
|
|
|
|
-- Laptop multimedia keys for volume and LCD brightness
|
|
bind("XF86AudioRaiseVolume", exec("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), {
|
|
repeating = true,
|
|
locked = true,
|
|
description = "Media: volume up (repeat)",
|
|
})
|
|
bind("XF86AudioLowerVolume", exec("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), {
|
|
repeating = true,
|
|
locked = true,
|
|
description = "Media: volume down (repeat)",
|
|
})
|
|
bind("XF86AudioMute", exec("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), {
|
|
repeating = true,
|
|
locked = true,
|
|
description = "Media: mute audio",
|
|
})
|
|
bind("XF86AudioMicMute", exec("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), {
|
|
repeating = true,
|
|
locked = true,
|
|
description = "Media: mute microphone",
|
|
})
|
|
bind("XF86MonBrightnessUp", exec("brightnessctl -e4 -n2 set 5%+"), {
|
|
repeating = true,
|
|
locked = true,
|
|
description = "Brightness up",
|
|
})
|
|
bind("XF86MonBrightnessDown", exec("brightnessctl -e4 -n2 set 5%-"), {
|
|
repeating = true,
|
|
locked = true,
|
|
description = "Brightness down",
|
|
})
|
|
|
|
-- Requires playerctl
|
|
bind("XF86AudioNext", exec("playerctl next"), {
|
|
locked = true,
|
|
description = "Media: next track",
|
|
})
|
|
bind("XF86AudioPause", exec("playerctl play-pause"), {
|
|
locked = true,
|
|
description = "Media: play/pause",
|
|
})
|
|
bind("XF86AudioPlay", exec("playerctl play-pause"), {
|
|
locked = true,
|
|
description = "Media: play/pause",
|
|
})
|
|
bind("XF86AudioPrev", exec("playerctl previous"), {
|
|
locked = true,
|
|
description = "Media: previous track",
|
|
})
|
|
|
|
-- Screenshots
|
|
bind("PRINT", exec("hyprshot -m region --output-folder " .. var.screenshot_folder), {
|
|
locked = true,
|
|
description = "Screenshot region",
|
|
})
|
|
bind("CTRL + PRINT", exec("hyprshot -m window --output-folder " .. var.screenshot_folder), {
|
|
locked = true,
|
|
description = "Screenshot window",
|
|
})
|
|
bind("SHIFT + PRINT", exec("hyprshot -m active --output-folder " .. var.screenshot_folder), {
|
|
locked = true,
|
|
description = "Screenshot active monitor",
|
|
})
|
|
|
|
bind(var.mainMod .. " + L", exec(command.lock), { locked = true, description = "Lock screen" })
|
|
bind(var.mainMod .. " + K", exec(command.keybinds_show), { description = "Keybinds: show overview" })
|
|
bind(var.mainMod .. " + W", exec(command.wallpaper_select), { description = "Wallpaper select" })
|
|
|
|
-- Caelestia extras
|
|
if env.shell == "caelestia" then
|
|
bind(var.mainMod .. " + SHIFT + V", exec(command.clipboard), { description = "Clipboard history" })
|
|
bind(var.mainMod .. " + SHIFT + K", exec(command.show_all), { description = "Toggle utilities" })
|
|
bind("CTRL + ALT + C", exec(command.clear_notifications), { description = "Clear notifications" })
|
|
end
|
|
|
|
-- Persist the registry for the show-keybinds picker
|
|
-- (scripts/show-keybinds.sh reads this TSV to resolve selected commands).
|
|
-- Runs on every config load/reload, keeping the picker in sync with the binds.
|
|
reg.write("/tmp/hypr-keybinds.tsv")
|