Migrate Hyprland to Lua

This commit is contained in:
2026-05-09 21:39:19 -07:00
parent da79f53755
commit a7c69740de
12 changed files with 385 additions and 297 deletions

View File

@@ -0,0 +1,103 @@
hl.curve("easeIn", {
type = "bezier",
points = { {0.64, 0}, {0.78, 0} }
})
hl.curve("easeOut", {
type = "bezier",
points = { {0.16, 1}, {0.3, 1} }
})
hl.curve("linear", {
type = "bezier",
points = { {0, 0}, {1, 1} }
})
hl.animation({
leaf = "fadeIn",
enabled = true,
speed = 4,
bezier = "easeOut"
})
hl.animation({
leaf = "fadeOut",
enabled = true,
speed = 3,
bezier = "easeOut"
})
hl.animation({
leaf = "windowsIn",
enabled = true,
speed = 4,
bezier = "easeOut",
style = "popin 85%"
})
hl.animation({
leaf = "windowsOut",
enabled = true,
speed = 4,
bezier = "easeOut",
style = "popin 85%"
})
hl.animation({
leaf = "windowsMove",
enabled = true,
speed = 3,
bezier = "easeOut"
})
hl.animation({
leaf = "border",
enabled = true,
speed = 5,
bezier = "easeOut"
})
hl.animation({
leaf = "layersIn",
enabled = true,
speed = 3,
bezier = "linear",
style = "fade"
})
hl.animation({
leaf = "layersOut",
enabled = true,
speed = 2,
bezier = "linear",
style = "fade"
})
hl.animation({
leaf = "fadeLayersIn",
enabled = true,
speed = 3,
bezier = "easeOut"
})
hl.animation({
leaf = "fadeLayersOut",
enabled = true,
speed = 2,
bezier = "easeIn"
})
hl.animation({
leaf = "workspaces",
enabled = true,
speed = 3,
bezier = "easeOut",
style = "slidefade 15%"
})
hl.animation({
leaf = "specialWorkspace",
enabled = true,
speed = 3,
bezier = "easeOut",
style = "slidefadevert 10%"
})
hl.animation({
leaf = "zoomFactor",
enabled = true,
speed = 3,
bezier = "easeOut"
})
hl.animation({
leaf = "monitorAdded",
enabled = true,
speed = 3,
bezier = "easeOut"
})

132
hypr/hyprland/binds.lua Normal file
View File

