From 1a9417c90cf79c3dd74a510b8bc43135e36f752f Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 18 Nov 2018 21:39:42 +0000 Subject: [PATCH] Add battery stats to polybar --- files/polybar.ini | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/files/polybar.ini b/files/polybar.ini index 009e324..46573c3 100644 --- a/files/polybar.ini +++ b/files/polybar.ini @@ -23,7 +23,7 @@ font-1 = "FontAwesome5FreeSolid:size=8;2" modules-left = i3 xwindow modules-center = date -modules-right = player_mpris_tail memory cpu pulseaudio power-menu +modules-right = player_mpris_tail memory cpu pulseaudio {% if ansible_fqdn == "TOO-Laptop" %}wattage battery{% endif %} power-menu module-margin = 2 @@ -112,3 +112,31 @@ menu-0-1 = Restart menu-0-1-foreground = #0F0 label-separator = " | " expand-right = false + +[module/battery] +type = internal/battery +full-at = 100 +poll-interval = 1 +time-format = %H:%M +ramp-capacity-0 =  +ramp-capacity-1 =  +ramp-capacity-2 =  +ramp-capacity-3 =  +ramp-capacity-4 =  +animation-charging-framerate = 500 +animation-charging-0 = ${self.ramp-capacity-0} +animation-charging-1 = ${self.ramp-capacity-1} +animation-charging-2 = ${self.ramp-capacity-2} +animation-charging-3 = ${self.ramp-capacity-3} +animation-charging-4 = ${self.ramp-capacity-4} +animation-discharging-framerate = ${self.animation-charging-framerate} +format-charging = +format-discharging = +label-discharging = %percentage%% (%time%) + +[module/wattage] +type = internal/battery +full-at = ${module/battery.full-at} +label-discharging =  %consumption%W +label-charging =  %consumption%W +poll-interval = ${module/battery.poll-interval}