summaryrefslogtreecommitdiff
path: root/nixos/mdls/hypr.nix
diff options
context:
space:
mode:
authorcaley <195605706+cqley@users.noreply.github.com>2026-06-30 10:05:56 +0200
committerGitHub <noreply@github.com>2026-06-30 10:05:56 +0200
commitf2ea4b18773b5af7c2d7eee719ef5277759289d3 (patch)
tree7f4fd0e00a48448309bb413d92db65dc0cc0ec10 /nixos/mdls/hypr.nix
parent9d75fe63e98185807d342d86dae9e575879e3512 (diff)
Refactor Hyprland configuration to use exec
Diffstat (limited to 'nixos/mdls/hypr.nix')
-rw-r--r--nixos/mdls/hypr.nix157
1 files changed, 73 insertions, 84 deletions
diff --git a/nixos/mdls/hypr.nix b/nixos/mdls/hypr.nix
index fe0a160..f7d239a 100644
--- a/nixos/mdls/hypr.nix
+++ b/nixos/mdls/hypr.nix
@@ -8,6 +8,17 @@
configType = "lua";
extraConfig = ''
+ local hl = hl
+ local dsp = hl.dsp
+ local bind = hl.bind
+ local config = hl.config
+ local curve = hl.curve
+ local animation = hl.animation
+ local exec = dsp.exec_cmd
+ local focus = dsp.focus
+ local window = dsp.window
+ local workspace = dsp.workspace
+
hl.monitor({ output = "HDMI-A-1", mode = "1920x1080@200", position = "0x0", scale = 1 })
hl.monitor({ output = "DP-1", mode = "1920x1080@144", position = "-1080x-330", scale = 1, transform = 3 })
@@ -17,28 +28,26 @@
local browser = "helium"
hl.on("hyprland.start", function ()
- hl.exec_cmd("systemctl --user start hyprpolkitagent")
- hl.exec_cmd("bash -c 'awww-daemon & sleep 0.5 && awww clear --outputs DP-1'")
- hl.exec_cmd("wl-paste --type text --watch cliphist store")
- hl.exec_cmd("wl-paste --type image --watch cliphist store")
- hl.exec_cmd("quickshell -c ~/.config/quickshell")
+ exec("systemctl --user start hyprpolkitagent")
+ exec("bash -c 'awww-daemon & sleep 0.5 && awww clear --outputs DP-1'")
+ exec("wl-paste --type text --watch cliphist store")
+ exec("wl-paste --type image --watch cliphist store")
+ exec("quickshell -c ~/.config/quickshell")
end)
- hl.config({
+ config({
general = {
gaps_in = 2.5,
gaps_out = 5,
border_size = 1,
resize_on_border = false,
- col = {
- active_border = "rgba(ffffffff)",
- },
+ col = { active_border = "rgba(ffffffff)" },
allow_tearing = false,
layout = "dwindle",
},
})
- hl.config({
+ config({
decoration = {
rounding = 0,
rounding_power = 0,
@@ -59,39 +68,17 @@
},
})
- hl.curve("easeOutQuint", { type = "bezier", points = { {0.20, 1}, {0.30, 1} } })
- hl.curve("easeInOutCubic", { type = "bezier", points = { {0.65, 0.05}, {0.35, 1} } })
- hl.curve("linear", { type = "bezier", points = { {0, 0}, {1, 1} } })
- hl.curve("almostLinear", { type = "bezier", points = { {0.5, 0.5}, {0.75, 1} } })
- hl.curve("quick", { type = "bezier", points = { {0.15, 0}, {0.1, 1} } })
- hl.curve("hard", { type = "bezier", points = { {0, 1}, {0, 1} } })
- hl.animation({ leaf = "global", enabled = true, speed = 5, bezier = "default" })
- hl.animation({ leaf = "border", enabled = true, speed = 2.5, bezier = "easeOutQuint" })
- hl.animation({ leaf = "windows", enabled = true, speed = 2.5, bezier = "easeOutQuint" })
- hl.animation({ leaf = "windowsIn", enabled = true, speed = 2, bezier = "easeOutQuint", style = "popin 90%" })
- hl.animation({ leaf = "windowsOut", enabled = true, speed = 1, bezier = "linear", style = "popin 90%" })
- hl.animation({ leaf = "fadeIn", enabled = true, speed = 1, bezier = "almostLinear" })
- hl.animation({ leaf = "fadeOut", enabled = true, speed = 1, bezier = "almostLinear" })
- hl.animation({ leaf = "fade", enabled = true, speed = 1.5, bezier = "quick" })
- hl.animation({ leaf = "layers", enabled = true, speed = 2, bezier = "easeOutQuint" })
- hl.animation({ leaf = "layersIn", enabled = true, speed = 2, bezier = "easeOutQuint", style = "fade" })
- hl.animation({ leaf = "layersOut", enabled = true, speed = 1, bezier = "linear", style = "fade" })
- hl.animation({ leaf = "workspaces", enabled = true, speed = 1, bezier = "almostLinear", style = "fade" })
- hl.animation({ leaf = "specialWorkspace", enabled = true, speed = 1, bezier = "almostLinear", style = "fade" })
-
- hl.config({
+ config({
input = {
kb_layout = "us",
follow_mouse = 1,
sensitivity = 0,
force_no_accel = false,
- touchpad = {
- natural_scroll = false,
- },
+ touchpad = { natural_scroll = false },
},
})
- hl.config({
+ config({
misc = {
force_default_wallpaper = 0,
disable_hyprland_logo = true,
@@ -100,71 +87,73 @@
},
})
- hl.config({
+ config({
dwindle = {
preserve_split = true,
},
})
+ curve("easeOutQuint", { type = "bezier", points = { {0.20, 1}, {0.30, 1} } })
+ curve("easeInOutCubic", { type = "bezier", points = { {0.65, 0.05}, {0.35, 1} } })
+ curve("linear", { type = "bezier", points = { {0, 0}, {1, 1} } })
+ curve("almostLinear", { type = "bezier", points = { {0.5, 0.5}, {0.75, 1} } })
+ curve("quick", { type = "bezier", points = { {0.15, 0}, {0.1, 1} } })
+ curve("hard", { type = "bezier", points = { {0, 1}, {0, 1} } })
+ animation({ leaf = "global", enabled = true, speed = 5, bezier = "default" })
+ animation({ leaf = "border", enabled = true, speed = 2.5, bezier = "easeOutQuint" })
+ animation({ leaf = "windows", enabled = true, speed = 2.5, bezier = "easeOutQuint" })
+ animation({ leaf = "windowsIn", enabled = true, speed = 2, bezier = "easeOutQuint", style = "popin 90%" })
+ animation({ leaf = "windowsOut", enabled = true, speed = 1, bezier = "linear", style = "popin 90%" })
+ animation({ leaf = "fadeIn", enabled = true, speed = 1, bezier = "almostLinear" })
+ animation({ leaf = "fadeOut", enabled = true, speed = 1, bezier = "almostLinear" })
+ animation({ leaf = "fade", enabled = true, speed = 1.5, bezier = "quick" })
+ animation({ leaf = "layers", enabled = true, speed = 2, bezier = "easeOutQuint" })
+ animation({ leaf = "layersIn", enabled = true, speed = 2, bezier = "easeOutQuint", style = "fade" })
+ animation({ leaf = "layersOut", enabled = true, speed = 1, bezier = "linear", style = "fade" })
+ animation({ leaf = "workspaces", enabled = true, speed = 1, bezier = "almostLinear", style = "fade" })
+ animation({ leaf = "specialWorkspace", enabled = true, speed = 1, bezier = "almostLinear", style = "fade" })
+
hl.window_rule({
- match = {
- initial_class = "^(imv|mpv)$",
- },
+ match = { initial_class = "^(imv|mpv)$" },
float = true,
center = true,
size = "600 600",
})
- hl.bind(mod .. " + Q", hl.dsp.exec_cmd(terminal))
- hl.bind(mod .. " + R", hl.dsp.exec_cmd("quickshell ipc call menu toggle"))
- hl.bind(mod .. " + T", hl.dsp.exec_cmd("quickshell ipc call master toggle"))
- hl.bind(mod .. " + W", hl.dsp.exec_cmd("quickshell ipc call bar toggle"))
- hl.bind(mod .. " + X", hl.dsp.exec_cmd("quickshell ipc call mic toggle"))
- hl.bind(mod .. " + E", hl.dsp.exec_cmd(filemanager))
- hl.bind(mod .. " + B", hl.dsp.exec_cmd(browser))
- hl.bind(mod .. " + C", hl.dsp.window.close())
- hl.bind(mod .. " + V", hl.dsp.window.float({ action = "toggle" }))
- hl.bind(mod .. " + F", hl.dsp.window.fullscreen({ mode = 0 }))
- hl.bind(mod .. " + Tab", hl.dsp.focus({ workspace = "m+1" }))
- hl.bind('ALT + S', hl.dsp.exec_cmd('hyprshot -o .pictures/screenshots/ -f "$(date +%y-%m-%d_%H-%M-%S).png" -s -m region'))
-
- hl.bind(mod .. " + left", hl.dsp.focus({ direction = "left" }))
- hl.bind(mod .. " + right", hl.dsp.focus({ direction = "right" }))
- hl.bind(mod .. " + up", hl.dsp.focus({ direction = "up" }))
- hl.bind(mod .. " + down", hl.dsp.focus({ direction = "down" }))
+ bind(mod .. " + Q", exec(terminal))
+ bind(mod .. " + R", exec("quickshell ipc call menu toggle"))
+ bind(mod .. " + T", exec("quickshell ipc call master toggle"))
+ bind(mod .. " + W", exec("quickshell ipc call bar toggle"))
+ bind(mod .. " + X", exec("quickshell ipc call mic toggle"))
+ bind(mod .. " + E", exec(filemanager))
+ bind(mod .. " + B", exec(browser))
+ bind(mod .. " + C", window.close())
+ bind(mod .. " + V", window.float({ action = "toggle" }))
+ bind(mod .. " + F", window.fullscreen({ mode = 0 }))
+ bind(mod .. " + Tab", focus({ workspace = "m+1" }))
+ bind("ALT + S", exec('hyprshot -o .pictures/screenshots/ -f "$(date +%y-%m-%d_%H-%M-%S).png" -s -m region'))
- hl.bind("SHIFT + left", hl.dsp.window.move({ direction = "left" }))
- hl.bind("SHIFT + right", hl.dsp.window.move({ direction = "right" }))
- hl.bind("SHIFT + up", hl.dsp.window.move({ direction = "up" }))
- hl.bind("SHIFT + down", hl.dsp.window.move({ direction = "down" }))
+ bind(mod .. " + left", focus({ direction = "left" }))
+ bind(mod .. " + right", focus({ direction = "right" }))
+ bind(mod .. " + up", focus({ direction = "up" }))
+ bind(mod .. " + down", focus({ direction = "down" }))
- hl.bind(mod .. " + 1", hl.dsp.focus({ workspace = 1 }))
- hl.bind(mod .. " + 2", hl.dsp.focus({ workspace = 2 }))
- hl.bind(mod .. " + 3", hl.dsp.focus({ workspace = 3 }))
- hl.bind(mod .. " + 4", hl.dsp.focus({ workspace = 4 }))
- hl.bind(mod .. " + 5", hl.dsp.focus({ workspace = 5 }))
- hl.bind(mod .. " + 6", hl.dsp.focus({ workspace = 6 }))
- hl.bind(mod .. " + 7", hl.dsp.focus({ workspace = 7 }))
- hl.bind(mod .. " + 8", hl.dsp.focus({ workspace = 8 }))
- hl.bind(mod .. " + 9", hl.dsp.focus({ workspace = 9 }))
- hl.bind(mod .. " + 0", hl.dsp.focus({ workspace = 10 }))
+ bind("SHIFT + left", window.move({ direction = "left" }))
+ bind("SHIFT + right", window.move({ direction = "right" }))
+ bind("SHIFT + up", window.move({ direction = "up" }))
+ bind("SHIFT + down", window.move({ direction = "down" }))
- hl.bind(mod .. " + SHIFT + 1", hl.dsp.window.move({ workspace = 1 }))
- hl.bind(mod .. " + SHIFT + 2", hl.dsp.window.move({ workspace = 2 }))
- hl.bind(mod .. " + SHIFT + 3", hl.dsp.window.move({ workspace = 3 }))
- hl.bind(mod .. " + SHIFT + 4", hl.dsp.window.move({ workspace = 4 }))
- hl.bind(mod .. " + SHIFT + 5", hl.dsp.window.move({ workspace = 5 }))
- hl.bind(mod .. " + SHIFT + 6", hl.dsp.window.move({ workspace = 6 }))
- hl.bind(mod .. " + SHIFT + 7", hl.dsp.window.move({ workspace = 7 }))
- hl.bind(mod .. " + SHIFT + 8", hl.dsp.window.move({ workspace = 8 }))
- hl.bind(mod .. " + SHIFT + 9", hl.dsp.window.move({ workspace = 9 }))
- hl.bind(mod .. " + SHIFT + 0", hl.dsp.window.move({ workspace = 10 }))
+ for i = 1, 10 do
+ local key = (i == 10) and "0" or tostring(i)
+ bind(mod .. " + " .. key, focus({ workspace = i }))
+ bind(mod .. " + SHIFT + " .. key, window.move({ workspace = i }))
+ end
- hl.bind(mod .. " + S", hl.dsp.workspace.toggle_special("magic"))
- hl.bind(mod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" }))
+ bind(mod .. " + S", workspace.toggle_special("magic"))
+ bind(mod .. " + SHIFT + " .. "S", window.move({ workspace = "special:magic" }))
- hl.bind(mod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
- hl.bind(mod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
+ bind(mod .. " + mouse:272", window.drag(), { mouse = true })
+ bind(mod .. " + mouse:273", window.resize(), { mouse = true })
'';
};
}