2.home-manager/tests/modules/services/hyprland/lua-config.lua
DrymarchonShaun 266211649f
hyprland: fix plugin loading when using lua
Move plugin loading to the top of the rendered ~/.config/hypr/hyprland.lua as plugins must be loaded before hl.config can be called with config keys added by the plugin, (binds using dispatchers added by plugins also fail if they are defined before the plugin is loaded)

This also switches over to using the (undocumented?) hl.plugin.load("/path/to/plugin.so") to load plugins, which has solved some strange race condition weirdness caused by using exec_cmd with hyprctl plugin load (I first tried moving renderStartHook to the top of the rendered config, but sometimes it seemed the hyprctl plugin load wouldn't finish loading the plugin before the rest of the config was loaded, causing the same errors about unknown config keys)
2026-06-18 22:39:21 -05:00

159 lines
3.1 KiB
Lua

-- Generated by Home Manager.
-- See https://wiki.hypr.land/Configuring/Start/
-- plugins
hl.plugin.load("/path/to/plugin1")
hl.plugin.load("/nix/store/00000000000000000000000000000000-foo/lib/libfoo.so")
-- settings.locals
local mod = "SUPER"
local terminal = "kitty"
-- settings.curve
hl.curve("smoothIn", {
["points"] = {
{
0.25,
1
},
{
0.5,
1
}
},
["type"] = "bezier"
})
-- settings.animation
hl.animation({
["bezier"] = "smoothIn",
["enabled"] = true,
["leaf"] = "border",
["speed"] = 2
})
hl.animation({
["bezier"] = "smoothIn",
["enabled"] = true,
["leaf"] = "windows",
["speed"] = 3,
["style"] = "popin 80%"
})
-- settings.bind
hl.bind((mod .. " + Q"), (hl.dsp.window.close()), {
["locked"] = true
})
hl.bind((mod .. " + RETURN"), (hl.dsp.exec_cmd(terminal)))
hl.bind("SUPER + SHIFT + 1", (hl.dsp.window.move({ workspace = "1", follow = false })))
hl.bind((mod .. " + mouse:272"), (hl.dsp.window.drag()), {
["mouse"] = true
})
-- settings.config
hl.config({
["ecosystem"] = {
["enforce_permissions"] = true
},
["input"] = {
["kb_layout"] = "ro",
["touchpad"] = {
["scroll_factor"] = 0.3
}
}
})
-- settings.device
hl.device({
["enabled"] = true,
["name"] = "some:device"
})
-- settings.env
hl.env("QT_QPA_PLATFORMTHEME", "qt5ct")
hl.env("XCURSOR_SIZE", "24")
-- settings.exec_cmd
hl.exec_cmd("hyprctl setcursor Bibata 24")
-- settings.gesture
hl.gesture({
["action"] = "workspace",
["direction"] = "left",
["fingers"] = 3
})
-- settings.layer_rule
hl.layer_rule({
["blur"] = false,
["match"] = {
["namespace"] = "waybar"
}
})
-- settings.monitor
hl.monitor({
["mode"] = "highres",
["output"] = "desc:Monitor",
["position"] = "auto-right",
["scale"] = 1,
["vrr"] = 1
})
-- settings.on
hl.on("hyprland.start", (function()
hl.exec_cmd("waybar")
end
))
-- settings.permission
hl.permission({
["binary"] = "^org\\.example\\..*",
["mode"] = "deny",
["type"] = "screencopy"
})
-- settings.window_rule
hl.window_rule({
["border_size"] = 2,
["match"] = {
["class"] = "kitty"
}
})
-- settings.workspace_rule
hl.workspace_rule({
["monitor"] = "DP-1",
["workspace"] = "1"
})
-- submaps.resize
hl.define_submap("resize", "reset", function()
hl.bind("right", (hl.dsp.window.resize({ x = 10, y = 0, relative = true })), {
["repeating"] = true
})
hl.bind("left", (hl.dsp.window.resize({ x = -10, y = 0, relative = true })), {
["repeating"] = true
})
hl.bind("escape", (hl.dsp.submap("reset")))
end)
-- startup
hl.on("hyprland.start", function()
hl.exec_cmd("@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target")
end)
-- extraConfig
local mainMod = "SUPER"
local terminal = "kitty"
hl.define_submap("resize", function()
hl.bind("right", hl.dsp.window.move({ direction = "right" }))
end)
hl.on("hyprland.start", function()
hl.exec_cmd("waybar")
end)
hl.config({
decoration = {
rounding = 4,
},
})