Nomarchy's Hyprland/Ghostty/Waybar settings were set at normal priority, so a downstream `home.nix` setting any value Nomarchy already set threw a "conflicting definition values" error — overriding required lib.mkForce, contradicting the README's "mkDefault throughout" claim. Now: behaviour/chrome leaves (input, misc, monitor, animations, dwindle, gesture, decoration.blur sizing, ghostty padding/decoration, waybar settings+style) are lib.mkDefault — a plain home.nix assignment wins. Appearance values that flow from theme-state.json (gaps, colors, rounding, opacity, fonts) stay at normal priority on purpose: change them via nomarchy-theme-sync (their source of truth) or lib.mkForce to hardcode. bind/exec-once lists stay normal priority so additions concatenate rather than replace. Verified: behaviour/ghostty plain overrides build; theme values still conflict (steering to the CLI); default rendered config is byte-identical. New docs/OVERRIDES.md with the appearance→CLI / behaviour→home.nix / component→toggle model and worked examples; linked from the README. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
166 lines
4.5 KiB
Nix
166 lines
4.5 KiB
Nix
# Waybar — two-tier theming:
|
|
#
|
|
# 1. Default: structure, fonts, geometry AND palette baked from
|
|
# theme-state.json (colors as GTK named colors, @define-color).
|
|
#
|
|
# 2. Whole-swap: themes with their own visual identity ship
|
|
# <themesDir>/<slug>/waybar.css (and optionally waybar.jsonc) which
|
|
# replace the generated style/layout entirely. Probed at eval time —
|
|
# pure, it's flake source.
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
t = config.nomarchy.theme;
|
|
|
|
# Per-theme override probe.
|
|
assetDir = config.nomarchy.themesDir + "/${t.slug}";
|
|
styleOverride = assetDir + "/waybar.css";
|
|
configOverride = assetDir + "/waybar.jsonc";
|
|
hasStyleOverride = builtins.pathExists styleOverride;
|
|
hasConfigOverride = builtins.pathExists configOverride;
|
|
|
|
# The palette as GTK named colors, straight from the JSON.
|
|
colorDefs = lib.concatStringsSep "\n"
|
|
(lib.mapAttrsToList (name: value: "@define-color ${name} ${value};") t.colors);
|
|
|
|
generatedSettings = {
|
|
layer = "top";
|
|
position = "top";
|
|
height = 34;
|
|
margin-top = t.ui.gapsOut;
|
|
margin-left = t.ui.gapsOut;
|
|
margin-right = t.ui.gapsOut;
|
|
spacing = 8;
|
|
|
|
# waybar re-reads style.css when it changes on disk, so a
|
|
# home-manager switch restyles the running bar without a restart.
|
|
reload_style_on_change = true;
|
|
|
|
modules-left = [ "hyprland/workspaces" "hyprland/window" ];
|
|
modules-center = [ "clock" ];
|
|
modules-right = [ "tray" "pulseaudio" "network" "cpu" "memory" "battery" ];
|
|
|
|
"hyprland/workspaces" = {
|
|
format = "{icon}";
|
|
on-click = "activate";
|
|
};
|
|
|
|
"hyprland/window" = {
|
|
max-length = 48;
|
|
separate-outputs = true;
|
|
};
|
|
|
|
clock = {
|
|
format = "{:%H:%M}";
|
|
format-alt = "{:%A %d %B %Y}";
|
|
tooltip-format = "<tt><small>{calendar}</small></tt>";
|
|
};
|
|
|
|
pulseaudio = {
|
|
format = "{icon} {volume}%";
|
|
format-muted = "";
|
|
format-icons.default = [ "" "" "" ];
|
|
on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
|
|
};
|
|
|
|
network = {
|
|
format-wifi = " {essid}";
|
|
format-ethernet = "";
|
|
format-disconnected = "";
|
|
tooltip-format = "{ipaddr} via {gwaddr}";
|
|
# nm-applet sits in the tray for the GUI path; this is the
|
|
# keyboard-friendly one.
|
|
on-click = "${config.nomarchy.terminal} -e nmtui";
|
|
};
|
|
|
|
cpu.format = " {usage}%";
|
|
memory.format = " {percentage}%";
|
|
|
|
battery = {
|
|
states = { warning = 25; critical = 10; };
|
|
format = "{icon} {capacity}%";
|
|
format-charging = " {capacity}%";
|
|
format-icons = [ "" "" "" "" "" ];
|
|
};
|
|
|
|
tray.spacing = 8;
|
|
};
|
|
|
|
generatedStyle = ''
|
|
/* Palette baked from theme-state.json */
|
|
${colorDefs}
|
|
|
|
* {
|
|
font-family: "${t.fonts.ui}", "${t.fonts.mono}";
|
|
font-size: ${toString t.fonts.size}pt;
|
|
min-height: 0;
|
|
}
|
|
|
|
window#waybar {
|
|
background: alpha(@base, 0.85);
|
|
color: @text;
|
|
border: ${toString t.ui.borderSize}px solid alpha(@accent, 0.4);
|
|
border-radius: ${toString t.ui.rounding}px;
|
|
}
|
|
|
|
#workspaces button {
|
|
padding: 0 8px;
|
|
color: @muted;
|
|
border-radius: ${toString t.ui.rounding}px;
|
|
}
|
|
|
|
#workspaces button.active {
|
|
color: @base;
|
|
background: @accent;
|
|
}
|
|
|
|
#workspaces button.urgent {
|
|
color: @base;
|
|
background: @bad;
|
|
}
|
|
|
|
#window {
|
|
color: @subtext;
|
|
padding: 0 12px;
|
|
}
|
|
|
|
#clock {
|
|
color: @text;
|
|
font-weight: bold;
|
|
}
|
|
|
|
#tray, #pulseaudio, #network, #cpu, #memory, #battery {
|
|
color: @subtext;
|
|
padding: 0 10px;
|
|
}
|
|
|
|
#pulseaudio.muted { color: @muted; }
|
|
#battery.warning { color: @warn; }
|
|
#battery.critical { color: @bad; }
|
|
#battery.charging { color: @good; }
|
|
'';
|
|
in
|
|
{
|
|
programs.waybar = lib.mkIf config.nomarchy.waybar.enable {
|
|
enable = true;
|
|
systemd.enable = true; # started/stopped with graphical-session.target
|
|
|
|
# mkDefault so downstream can replace the whole bar config/style with
|
|
# a plain home.nix assignment. For per-theme identity, prefer the
|
|
# whole-swap assets (themes/<slug>/waybar.{jsonc,css}); for one-off
|
|
# tweaks of the generated bar, lib.mkForce a sub-key. See
|
|
# docs/OVERRIDES.md.
|
|
settings.mainBar = lib.mkDefault (
|
|
if hasConfigOverride
|
|
then builtins.fromJSON (builtins.readFile configOverride)
|
|
else generatedSettings
|
|
);
|
|
|
|
style = lib.mkDefault (
|
|
if hasStyleOverride
|
|
then builtins.readFile styleOverride
|
|
else generatedStyle
|
|
);
|
|
};
|
|
}
|