From 47a4bf5c092a70095a250eed0372835221905067 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Sat, 25 Jul 2026 14:46:01 +0530 Subject: feat(waybar): color icons with base16, refactor modules, polish bar styling - Color individual module icons with base16 palette via iconColor param - Refactor vpn module into writeShellScript for Pango markup support - Switch window module from max-length to expand, fix-center to false - Add persistent-workspaces to reserve workspaces across monitor changes - Overhaul waybar CSS: borders, padding, hover/active workspace states - Change memory display from {usedGb} GB to {percentage}% --- modules/desktop/waybar/module/battery.nix | 8 +++--- modules/desktop/waybar/module/cpu.nix | 4 +-- modules/desktop/waybar/module/date.nix | 4 +-- modules/desktop/waybar/module/default.nix | 41 ++++++++++++++++++++++------ modules/desktop/waybar/module/memory.nix | 4 +-- modules/desktop/waybar/module/network.nix | 6 ++-- modules/desktop/waybar/module/time.nix | 4 +-- modules/desktop/waybar/module/volume.nix | 6 ++-- modules/desktop/waybar/module/vpn.nix | 10 ++++++- modules/desktop/waybar/module/window.nix | 2 +- modules/desktop/waybar/module/workspaces.nix | 3 ++ 11 files changed, 64 insertions(+), 28 deletions(-) (limited to 'modules/desktop/waybar/module') diff --git a/modules/desktop/waybar/module/battery.nix b/modules/desktop/waybar/module/battery.nix index bf3527c..ec14b8b 100644 --- a/modules/desktop/waybar/module/battery.nix +++ b/modules/desktop/waybar/module/battery.nix @@ -1,9 +1,9 @@ -{ config }: +{ config, iconColor }: with config.scheme.withHashtag; { - format = "{icon} {capacity}%"; - format-charging = "󰂄 {capacity}%"; - format-plugged = "󰁹 {capacity}%"; + format = "{icon} {capacity}%"; + format-charging = "󰂄 {capacity}%"; + format-plugged = "󰁹 {capacity}%"; format-alt = "{time} {icon}"; format-icons = [ "󰁺" diff --git a/modules/desktop/waybar/module/cpu.nix b/modules/desktop/waybar/module/cpu.nix index 06f5af6..cde77e6 100644 --- a/modules/desktop/waybar/module/cpu.nix +++ b/modules/desktop/waybar/module/cpu.nix @@ -1,6 +1,6 @@ -{ config }: +{ config, iconColor }: with config.scheme.withHashtag; { - format = " {usage}%"; + format = " {usage}%"; interval = 2; } diff --git a/modules/desktop/waybar/module/date.nix b/modules/desktop/waybar/module/date.nix index efdccc4..39716db 100644 --- a/modules/desktop/waybar/module/date.nix +++ b/modules/desktop/waybar/module/date.nix @@ -1,6 +1,6 @@ -{ config }: +{ config, iconColor }: with config.scheme.withHashtag; { - format = " {:%d/%m/%Y}"; + format = " {:%d/%m/%Y}"; interval = 60; } diff --git a/modules/desktop/waybar/module/default.nix b/modules/desktop/waybar/module/default.nix index 2fa6ef8..628b534 100644 --- a/modules/desktop/waybar/module/default.nix +++ b/modules/desktop/waybar/module/default.nix @@ -3,17 +3,42 @@ lib, pkgs, }: +with config.scheme.withHashtag; { mainBar = { "hyprland/workspaces" = import ./workspaces.nix { inherit config; }; "hyprland/window" = import ./window.nix { inherit config; }; - "pulseaudio" = import ./volume.nix { inherit config; }; - "battery" = import ./battery.nix { inherit config; }; - "custom/vpn" = import ./vpn.nix { inherit config lib pkgs; }; - "network" = import ./network.nix { inherit config; }; - "clock#time" = import ./time.nix { inherit config; }; - "memory" = import ./memory.nix { inherit config; }; - "cpu" = import ./cpu.nix { inherit config; }; - "clock#date" = import ./date.nix { inherit config; }; + "pulseaudio" = import ./volume.nix { + inherit config; + iconColor = base0A; + }; + "battery" = import ./battery.nix { + inherit config; + iconColor = base09; + }; + "custom/vpn" = import ./vpn.nix { + inherit config lib pkgs; + iconColor = base0C; + }; + "network" = import ./network.nix { + inherit config; + iconColor = base0B; + }; + "clock#time" = import ./time.nix { + inherit config; + iconColor = base08; + }; + "memory" = import ./memory.nix { + inherit config; + iconColor = base0F; + }; + "cpu" = import ./cpu.nix { + inherit config; + iconColor = base0D; + }; + "clock#date" = import ./date.nix { + inherit config; + iconColor = base0E; + }; }; } diff --git a/modules/desktop/waybar/module/memory.nix b/modules/desktop/waybar/module/memory.nix index b9a45a4..27b66e0 100644 --- a/modules/desktop/waybar/module/memory.nix +++ b/modules/desktop/waybar/module/memory.nix @@ -1,6 +1,6 @@ -{ config }: +{ config, iconColor }: with config.scheme.withHashtag; { - format = " {usedGb} GB"; + format = " {percentage}%"; interval = 2; } diff --git a/modules/desktop/waybar/module/network.nix b/modules/desktop/waybar/module/network.nix index e1036ed..4e14d69 100644 --- a/modules/desktop/waybar/module/network.nix +++ b/modules/desktop/waybar/module/network.nix @@ -1,8 +1,8 @@ -{ config }: +{ config, iconColor }: with config.scheme.withHashtag; { - format-wifi = "{icon} {signalStrength}%"; - format-ethernet = " {ipaddr}"; + format-wifi = "{icon} {signalStrength}%"; + format-ethernet = " {ipaddr}"; format-disconnected = ""; tooltip-format = "{ifname}"; tooltip-format-wifi = "{essid} ({signalStrength}%)"; diff --git a/modules/desktop/waybar/module/time.nix b/modules/desktop/waybar/module/time.nix index e097c9c..f7c578d 100644 --- a/modules/desktop/waybar/module/time.nix +++ b/modules/desktop/waybar/module/time.nix @@ -1,6 +1,6 @@ -{ config }: +{ config, iconColor }: with config.scheme.withHashtag; { - format = " {:%I:%M %p}"; + format = " {:%I:%M %p}"; interval = 30; } diff --git a/modules/desktop/waybar/module/volume.nix b/modules/desktop/waybar/module/volume.nix index ee3f2f3..cc074a7 100644 --- a/modules/desktop/waybar/module/volume.nix +++ b/modules/desktop/waybar/module/volume.nix @@ -1,8 +1,8 @@ -{ config }: +{ config, iconColor }: with config.scheme.withHashtag; { - format = "{icon} {volume}%"; - format-muted = "󰻨"; + format = "{icon} {volume}%"; + format-muted = "󰝟"; format-icons = [ "" "" diff --git a/modules/desktop/waybar/module/vpn.nix b/modules/desktop/waybar/module/vpn.nix index 04366e1..bb0a242 100644 --- a/modules/desktop/waybar/module/vpn.nix +++ b/modules/desktop/waybar/module/vpn.nix @@ -2,10 +2,18 @@ config, lib, pkgs, + iconColor, }: with config.scheme.withHashtag; +let + vpnCheckScript = pkgs.writeShellScript "vpn-check" '' + if ${lib.getExe' pkgs.iproute2 "ip"} a | ${lib.getExe pkgs.gnugrep} -q tun0; then + printf ' VPN' + fi + ''; +in { - exec = "${pkgs.runtimeShell} -c '${lib.getExe' pkgs.iproute2 "ip"} a | ${lib.getExe pkgs.gnugrep} -q tun0 && printf \" VPN\"'"; + exec = "${vpnCheckScript}"; interval = 5; format = "{}"; } diff --git a/modules/desktop/waybar/module/window.nix b/modules/desktop/waybar/module/window.nix index c4e54c3..0e708c2 100644 --- a/modules/desktop/waybar/module/window.nix +++ b/modules/desktop/waybar/module/window.nix @@ -1,5 +1,5 @@ { config }: with config.scheme.withHashtag; { - max-length = 20; + expand = true; } diff --git a/modules/desktop/waybar/module/workspaces.nix b/modules/desktop/waybar/module/workspaces.nix index bb5a6ee..d2b0290 100644 --- a/modules/desktop/waybar/module/workspaces.nix +++ b/modules/desktop/waybar/module/workspaces.nix @@ -2,5 +2,8 @@ with config.scheme.withHashtag; { format = "{name}"; + persistent-workspaces = { + "*" = 10; + }; on-click = "hyprctl dispatch workspace {name}"; } -- cgit v1.2.3