From 8e5ac13e944311d363a425cdfbffe16f5eb3c445 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Fri, 29 Aug 2025 22:57:27 +0200 Subject: [PATCH] feat(waybar): rework theme and configuration --- .../sway/includes/files/waybar-style.css | 119 +++++++++++++++ .../desktop/sway/includes/waybar.nix | 141 ++---------------- 2 files changed, 135 insertions(+), 125 deletions(-) create mode 100644 modules/home-manager/desktop/sway/includes/files/waybar-style.css diff --git a/modules/home-manager/desktop/sway/includes/files/waybar-style.css b/modules/home-manager/desktop/sway/includes/files/waybar-style.css new file mode 100644 index 0000000..ffc4be3 --- /dev/null +++ b/modules/home-manager/desktop/sway/includes/files/waybar-style.css @@ -0,0 +1,119 @@ +@define-color color-base-bg #323232; +@define-color color-base-fg #ddd; + +@define-color color-hover #f268b3; +@define-color color-selected #1cd180; + +@define-color color-ok #1cd180; +@define-color color-warning #f2b768; +@define-color color-critical #f268b3; + +* { + border: none; + border-radius: 0; + min-height:0; +} + +window#waybar { + background: @color-base-bg ; + color: @color-base-fg; + font-family: "Fira Code Nerd Font"; + font-size: 12px; +} + +button, +button:disabled,label:disabled{ + color:inherit; +} + +button:hover{ + background:none; + box-shadow:inherit; + box-shadow:inherit; + text-shadow:inherit; + text-shadow:inherit; + border-top:none; +} +#workspaces { + color:#fff; +} +#workspaces button { + margin:0 3px; + padding:4px 4px; + color:#9c9c9c; + border-bottom: 1px solid transparent; +} + +#workspaces button:hover { + box-shadow:inherit; + text-shadow:inherit; + color: @color-hover; + border-bottom: 1px solid @color-hover; +} + +#workspaces button.focused { + background: @color-selected; + color: @color-base-bg; +} +#workspaces button.visible:not(.focused) { + color: @color-selected; + border-color: @color-selected; +} + +#clock, +#cpu, +#memory, +#backlight, +#network, +#tray, +#mode, +#battery, +#idle_inhibitor { + padding: 2px 4px; + margin: 0; + background-color: transparent; +} + +#mode{ + background:@color-warning; + color: @color-base-bg; + font-weight:200; + font-variant: small-caps; + font-size: 16px; +} +#pulseaudio {} +#pulseaudio.output.muted { + color:@color-critical; +} +#pulseaudio.input.source-muted { + color:@color-critical; +} + +#battery.discharging { + color: @color-base-fg; + border-bottom: none; +} + +#battery.charging, #battery.plugged { + border-bottom: 1px solid @color-ok; + color: @color-selected; +} + +#battery.critical:not(.charging), +#cpu.critical, +#memory.critical{ + border-color: @color-critical; + color: @color-critical; +} + +#battery.warning:not(.charging), +#cpu.warning, +#memory.warning{ + border-color: @color-warning; + color: @color-warning; +} + +#tray { + font-family: "DejaVu sans"; + font-size: 12px; +} diff --git a/modules/home-manager/desktop/sway/includes/waybar.nix b/modules/home-manager/desktop/sway/includes/waybar.nix index d46baf1..f9c2e6a 100644 --- a/modules/home-manager/desktop/sway/includes/waybar.nix +++ b/modules/home-manager/desktop/sway/includes/waybar.nix @@ -48,7 +48,8 @@ in ] ) ++ [ - "pulseaudio" + "pulseaudio#input" + "pulseaudio#output" "custom/sep" "clock" "custom/sep" @@ -88,27 +89,31 @@ in }; }; "network" = { - "format-alt" = "{ifname}: {ipaddr}/{cidr}"; + "format-alt" = "{ifname}: {ipaddr}/{cidr} 󰈀"; "format-disconnected" = "Disconnected ⚠ "; - "format-ethernet" = "{ifname}: {ipaddr}/{cidr} 󰈀 "; - "format-linked" = "{ifname} (No IP) 󰈀 "; - "format-wifi" = "{essid} ({signalStrength}%)  "; + "format-ethernet" = "{ifname} 󰈀"; + "format-linked" = "{ifname} (No IP) 󰈀"; + "format-wifi" = "{essid} ({signalStrength}%) "; "tooltip" = false; }; - "pulseaudio" = { - "format" = "{format_source} {volume}% {icon} "; + "pulseaudio#output" = { + "format" = "{volume}% {icon} "; "format-bluetooth" = "{volume}% {icon}"; "format-icons" = { "car" = ""; - "default" = ""; + "default" = "󰕾"; "hands-free" = "󰋎"; "headphone" = "󰋋"; "headset" = "󰋎"; "phone" = ""; "portable" = ""; }; - "format-muted" = "{format_source} 󰝟 "; - "format-source" = "{volume}%  "; + "format-muted" = "󰖁 "; + "tooltip" = false; + }; + "pulseaudio#input" = { + "format" = "{format_source} "; + "format-source" = "{volume}% "; "format-source-muted" = " "; "tooltip" = false; }; @@ -170,121 +175,7 @@ in }; }; }; - style = '' - @define-color color-base-bg #323232; - @define-color color-base-fg #ddd; - - @define-color color-hover #f268b3; - @define-color color-selected #1cd180; - - @define-color color-ok #1cd180; - @define-color color-warning #f2b768; - @define-color color-critical #f268b3; - - * { - border: none; - border-radius: 0; - min-height:0; - } - - window#waybar { - background: @color-base-bg ; - color: @color-base-fg; - font-family: "Fira Code Nerd Font"; - font-size: 12px; - } - - button, - button:disabled,label:disabled{ - color:inherit; - } - - button:hover{ - background:none; - box-shadow:inherit; - box-shadow:inherit; - text-shadow:inherit; - text-shadow:inherit; - border-top:none; - } - #workspaces { - color:#fff; - } - #workspaces button { - margin:0 3px; - padding:4px 4px; - color:#9c9c9c; - border-bottom: 1px solid transparent; - } - - #workspaces button:hover { - box-shadow:inherit; - text-shadow:inherit; - color: @color-hover; - border-bottom: 1px solid @color-hover; - } - - #workspaces button.focused { - background: @color-selected; - color: @color-base-bg; - } - #workspaces button.visible:not(.focused) { - color: @color-selected; - border-color: @color-selected; - } - - #clock, - #cpu, - #memory, - #backlight, - #network, - #tray, - #mode, - #battery, - #idle_inhibitor { - padding: 2px 4px; - margin: 0; - background-color: transparent; - } - - #mode{ - background:@color-warning; - font-weight:bold; - } - #pulseaudio {} - #pulseaudio.muted { - color:@color-critical; - } - - #battery.discharging { - color: @color-base-fg; - border-bottom: none; - } - - #battery.charging, #battery.plugged { - border-bottom: 1px solid @color-ok; - color: @color-selected; - } - - #battery.critical:not(.charging), - #cpu.critical, - #memory.critical{ - border-color: @color-critical; - color: @color-critical; - } - - #battery.warning:not(.charging), - #cpu.warning, - #memory.warning{ - border-color: @color-warning; - color: @color-warning; - } - - #tray { - font-family: "DejaVu sans"; - font-size: 12px; - } - ''; + style = builtins.readFile ./files/waybar-style.css; }; }; }