From 40c90b49605a33e8e4be378ea78ac264e9f9577d Mon Sep 17 00:00:00 2001
From: Vidhu Kant Sharma <vidhukant@vidhukant.xyz>
Date: Tue, 2 Aug 2022 12:25:59 +0530
Subject: added battery module to polybar and removed cbatticon from XMonad
 startup

---
 .config/polybar/config.ini | 37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

(limited to '.config/polybar')

diff --git a/.config/polybar/config.ini b/.config/polybar/config.ini
index 5e4bcb8..2786f49 100644
--- a/.config/polybar/config.ini
+++ b/.config/polybar/config.ini
@@ -76,6 +76,15 @@ vol-fg = ${colors.module-color-0}
 vol-bg = ${colors.module-bg}
 vol-fg-alt = #c32aeb
 
+batt-charging-bg = ${colors.module-bg}
+batt-charging-fg = ${colors.module-color-0}
+
+batt-discharging-bg = ${colors.module-bg}
+batt-discharging-fg = ${colors.module-color-1}
+
+batt-full-bg = ${colors.module-bg}
+batt-full-fg = ${colors.module-color-0}
+
 [bar/mybar]
 ;monitor = ${env:MONITOR:eDP-1-1}
 enable-ipc = true
@@ -111,7 +120,7 @@ font-3 = fixed:pixelsize=10;1
 
 modules-left = date uptime wlan eth filesystem-root filesystem-home filesystem-hdd cpu temperature memory xwindow
 ;modules-center = xwindow
-modules-right = pulseaudio ewmh
+modules-right = pulseaudio ewmh battery
 
 tray-position = right
 tray-padding = 2
@@ -273,7 +282,31 @@ screenchange-reload = true
 margin-top = 0
 margin-bottom = 0
 
-; vim:ft=dosini
+[module/battery]
+type = internal/battery
+
+; This is useful in case the battery never reports 100% charge
+full-at = 100
+
+; Use the following command to list batteries and adapters:
+; $ ls -1 /sys/class/power_supply/
+battery = BAT0
+adapter = ADP1
+
+poll-interval = 5
+
+label-full = 
+label-discharging = "  BATT: %percentage%%  "
+label-charging = "  BATT: %percentage%%  "
+
+label-charging-background = ${colors.batt-charging-bg}
+label-charging-foreground = ${colors.batt-charging-fg}
+
+label-discharging-background = ${colors.batt-discharging-bg}
+label-discharging-foreground = ${colors.batt-discharging-fg}
+
+label-full-background = ${colors.batt-full-bg}
+label-full-foreground = ${colors.batt-full-fg}
 
 [module/ewmh]
 type = internal/xworkspaces
-- 
cgit v1.2.3