@@ -0,0 +1,132 @@
-- Window management
hl.bind("SUPER + Q", hl.dsp.window.close())
hl.bind("SUPER + M", hl.dsp.window.float())
hl.bind("SUPER + M", hl.dsp.window.center())
hl.bind("SUPER + SPACE", hl.dsp.global("quickshell:peek_bar"))
hl.bind("SUPER + SPACE", hl.dsp.global("quickshell:peek_bar"), {release = true})
hl.bind("SUPER + SUPER_L", hl.dsp.exec_cmd("quickshell ipc call topbar toggle"))
hl.bind("SUPER + K", hl.dsp.layout("movetoroot"))
hl.bind("SUPER + B", hl.dsp.layout("togglesplit"))
hl.bind("SUPER + x", hl.dsp.layout("swapsplit"))
local function focus_window(n)
local windows = hl.get_windows({workspace = hl.get_active_workspace()})
table.sort(
windows,
function (a, b)
if a.at.x < b.at.x then
return true
end
if a.at.y < b.at.y then
return true
end
return false
end
)
if windows[n] ~= nil then
hl.dispatch(hl.dsp.focus({window = windows[n]}))
end
end
hl.bind("SUPER + A", function() focus_window(1) end)
hl.bind("SUPER + O", function() focus_window(2) end)
hl.bind("SUPER + E", function() focus_window(3) end)
hl.bind("SUPER + U", function() focus_window(4) end)
hl.bind("SUPER + SHIFT + A", function() focus_window(5) end)
hl.bind("SUPER + SHIFT + O", function() focus_window(6) end)
hl.bind("SUPER + SHIFT + E", function() focus_window(7) end)
hl.bind("SUPER + SHIFT + U", function() focus_window(8) end)
-- Screen locking
hl.bind("SUPER + ESCAPE", hl.dsp.exec_cmd("~/.config/scripts/lock.sh"), {locked = true})
hl.bind("XF86Go", hl.dsp.exec_cmd("~/.config/scripts/idle-toggle.sh"))
hl.bind("switch:on:Lid Switch", hl.dsp.exec_cmd(
"quickshell ipc call lock instalock; sleep 0.5; systemctl suspend"
))
-- Multi-monitor
hl.bind("SUPER + PERIOD", hl.dsp.focus({monitor = -1}))
hl.bind("SUPER + P", hl.dsp.workspace.move({monitor = -1}))
-- Workspaces
hl.bind("SUPER + 1", hl.dsp.focus({workspace = 1}))
hl.bind("SUPER + 2", hl.dsp.focus({workspace = 2}))
hl.bind("SUPER + 3", hl.dsp.focus({workspace = 3}))
hl.bind("SUPER + 4", hl.dsp.focus({workspace = 4}))
hl.bind("SUPER + 5", hl.dsp.focus({workspace = 5}))
hl.bind("SUPER + 6", hl.dsp.focus({workspace = 6}))
hl.bind("SUPER + 7", hl.dsp.focus({workspace = 7}))
hl.bind("SUPER + 8", hl.dsp.focus({workspace = 8}))
hl.bind("SUPER + 9", hl.dsp.focus({workspace = 9}))
hl.bind("SUPER + SHIFT + 1", hl.dsp.window.move({workspace = 1, follow = true}))
hl.bind("SUPER + SHIFT + 2", hl.dsp.window.move({workspace = 2, follow = true}))
hl.bind("SUPER + SHIFT + 3", hl.dsp.window.move({workspace = 3, follow = true}))
hl.bind("SUPER + SHIFT + 4", hl.dsp.window.move({workspace = 4, follow = true}))
hl.bind("SUPER + SHIFT + 5", hl.dsp.window.move({workspace = 5, follow = true}))
hl.bind("SUPER + SHIFT + 6", hl.dsp.window.move({workspace = 6, follow = true}))
hl.bind("SUPER + SHIFT + 7", hl.dsp.window.move({workspace = 7, follow = true}))
hl.bind("SUPER + SHIFT + 8", hl.dsp.window.move({workspace = 8, follow = true}))
hl.bind("SUPER + SHIFT + 9", hl.dsp.window.move({workspace = 9, follow = true}))
-- Special workspace
hl.bind("SUPER + V", hl.dsp.workspace.toggle_special())
hl.bind("SUPER + W", hl.dsp.window.move({workspace = -1}))
-- Move/resize windows
hl.bind("SUPER + mouse:272", hl.dsp.window.drag(), ({mouse = true}))
hl.bind("SUPER + mouse:273", hl.dsp.window.resize(), ({mouse = true}))
-- Open favourites
hl.bind("SUPER + G", hl.dsp.exec_cmd("zen-browser"))
hl.bind("SUPER + C", hl.dsp.exec_cmd("vesktop"))
hl.bind("SUPER + R", hl.dsp.exec_cmd("keepassxc"))
hl.bind("SUPER + L", hl.dsp.exec_cmd("kitty"))
-- Adjust brightness
hl.bind(
"XF86MonBrightnessUp",
hl.dsp.global("quickshell:increase_brightness"),
{locked = true, repeating = true}
)
hl.bind(
"XF86MonBrightnessDown",
hl.dsp.global("quickshell:decrease_brightness"),
{locked = true, repeating = true}
)
hl.bind(
"SHIFT + XF86MonBrightnessDown",
hl.dsp.exec_cmd("brillo -S 0% -q -u 1000000"),
{locked = true, repeating = true}
)
-- Adjust volume and media
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd(
"pactl set-sink-volume @DEFAULT_SINK@ +1%"
))
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd(
"pactl set-sink-volume @DEFAULT_SINK@ -1%"
))
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("quickshell ipc call osd open"))
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("quickshell ipc call osd open"))
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("playerctl next"))
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("playerctl play-pause"))
-- Screen capturing
hl.bind("SUPER + COMMA", hl.dsp.exec_cmd(
"pgrep slurp || hyprshot -o ~/Pictures/Screenshots -z -s -m region"
))
hl.bind("SUPER + ALT + COMMA", hl.dsp.exec_cmd(
"pgrep slurp || hyprshot -o ~/Pictures/Screenshots -z -s -m window"
))
hl.bind("SUPER + SHIFT + COMMA", hl.dsp.exec_cmd(
"pgrep slurp || hyprshot -o ~/Pictures/Screenshots -z -s -m active -m output"
))
hl.bind("SUPER + SEMICOLON", hl.dsp. exec_cmd("~/.config/scripts/zoom.sh"))
hl.bind("SHIFT + XF86Display", hl.dsp.exec_cmd("~/.config/scripts/vnc-toggle.sh"))
hl.bind("XF86Display", hl.dsp.exec_cmd("pkill -x quickshell; quickshell"))
hl.bind("SUPER + D", hl.dsp.exec_cmd("wayscriber --active"))
hl.bind("SUPER + SHIFT + D", hl.dsp.exec_cmd("wl-paste | satty -f -"))

