From a7a042dd66ba25522c4589b76c3a70d0ff5a831c Mon Sep 17 00:00:00 2001 From: "Reid \"reidlab" Date: Tue, 14 May 2024 18:56:52 -0700 Subject: [PATCH] add battery to waybar --- config/waybar.css | 16 ++++++++++++++++ modules/desktop/waybar.nix | 14 ++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/config/waybar.css b/config/waybar.css index d739333..68d1fb5 100644 --- a/config/waybar.css +++ b/config/waybar.css @@ -83,6 +83,22 @@ window#waybar.floating #window { color: @teal; } +#battery { + color: @green; +} + +#battery.charging { + color: @green; +} + +#battery.warning:not(.charging) { + color: @peach; +} + +#battery.critical:not(.charging) { + color: @maroon; +} + #pulseaudio { color: @pink; } diff --git a/modules/desktop/waybar.nix b/modules/desktop/waybar.nix index e1eb147..0e619e8 100644 --- a/modules/desktop/waybar.nix +++ b/modules/desktop/waybar.nix @@ -52,6 +52,7 @@ in { "cpu" "memory" "power-profiles-daemon" + "battery" #"network" ]; }; @@ -166,6 +167,19 @@ in { format = " {percentage}%"; tooltip-format = "{used:0.1f}GiB/{avail:0.1f}GiB used\n{swapUsed:0.1f}GiB/{swapAvail:0.1f}GiB swap"; }; + battery = { + interval = 30; + states = { + warning = 20; + critical = 10; + }; + full-at = 98; + format = "{icon} {capacity}%"; + format-icons = ["" "" "" "" ""]; + format-critical = " {capacity}%"; + tooltip-format = "{timeTo} ({power}W)"; + format-charging = " {capacity}%"; + }; clock = { format = "{:%H:%M}"; format-alt = "{:%a %b %d %R}";