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.
54 lines
1.9 KiB
Nix
54 lines
1.9 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
activeTheme = config.nomarchy.theme;
|
|
|
|
# Path to local theme files
|
|
themeDir = ./themes + "/${activeTheme}";
|
|
hasThemeConfig = builtins.pathExists (themeDir + "/config.jsonc");
|
|
hasThemeStyle = builtins.pathExists (themeDir + "/style.css");
|
|
|
|
# Default fallback files
|
|
defaultConfig = ./config/config.jsonc;
|
|
defaultStyle = ./config/style.css;
|
|
|
|
# Selected files
|
|
configFile = if hasThemeConfig then (themeDir + "/config.jsonc") else defaultConfig;
|
|
styleFile = if hasThemeStyle then (themeDir + "/style.css") else defaultStyle;
|
|
|
|
rawSettings = builtins.fromJSON (builtins.readFile configFile);
|
|
|
|
# Modules that only make sense on a laptop. Filtered out of any
|
|
# `modules-*` slot when nomarchy.formFactor != "laptop" so a desktop
|
|
# build doesn't ship a permanently-empty battery indicator.
|
|
laptopOnlyModules = [ "battery" "custom/battery" ];
|
|
filterModules = mods:
|
|
if config.nomarchy.formFactor == "laptop"
|
|
then mods
|
|
else builtins.filter (m: !(builtins.elem m laptopOnlyModules)) mods;
|
|
|
|
settings = rawSettings // {
|
|
position = config.nomarchy.panelPosition;
|
|
modules-left = filterModules (rawSettings.modules-left or []);
|
|
modules-center = filterModules (rawSettings.modules-center or []);
|
|
modules-right = filterModules (rawSettings.modules-right or []);
|
|
};
|
|
|
|
in
|
|
{
|
|
programs.waybar = {
|
|
# 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);
|
|
};
|
|
|
|
home.packages = lib.mkDefault (with pkgs; [
|
|
font-awesome
|
|
]);
|
|
}
|