67
hypr/hyprland/config.lua Normal file
View File

@@ -0,0 +1,67 @@
hl.config({
input = {
kb_layout = "us",
kb_variant = "dvorak",
repeat_delay = 600,
touchpad = {
natural_scroll = true
}
},
general = {
gaps_in = 4,
gaps_out = 6,
border_size = 0,
layout = "dwindle",
no_focus_fallback = true
},
decoration = {
rounding = 12,
rounding_power = 2,
-- active_opacity = 0.95,
-- inactive_opacity = 0.9,
-- fullscreen_opacity = 1.0,
blur = {
enabled = true,
size = 8,
passes = 3,
new_optimizations = true,
ignore_opacity = true,
special = false,
brightness = 0.2,
},
shadow = {
range = 18,
render_power = 4,
scale = 0.9995,
color = "#000000",
}
},
dwindle = {
preserve_split = true,
smart_split = false,
use_active_for_splits = true,
force_split = 2,
},
binds = {
disable_keybind_grabbing = true
},
misc = {
disable_hyprland_logo = true,
disable_splash_rendering = false,
on_focus_under_fullscreen = 2,
key_press_enables_dpms = true,
mouse_move_enables_dpms = true,
focus_on_activate = true,
session_lock_xray = false,
animate_manual_resizes = true,
enable_anr_dialog = false,
background_color = "#141414",
},
cursor = {
persistent_warps = true,
},
xwayland = {
force_zero_scaling = true,
},
})

View File

@@ -0,0 +1,19 @@
hl.on("hyprland.start", function()
hl.exec_cmd("quickshell")
hl.exec_cmd("hypridle")
hl.exec_cmd("/lib/polkit-gnome/polkit-gnome-authentication-agent-1")
hl.exec_cmd("keyd-application-mapper -d")
hl.exec_cmd("hyprpm reload")
hl.exec_cmd("kanshi")
end)
hl.env("XCURSOR_SIZE", "22")
hl.env("XCURSOR_THEME", "GoogleDot-Black")
hl.env("GTK_THEME", "Graphite-Dark")
hl.env("GTK_ICON_THEME", "YAMIS")
hl.env("HYPRCURSOR_SIZE", "22")
hl.env("HYPRCURSOR_THEME", "GoogleDot-hypr")
hl.env("QT_QPA_PLATFORMTHEME", "gtk3")
hl.env("QT_QPA_PLATFORM", "wayland;xcb")
hl.env("FREETYPE_PROPERTIES", ":no-stem-darkening=0 autofitter:no-stem-darkening=0")

47
hypr/hyprland/rules.lua Normal file
View File

@@ -0,0 +1,47 @@
-- Smart gaps
hl.workspace_rule({ workspace = "w[tv1]s[false]", gaps_out = 0, gaps_in = 0 })
hl.workspace_rule({ workspace = "f[1]s[false]", gaps_out = 0, gaps_in = 0 })
hl.window_rule({ match = { float = false, workspace = "w[tv1]s[false]" }, border_size = 0 })
hl.window_rule({ match = { float = false, workspace = "w[tv1]s[false]" }, rounding = 0 })
hl.window_rule({ match = { float = false, workspace = "f[1]s[false]" }, border_size = 0 })
hl.window_rule({ match = { float = false, workspace = "f[1]s[false]" }, rounding = 0 })
-- Misc window rules
hl.window_rule({
match = {
class = "Write:"
},
float = true
})
hl.window_rule({
match = {
class = "xdg-desktop-portal-gtk"
},
float = true
})
hl.window_rule({
match = {
title = "(Open File)"
},
no_blur = true
})
hl.window_rule({
match = {
class = "(Xdg-desktop-portal-gtk)"
},
no_blur = true
})
hl.window_rule({
match = {
class = "(eog)"
},
float = true,
center = true
})
hl.window_rule({
match = {
class = "(mpv|loupe|com.gabm.satty)"
},
float = true,
size = { "monitor_w*0.95", "monitor_h*0.95"}
})