From b579577978ceacbde9e9fb41a3b80e2b13035181 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Thu, 15 Feb 2024 18:48:18 +0100 Subject: [PATCH] make polybar capable of multiple batteries --- modules/desktop/polybar.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/desktop/polybar.nix b/modules/desktop/polybar.nix index a01189c..b822dd8 100644 --- a/modules/desktop/polybar.nix +++ b/modules/desktop/polybar.nix @@ -39,7 +39,7 @@ separator-foreground = "\${colors.disabled}"; font-0 = "FiraCode Nerd Font"; modules-left = "xworkspaces xwindow"; - modules-right = "memory cpu wlan battery"; + modules-right = "memory cpu wlan bat0 bat1"; cursor-click = "pointer"; cursor-scroll = "ns-resize"; enable-ipc = true; @@ -103,12 +103,9 @@ interface-type = "wireless"; label-connected = "%{F#F0C674}%{F-} %local_ip%"; }; - - "module/battery" = { + "battery-base" = { type = "internal/battery"; poll-interval = 1; - battery = "BAT0"; - adapter = "ADP1"; time-format = "%H%{F#7c6f64}:%{F#d5c4a1}%M"; label-charging = "%{F#98971a}󰚥 %{F#ebdbb2}%percentage%%%{F#d5c4a1} %time%"; format-charging = " "; @@ -131,6 +128,16 @@ "%{F#98971a}󰁹" ]; }; + "module/bat0" = { + "inherit" = "battery-base"; + battery = "BAT0"; + adapter = "ADP1"; + }; + "module/bat1" = { + "inherit" = "battery-base"; + battery = "BAT1"; + adapter = "ADP1"; + }; "settings" = { screenchange-reload = true;