overhaul hyprbinds

This commit is contained in:
2026-07-20 02:00:26 -07:00
parent 67f633f389
commit 5c6f656127

View File

@@ -6,46 +6,15 @@ function bind(keys, dispatcher, flags)
hl.bind(keys, dispatcher, flags)
end
-- Window management
bind("SUPER + Q", hl.dsp.window.close())
bind("SUPER + M", hl.dsp.window.float())
bind("SUPER + M", function ()
local monitor = hl.get_active_monitor()
local window = hl.get_active_window()
if (monitor == nil or window == nil) then return end
if not window.floating then return end
hl.dispatch(hl.dsp.window.resize({
x = monitor.width - monitor.height * 0.1,
y = monitor.height * 0.9
}))
hl.dispatch(hl.dsp.window.center())
end)
bind("SUPER + F", hl.dsp.window.fullscreen())
bind("SUPER + X", hl.dsp.layout("swapsplit"))
bind("SUPER + B", hl.dsp.layout("togglesplit"))
bind("SUPER + SPACE", hl.dsp.global("quickshell:peek_bar"))
bind("SUPER + SPACE", hl.dsp.global("quickshell:peek_bar"), {release = true})
bind("SUPER + SUPER_L", hl.dsp.exec_cmd("quickshell ipc call topbar toggle"), {device = {inclusive = false, list = {"zikway-hid-gamepad-keyboard"}}})
bind("SUPER + SUPER_R", hl.dsp.workspace.toggle_special(), {device = {inclusive = true, list = {"zikway-hid-gamepad-keyboard"}}})
-- Move/resize windows
bind("SUPER + H", hl.dsp.window.move({direction = "l"}))
bind("SUPER + T", hl.dsp.window.move({direction = "u"}))
bind("SUPER + N", hl.dsp.window.move({direction = "d"}))
bind("SUPER + S", hl.dsp.window.move({direction = "r"}))
bind("SUPER + ALT + H", hl.dsp.window.resize({x = -50, y = 0, relative = true}),
{repeating = true})
bind("SUPER + ALT + T", hl.dsp.window.resize({x = 0, y = -50, relative = true}),
{repeating = true})
bind("SUPER + ALT + N", hl.dsp.window.resize({x = 0, y = 50, relative = true}),
{repeating = true})
bind("SUPER + ALT + S", hl.dsp.window.resize({x = 50, y = 0, relative = true}),
{repeating = true})
bind("SUPER + mouse:272", hl.dsp.window.drag(), ({mouse = true}))
bind("SUPER + mouse:273", hl.dsp.window.resize(), ({mouse = true}))
-- Workspaces
-- Super + num goes to workspace #num
for i = 1, 9 do
bind('SUPER + ' .. tostring(i), hl.dsp.focus({workspace = i}))
end
-- Super + num moves focused window to workspace #num
for i = 1, 9 do
bind("SUPER + SHIFT + " .. tostring(i), hl.dsp.window.move({workspace = i}))
end
-- Select windows ordered top to bottom, left to right
local function select_window(n)
@@ -85,55 +54,69 @@ local function focus_window(n)
hl.dispatch(hl.dsp.focus({window = window}))
end
end
local function swap_window(n)
local window = select_window(n)
if window ~= nil then
hl.dispatch(hl.dsp.window.swap({target = window}))
end
local focus_window_keys = {
'A',
'O',
'E',
'U',
'SHIFT + A',
'SHIFT + O',
'SHIFT + E',
'SHIFT + U',
}
for i, key in ipairs(focus_window_keys) do
bind('SUPER + ' .. key, function() focus_window(i) end)
end
bind("SUPER + A", function() focus_window(1) end)
bind("SUPER + O", function() focus_window(2) end)
bind("SUPER + E", function() focus_window(3) end)
bind("SUPER + U", function() focus_window(4) end)
bind("SUPER + SHIFT + A", function() focus_window(5) end)
bind("SUPER + SHIFT + O", function() focus_window(6) end)
bind("SUPER + SHIFT + E", function() focus_window(7) end)
bind("SUPER + SHIFT + U", function() focus_window(8) end)
-- Move/resize windows
bind("SUPER + H", hl.dsp.window.move({direction = "l"}))
bind("SUPER + T", hl.dsp.window.move({direction = "u"}))
bind("SUPER + N", hl.dsp.window.move({direction = "d"}))
bind("SUPER + S", hl.dsp.window.move({direction = "r"}))
bind("SUPER + ALT + H", hl.dsp.window.resize({x = -50, y = 0, relative = true}),
{repeating = true})
bind("SUPER + ALT + T", hl.dsp.window.resize({x = 0, y = -50, relative = true}),
{repeating = true})
bind("SUPER + ALT + N", hl.dsp.window.resize({x = 0, y = 50, relative = true}),
{repeating = true})
bind("SUPER + ALT + S", hl.dsp.window.resize({x = 50, y = 0, relative = true}),
{repeating = true})
bind("SUPER + ALT + A", function() swap_window(1) end)
bind("SUPER + ALT + O", function() swap_window(2) end)
bind("SUPER + ALT + E", function() swap_window(3) end)
bind("SUPER + ALT + U", function() swap_window(4) end)
bind("SUPER + ALT + SHIFT + A", function() swap_window(5) end)
bind("SUPER + ALT + SHIFT + O", function() swap_window(6) end)
bind("SUPER + ALT + SHIFT + E", function() swap_window(7) end)
bind("SUPER + ALT + SHIFT + U", function() swap_window(8) end)
bind("SUPER + mouse:272", hl.dsp.window.drag(), ({mouse = true}))
bind("SUPER + mouse:273", hl.dsp.window.resize(), ({mouse = true}))
-- Workspaces
bind("SUPER + 1", hl.dsp.focus({workspace = 1}))
bind("SUPER + 2", hl.dsp.focus({workspace = 2}))
bind("SUPER + 3", hl.dsp.focus({workspace = 3}))
bind("SUPER + 4", hl.dsp.focus({workspace = 4}))
bind("SUPER + 5", hl.dsp.focus({workspace = 5}))
bind("SUPER + 6", hl.dsp.focus({workspace = 6}))
bind("SUPER + 7", hl.dsp.focus({workspace = 7}))
bind("SUPER + 8", hl.dsp.focus({workspace = 8}))
bind("SUPER + 9", hl.dsp.focus({workspace = 9}))
-- Window management
bind('SUPER + SEMICOLON', hl.dsp.window.fullscreen())
bind('SUPER + Q', hl.dsp.window.close())
bind('SUPER + J', function()
hl.dispatch(hl.dsp.window.float())
local monitor = hl.get_active_monitor()
local window = hl.get_active_window()
if (monitor == nil or window == nil) then return end
if not window.floating then return end
hl.dispatch(hl.dsp.window.resize({
x = monitor.width - monitor.height * 0.1,
y = monitor.height * 0.9
}))
hl.dispatch(hl.dsp.window.center())
end)
bind('SUPER + K', hl.dsp.layout('togglesplit'))
bind('SUPER + X', hl.dsp.layout('swapsplit'))
bind("SUPER + SHIFT + 1", hl.dsp.window.move({workspace = 1, follow = true}))
bind("SUPER + SHIFT + 2", hl.dsp.window.move({workspace = 2, follow = true}))
bind("SUPER + SHIFT + 3", hl.dsp.window.move({workspace = 3, follow = true}))
bind("SUPER + SHIFT + 4", hl.dsp.window.move({workspace = 4, follow = true}))
bind("SUPER + SHIFT + 5", hl.dsp.window.move({workspace = 5, follow = true}))
bind("SUPER + SHIFT + 6", hl.dsp.window.move({workspace = 6, follow = true}))
bind("SUPER + SHIFT + 7", hl.dsp.window.move({workspace = 7, follow = true}))
bind("SUPER + SHIFT + 8", hl.dsp.window.move({workspace = 8, follow = true}))
bind("SUPER + SHIFT + 9", hl.dsp.window.move({workspace = 9, follow = true}))
-- Special workspace
bind("SUPER + APOSTROPHE", function ()
if hl.get_active_special_workspace() == nil then
hl.dispatch(hl.dsp.window.move({workspace = "special"}))
else
hl.dispatch(hl.dsp.window.move({workspace = hl.get_active_workspace()}))
end
end)
bind('SUPER + COMMA', hl.dsp.workspace.toggle_special())
-- Multi-monitor
-- Multi monitor
bind("SUPER + PERIOD", hl.dsp.focus({monitor = -1}))
bind("SUPER + P", hl.dsp.workspace.move({monitor = -1}))
bind("SUPER + SHIFT + PERIOD", hl.dsp.window.move({monitor = -1}))
-- Screen locking
bind("SUPER + ESCAPE", hl.dsp.exec_cmd("~/.config/scripts/lock.sh"), {locked = true})
@@ -143,16 +126,39 @@ bind("switch:on:Lid Switch", hl.dsp.exec_cmd(
"quickshell ipc call lock instalock; sleep 0.5; systemctl suspend"
))
-- Special workspace
bind("SUPER + V", hl.dsp.workspace.toggle_special())
bind("SUPER + W", function ()
if hl.get_active_special_workspace() == nil then
hl.dispatch(hl.dsp.window.move({workspace = "special"}))
-- Open favourites
bind("SUPER + G", hl.dsp.exec_cmd("zen-browser"))
bind("SUPER + R", hl.dsp.exec_cmd("keepassxc"))
bind("SUPER + L", hl.dsp.exec_cmd("kitty"))
-- Screen capturing
local zoom = false
bind("SUPER + Z", function()
if zoom then
hl.config({cursor = {zoom_factor = 1.0, invisible = false}})
zoom = false
else
hl.dispatch(hl.dsp.window.move({workspace = hl.get_active_workspace()}))
hl.config({cursor = {zoom_factor = 3.0, invisible = true}})
zoom = true
end
end)
bind('SUPER + V', hl.dsp.exec_cmd(
'pgrep slurp || hyprshot -o ~/Pictures/Screenshots -z -s -m region'
))
bind('SUPER + ALT + V', hl.dsp.exec_cmd(
'pgrep slurp || hyprshot -o ~/Pictures/Screenshots -z -s -m window'
))
bind('SUPER + SHIFT + V', hl.dsp.exec_cmd(
'pgrep slurp || hyprshot -o ~/Pictures/Screenshots -z -s -m active -m output'
))
bind('SUPER + W', hl.dsp.exec_cmd('quickshell ipc call overlay open'))
bind('SUPER + M', hl.dsp.exec_cmd('wayscriber --active'))
bind('SUPER + ALT + M', hl.dsp.exec_cmd('wl-paste | satty -f -'))
bind("SHIFT + XF86Display", hl.dsp.exec_cmd("~/.config/scripts/vnc-toggle.sh"))
bind("XF86Display", hl.dsp.exec_cmd("pkill -x quickshell; quickshell"))
-- Adjust brightness
bind(
"XF86MonBrightnessUp",
@@ -177,52 +183,11 @@ bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd(
bind("XF86AudioLowerVolume", hl.dsp.exec_cmd(
"pactl set-sink-volume @DEFAULT_SINK@ -1%"
))
bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("quickshell ipc call osd open"))
bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("quickshell ipc call osd open"))
bind("XF86AudioMicMute", hl.dsp.exec_cmd("playerctl next"))
bind("XF86AudioMute", hl.dsp.exec_cmd("playerctl play-pause"))
-- Screen capturing
bind("SUPER + COMMA", hl.dsp.exec_cmd(
"pgrep slurp || hyprshot -o ~/Pictures/Screenshots -z -s -m region"
))
bind("SUPER + ALT + COMMA", hl.dsp.exec_cmd(
"pgrep slurp || hyprshot -o ~/Pictures/Screenshots -z -s -m window"
))
bind("SUPER + SHIFT + COMMA", hl.dsp.exec_cmd(
"pgrep slurp || hyprshot -o ~/Pictures/Screenshots -z -s -m active -m output"
))
local zoom = false
bind("SUPER + SEMICOLON", function ()
if zoom then
hl.config({cursor = {zoom_factor = 1.0, invisible = false}})
zoom = false
else
hl.config({cursor = {zoom_factor = 3.0, invisible = true}})
zoom = true
end
end)
bind("SHIFT + XF86Display", hl.dsp.exec_cmd("~/.config/scripts/vnc-toggle.sh"))
bind("XF86Display", hl.dsp.exec_cmd("pkill -x quickshell; quickshell"))
bind("SUPER + D", hl.dsp.exec_cmd("wayscriber --active"))
bind("SUPER + SHIFT + D", hl.dsp.exec_cmd("wl-paste | satty -f -"))
bind("SUPER + R", hl.dsp.exec_cmd("quickshell ipc call overlay open"))
-- Open favourites
bind("SUPER + L", hl.dsp.exec_cmd("kitty"))
-- Pass keybinds to ninjabrainbot
bind("KP_HOME", hl.dsp.pass({window = "class:vesktop"}))
bind("KP_HOME", hl.dsp.pass({window = "class:vesktop"}), {release = true})
bind("KP_UP", hl.dsp.send_shortcut({mods = "CTRL + SHIFT", key = "M", window = "class:vesktop"}))
bind("KP_UP", hl.dsp.send_shortcut({mods = "CTRL + SHIFT", key = "M", window = "class:vesktop"}), {release = true})
bind("KP_PRIOR", hl.dsp.send_shortcut({mods = "CTRL + SHIFT", key = "D", window = "class:vesktop"}))
bind("KP_PRIOR", hl.dsp.send_shortcut({mods = "CTRL + SHIFT", key = "D", window = "class:vesktop"}), {release = true})
-- Remappings for prev and next
bind("ALT + SLASH", hl.dsp.send_shortcut({mods = "ALT", key = "LEFT"}))
bind("ALT + EQUAL", hl.dsp.send_shortcut({mods = "ALT", key = "RIGHT"}))
-- Autoclicker
-- bind("a", hl.dsp.send_shortcut({mods = "", key = "mouse:272"}), {repeating = true})
-- hl.config({input = {repeat_rate = 1000}})
-- Toggle bar
bind("SUPER + SPACE", hl.dsp.global("quickshell:peek_bar"))
bind("SUPER + SPACE", hl.dsp.global("quickshell:peek_bar"), {release = true})
bind("SUPER + SUPER_L", hl.dsp.exec_cmd("quickshell ipc call topbar toggle"), {device = {inclusive = false, list = {"zikway-hid-gamepad-keyboard"}}})
bind("SUPER + SUPER_R", hl.dsp.workspace.toggle_special(), {device = {inclusive = true, list = {"zikway-hid-gamepad-keyboard"}}})