refactor(desktop): drop the moonarch rewrites, gtklock is named at the source
moonarch 4f36035 names gtklock itself now, in stasis.rune and in PowerPopout.qml, so the two substitute derivations that were rewriting them at deploy time have nothing left to do. stasisConfig, quickshellConfig, lockCommand and lockArgv go; both consumers read moonarch's tree directly again. gtklockConfig stays generated rather than copied. moonarch ships defaults/xdg/gtklock/config.ini, but it names /usr/share/moonarch for the background and resolves the modules by bare name against /usr/lib/gtklock. Both are store paths here, so the file is built rather than deployed — the same reason PipeWire's config takes its own route. NOT SELF-CONTAINED: flake.lock still pins moonarch from before 4f36035, and that revision still says swaylock. Until the lock is bumped, a plain `nixos-rebuild switch` deploys configs naming a locker that is no longer installed, and stasis fails silently on a missing binary. Build with `--override-input moonarch ~/Projects/moonarch` until then, or bump first. Committed at Dominik's request ahead of the push that makes the bump possible. Verified with --override-input: both hosts build, the seeded stasis.rune and the deployed PowerPopout.qml come straight from moonarch and name gtklock, and the generated config.ini carries the blurred wallpaper and both module store paths.
This commit is contained in:
1 parent
a419a17e08
commit
3d67eb7bbf
1 file changed
+8
-58
+8
-58
@@ -55,58 +55,6 @@ let
|
||||
"${pkgs.gtklock-powerbar-module}/lib/gtklock/powerbar-module.so"
|
||||
];
|
||||
|
||||
# Both moonarch configs below still spawn swaylock, and each spawns it
|
||||
# itself rather than asking anything to lock: there is no Wayland protocol
|
||||
# for "lock the session" — ext-session-lock-v1 is how a client *becomes* the
|
||||
# lock — and no portal either. logind's Session.Lock only emits a signal that
|
||||
# something has to be subscribed to, and nothing here is: niri owns
|
||||
# org.freedesktop.ScreenSaver with Inhibit/UnInhibit and no Lock, and stasis
|
||||
# deliberately ignores the signal (its services/dbus.rs: "login1's
|
||||
# Lock/Unlock signals are requests, not completed state changes"). So the
|
||||
# command is duplicated, and the two rewrites take it from here.
|
||||
#
|
||||
# Routing the popout through `stasis trigger lock-screen` instead would put
|
||||
# the name in one place, and was rejected: the button would then do nothing,
|
||||
# silently, whenever stasis is down. The plan keeps running after a manual
|
||||
# lock either way — stasis picks the state up from logind's LockedHint
|
||||
# (LockSource::LockedHint in its core/events.rs), so DPMS and suspend still
|
||||
# follow a lock it did not start. Verified by locking by hand and watching
|
||||
# DPMS fire on schedule.
|
||||
#
|
||||
# `-d` is gtklock's detach flag, the counterpart of `swaylock -f`, but not
|
||||
# quite the same promise: swaylock forks once the screen is locked, gtklock
|
||||
# forks in main() before it has even read its config (source.c:284). A
|
||||
# returned `gtklock -d` therefore means "forked", not "locked". Nothing here
|
||||
# chains off the exit, so it does not matter — it would if something ever
|
||||
# wanted to suspend only after the screen is actually covered.
|
||||
lockCommand = "gtklock -d";
|
||||
|
||||
# stasis names the locker in four places. Its config is seeded into the home
|
||||
# directory below rather than read from /etc, so the rewrite has to happen
|
||||
# here. Drops out once moonarch names gtklock itself.
|
||||
stasisConfig = pkgs.runCommand "stasis.rune" { } ''
|
||||
substitute ${xdg}/stasis/stasis.rune "$out" \
|
||||
--replace-fail 'swaylock -f' '${lockCommand}' \
|
||||
--replace-warn '"swaylock"' '"gtklock"' \
|
||||
--replace-warn 'Niri + swaylock' 'Niri + gtklock'
|
||||
'';
|
||||
|
||||
# The power popout spawns the locker as an argv array (PowerPopout.qml).
|
||||
# Unlike the stasis config this is deployed as a whole directory, so the
|
||||
# rewrite copies the tree and patches the one file. Drops out together with
|
||||
# stasisConfig once moonarch names gtklock.
|
||||
quickshellConfig = pkgs.runCommand "quickshell-moonarch" { } ''
|
||||
cp -r ${xdg}/quickshell/moonarch "$out"
|
||||
chmod -R u+w "$out"
|
||||
substituteInPlace "$out/PowerPopout.qml" \
|
||||
--replace-fail '["swaylock", "-f"]' '[${lockArgv}]' \
|
||||
--replace-warn '`swaylock -f` daemonises itself' '`${lockCommand}` daemonises itself'
|
||||
'';
|
||||
|
||||
# The same command as a QML string array: ["gtklock", "-d"].
|
||||
lockArgv = lib.concatMapStringsSep ", " (a: ''"${a}"'')
|
||||
(lib.splitString " " lockCommand);
|
||||
|
||||
# The GTK theme name, in the one place both consumers below read it from.
|
||||
gtkTheme = "catppuccin-mocha-lavender-standard";
|
||||
|
||||
@@ -115,7 +63,7 @@ let
|
||||
# GSettings, which on Wayland is not the GTK3 ones. A stale name there would
|
||||
# therefore put every GTK3 application on Adwaita rather than on the theme
|
||||
# actually installed. Rewritten here until moonarch switches too, the same
|
||||
# treatment waypaper and the stasis config get above.
|
||||
# treatment waypaper gets above.
|
||||
gtkSettings = version: pkgs.runCommand "gtk${version}-settings.ini" { } ''
|
||||
substitute ${xdg}/gtk-${version}/settings.ini "$out" \
|
||||
--replace-fail Colloid-Grey-Dark-Catppuccin ${gtkTheme}
|
||||
@@ -189,14 +137,16 @@ in
|
||||
# moonarch's tree and with any user config that includes it.
|
||||
"niri/config.kdl".source = "${xdg}/niri/config.kdl";
|
||||
"xdg/niri/config.kdl".source = "${xdg}/niri/config.kdl";
|
||||
"xdg/quickshell/moonarch".source = quickshellConfig;
|
||||
"xdg/quickshell/moonarch".source = "${xdg}/quickshell/moonarch";
|
||||
"xdg/foot/foot.ini".source = "${xdg}/foot/foot.ini";
|
||||
"xdg/fastfetch/config.jsonc".source = "${xdg}/fastfetch/config.jsonc";
|
||||
"xdg/Kvantum/kvantum.kvconfig".source = "${xdg}/Kvantum/kvantum.kvconfig";
|
||||
"xdg/qt6ct/qt6ct.conf".source = "${xdg}/qt6ct/qt6ct.conf";
|
||||
# Not in moonarch's tree: gtklock arrived here first, and its config is
|
||||
# generated rather than copied because both the background and the module
|
||||
# paths are store paths.
|
||||
# moonarch ships defaults/xdg/gtklock/config.ini, but it is not deployed
|
||||
# here: it names /usr/share/moonarch for the background and resolves the
|
||||
# modules by bare name against /usr/lib/gtklock. Both are store paths under
|
||||
# Nix, so the file is generated above rather than copied — the same reason
|
||||
# PipeWire's config takes its own route.
|
||||
"xdg/gtklock/config.ini".source = gtklockConfig;
|
||||
"xdg/gtk-3.0/settings.ini".source = gtkSettings "3.0";
|
||||
"xdg/gtk-4.0/settings.ini".source = gtkSettings "4.0";
|
||||
@@ -529,7 +479,7 @@ in
|
||||
"C %h/.config/waypaper/config.ini 0644 - - - ${waypaperConfig}"
|
||||
# stasis prefers the user config over /etc and generates its own if none
|
||||
# exists, so the moonarch config has to be in place before it starts.
|
||||
"C %h/.config/stasis/stasis.rune 0644 - - - ${stasisConfig}"
|
||||
"C %h/.config/stasis/stasis.rune 0644 - - - ${xdg}/stasis/stasis.rune"
|
||||
# No gtklock entry: it reads /etc/xdg, which swaylock could not.
|
||||
# nwg-displays needs this file to exist before it will start, and niri would
|
||||
# otherwise ignore the monitor.kdl it writes next to it.
|
||||
|
||||
Reference in new issue
Block a user