refactor(waybar): use bar margin

This commit is contained in:
2026-10-11 20:19:36 -04:00
parent 8edf330a06
commit a5846a6c1c
3 changed files with 3 additions and 24 deletions

View File

@@ -53,11 +53,6 @@ in
registry.waybar.${config.networking.hostName}."custom/dnd" = {
order = 80;
style = ''
#custom-dnd {
margin-right: 8px;
}
'';
settings = {
return-type = "json";
exec = "${dndStatus}";

View File

@@ -7,12 +7,6 @@
}:
# Waybar: a top status bar reading system state at a glance.
let
registeredWaybarStyles = lib.concatStringsSep "\n" (
lib.filter (style: style != "") (lib.mapAttrsToList (_name: module: module.style) hostWaybarModules)
);
hostWaybarModules = lib.attrByPath [ config.networking.hostName ] { } config.registry.waybar;
waybarModulesFor =
position:
map (module: module.name) (
@@ -29,6 +23,8 @@ let
}
) hostWaybarModules;
hostWaybarModules = lib.attrByPath [ config.networking.hostName ] { } config.registry.waybar;
registeredWaybarModuleSettings = lib.mapAttrs (_name: module: module.settings) hostWaybarModules;
networkStatus = pkgs.writeShellScript "waybar-network-status" ''
@@ -79,19 +75,13 @@ in
# so the bar comes up with the session and no compositor exec-once.
systemd.enable = true;
style = ''
.modules-right {
margin-right: 8px;
}
''
+ registeredWaybarStyles;
settings.mainBar = lib.mkMerge [
{
layer = "top";
position = "top";
height = 30;
spacing = 8;
margin-right = 8;
modules-left = waybarModulesFor "left";
modules-center = waybarModulesFor "center";

View File

@@ -19,12 +19,6 @@
description = "Sorts the module within its Waybar section.";
};
style = lib.mkOption {
type = lib.types.lines;
default = "";
description = "Adds CSS for the Waybar module.";
};
settings = lib.mkOption {
type = lib.types.attrsOf lib.types.anything;
default = { };