dot

vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks

71 lines3014 bytesLua
1-- Run once when Hyprland starts. Loaded from the hyprland.lua that Home Manager
2-- writes (modules/home/desktop.nix has the rest of the Hyprland config).
3
4hl.on("hyprland.start", function()
5 -- Wallpaper, bar, notifications, the control centre, tray helpers, the
6 -- clipboard bridge and the polkit agent are systemd user services now
7 -- (modules/home/services.nix in the dot repo): uwsm starts them with
8 -- graphical-session.target, restarts them if they crash, and
9 -- `systemctl --user status <name>` / `journalctl --user -u <name>` show them.
10
11 -- Apps opened at login, in their usual places (scripts/autostart-apps starts
12 -- them, from autostart-apps.service). These placement rules are switched off
13 -- again after two minutes, so opening the same apps by hand later behaves like
14 -- any other window.
15 local startup_rules = {
16 hl.window_rule({
17 name = "startup-signal",
18 match = { class = "^signal$" },
19 workspace = "3 silent",
20 }),
21 hl.window_rule({
22 name = "startup-discord",
23 match = { class = "^discord$" },
24 workspace = "3 silent",
25 }),
26 hl.window_rule({
27 name = "startup-faugus",
28 match = { class = "^io\\.github\\.Faugus\\.faugus-launcher$" },
29 workspace = "1 silent",
30 float = true,
31 size = { 430, 610 },
32 move = { 1901, 333 },
33 }),
34 }
35 hl.timer(function()
36 for _, rule in ipairs(startup_rules) do
37 rule:set_enabled(false)
38 end
39 end, { timeout = 120000, type = "oneshot" })
40
41 -- WowUp can't start hidden, so the window it opens at login is sent to a hidden
42 -- workspace and closed again, which leaves it in the tray. That rule must not
43 -- outlive the one window: it is dropped as soon as the window has opened (or
44 -- after a minute if none came), so opening WowUp yourself right after login
45 -- lands on your workspace like any other window.
46 local wowup_rule = hl.window_rule({
47 name = "startup-wowup",
48 match = { class = "^WowUpCf$" },
49 workspace = "special:autostart silent",
50 })
51 local wowup_pending = true
52 local function wowup_done()
53 wowup_pending = false
54 wowup_rule:set_enabled(false)
55 end
56 hl.on("window.open", function(window)
57 if wowup_pending and window.class == "WowUpCf" then
58 wowup_done()
59 -- closing it from inside the open event is too early and gets ignored
60 local address = window.address
61 hl.timer(function()
62 hl.dispatch(hl.dsp.window.close({ window = "address:" .. address }))
63 end, { timeout = 300, type = "oneshot" })
64 end
65 end)
66 hl.timer(wowup_done, { timeout = 60000, type = "oneshot" })
67
68 -- hl.exec_cmd("gsettings set org.gnome.desktop.interface color-scheme prefer-dark")
69 -- hl.exec_cmd("gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark")
70end)
71