fix(waybar): gate enable on toggles.waybar (Nix-level, not session-local)

features/desktop/waybar/default.nix previously set
`programs.waybar.{enable,systemd.enable} = lib.mkDefault true`
unconditionally. The toggle script wrote .waybar to state.json and
pkill/exec'd waybar for instant feedback, but the next rebuild
re-enabled it because the Nix module didn't read the toggle. Result:
the bar came back on every rebuild/reboot regardless of the persisted
state — inconsistent with toggles.idle (gates services.hypridle.enable)
and now toggles.nightlight (gates services.hyprsunset.enable).

programs.waybar.{enable,systemd.enable} now follow
config.nomarchy.toggles.waybar. nomarchy-toggle-waybar flips the
running systemd user unit (`systemctl --user start/stop waybar.service`)
for instant feedback and writes .waybar back to state.json so the next
rebuild realigns. Disabled toggle now means no waybar across rebuilds
+ reboots, matching the option's documented meaning ("Whether the top
bar is enabled").

`nix flake check --no-build` + `bash -n` clean.
This commit is contained in:
Bernardo Magri
2026-05-22 18:23:35 +01:00
parent 161542c420
commit 055832e916
3 changed files with 13 additions and 9 deletions

View File

@@ -37,8 +37,11 @@ let
in
{
programs.waybar = {
enable = lib.mkDefault true;
systemd.enable = lib.mkDefault true;
# Gated on nomarchy.toggles.waybar — symmetric with services.hypridle
# (toggles.idle) and services.hyprsunset (toggles.nightlight). Disabled
# toggle means no waybar unit, so the bar stays hidden across rebuilds.
enable = lib.mkDefault config.nomarchy.toggles.waybar;
systemd.enable = lib.mkDefault config.nomarchy.toggles.waybar;
settings = lib.mkDefault [ settings ];
style = lib.mkDefault (builtins.readFile styleFile);