-- Run once when Hyprland starts. Loaded from the hyprland.lua that Home Manager -- writes (modules/home/desktop.nix has the rest of the Hyprland config). hl.on("hyprland.start", function() -- Wallpaper, bar, notifications, the control centre, tray helpers, the -- clipboard bridge and the polkit agent are systemd user services now -- (modules/home/services.nix in the dot repo): uwsm starts them with -- graphical-session.target, restarts them if they crash, and -- `systemctl --user status ` / `journalctl --user -u ` show them. -- Apps opened at login, in their usual places (scripts/autostart-apps starts -- them, from autostart-apps.service). These placement rules are switched off -- again after two minutes, so opening the same apps by hand later behaves like -- any other window. local startup_rules = { hl.window_rule({ name = "startup-signal", match = { class = "^signal$" }, workspace = "3 silent", }), hl.window_rule({ name = "startup-discord", match = { class = "^discord$" }, workspace = "3 silent", }), hl.window_rule({ name = "startup-faugus", match = { class = "^io\\.github\\.Faugus\\.faugus-launcher$" }, workspace = "1 silent", float = true, size = { 430, 610 }, move = { 1901, 333 }, }), } hl.timer(function() for _, rule in ipairs(startup_rules) do rule:set_enabled(false) end end, { timeout = 120000, type = "oneshot" }) -- WowUp can't start hidden, so the window it opens at login is sent to a hidden -- workspace and closed again, which leaves it in the tray. Its class is -- "wowupcf" on NixOS ("WowUpCf" on CachyOS), so both are matched. Before that -- window it can open Overwolf's consent popup (same class, titled "WowUpCf"), -- which is hidden and closed the same way. The rule must not outlive the main window: -- it is dropped as soon as that has opened (or after a minute if none came), -- so opening WowUp yourself right after login lands on your workspace like any -- other window. local wowup_rule = hl.window_rule({ name = "startup-wowup", match = { class = "(?i)^wowupcf$" }, workspace = "special:autostart silent", }) local wowup_pending = true local function wowup_done() wowup_pending = false wowup_rule:set_enabled(false) end hl.on("window.open", function(window) if wowup_pending and window.class:lower() == "wowupcf" then if window.title ~= "" and window.title ~= "WowUpCf" then wowup_done() end -- closing it from inside the open event is too early and gets ignored local address = window.address hl.timer(function() hl.dispatch(hl.dsp.window.close({ window = "address:" .. address })) end, { timeout = 300, type = "oneshot" }) end end) hl.timer(wowup_done, { timeout = 60000, type = "oneshot" }) -- hl.exec_cmd("gsettings set org.gnome.desktop.interface color-scheme prefer-dark") -- hl.exec_cmd("gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark") end)