Add battery module to polybar, update start-polybar.sh to kill previously running bars

This commit is contained in:
Shaun Reed 2020-03-24 10:54:45 -04:00
parent 53c296782c
commit 7fa1cfe21f
2 changed files with 122 additions and 7 deletions

View File

@ -5,7 +5,7 @@
; Polybar Position
monitor = ${env:MONITOR}
width = 100%
height = 30
height = 25
; Polybar Color
; Depreciated..
@ -65,14 +65,14 @@ module-margin-right = 2
; Font settings, order matters
; Top font takes priority over following
;font-0 = Source Code Pro:size=10;0
font-0 = NotoSans-Regular:size=8;0
font-1 = Inconsolata Nerd Font:size=12;0
font-0 = NotoSans-Regular:size=8;1
font-1 = Inconsolata Nerd Font:size=12;3
font-2 = Noto Sans Mono:size=8;0
; Modules
modules-left = temp-cpu cpu memfree memory
modules-center = popup-utc network public-ip filesystem
modules-right = keyboard info-hackspeed info-idle
modules-right = battery
; Set the cursor to display pointer / resize is interaction available
cursor-click = pointer
@ -399,9 +399,9 @@ format = <bar-used>
label = RAM:
bar-used-width = 15
bar-used-foreground-0 = #aaff77
bar-used-foreground-1 = #aaff77
bar-used-foreground-2 = #fba922
bar-used-foreground-3 = #ff5555
bar-used-foreground-1 = #fba922
bar-used-foreground-2 = #ff5555
;bar-used-foreground-3 = #ff5555
bar-used-indicator = 
bar-used-indicator-font = 6
bar-used-indicator-foreground = #ff
@ -412,6 +412,116 @@ bar-used-empty = -
bar-used-empty-font = 6
bar-used-empty-foreground = #444444
; Battery Status
;;;;;;;;;;;;;;;;;;;;;;;;;;
[module/battery]
type = internal/battery
; This is useful in case the battery never reports 100% charge
full-at = 99
; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/
battery = BAT0
adapter = AC
; If an inotify event haven't been reported in this many
; seconds, manually poll for new values.
;
; Needed as a fallback for systems that don't report events
; on sysfs/procfs.
;
; Disable polling by setting the interval to 0.
;
; Default: 5
poll-interval = 5
; see "man date" for details on how to format the time string
; NOTE: if you want to use syntax tags here you need to use %%{...}
; Default: %H:%M:%S
;time-format = %H:%M
; Available tags:
; <label-charging> (default)
; <bar-capacity>
; <ramp-capacity>
; <animation-charging>
format-charging = <ramp-capacity> <label-charging>
; Available tags:
; <label-discharging> (default)
; <bar-capacity>
; <ramp-capacity>
; <animation-discharging>
format-discharging = <ramp-capacity> <label-discharging>
; Available tags:
; <label-full> (default)
; <bar-capacity>
; <ramp-capacity>
format-full = <ramp-capacity> <label-full>
; Available tokens:
; %percentage% (default) - is set to 100 if full-at is reached
; %percentage_raw%
; %time%
; %consumption% (shows current charge rate in watts)
label-charging = Charging %percentage%% | %time% | %consumption% W
; Available tokens:
; %percentage% (default) - is set to 100 if full-at is reached
; %percentage_raw%
; %time%
; %consumption% (shows current discharge rate in watts)
label-discharging = %percentage%% | %time% | %consumption% W
; Available tokens:
; %percentage% (default) - is set to 100 if full-at is reached
; %percentage_raw%
label-full = Fully charged
; Only applies if <ramp-capacity> is used
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
; Only applies if <bar-capacity> is used
bar-capacity-width = 10
;bar-used-width = 15
;bar-used-foreground-0 = #aaff77
;bar-used-foreground-1 = #aaff77
;bar-used-foreground-2 = #fba922
;bar-used-foreground-3 = #ff5555
;bar-used-indicator = 
;bar-used-indicator-font = 6
;bar-used-indicator-foreground = #ff
;bar-used-fill = 
;bar-used-fill-font = 6
;bar-used-empty = -
;bar-used-empty-font = 6
;bar-used-empty-foreground = #444444
; Only applies if <animation-charging> is used
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
; Framerate in milliseconds
animation-charging-framerate = 750
; Only applies if <animation-discharging> is used
animation-discharging-0 = 
animation-discharging-1 = 
animation-discharging-2 = 
animation-discharging-3 = 
animation-discharging-4 = 
; Framerate in milliseconds
animation-discharging-framerate = 500
; I3 Workspace Display
;;;;;;;;;;;;;;;;;;;;;;;;;;
[module/ki3]

View File

@ -6,6 +6,11 @@
# start-polybar.sh
# Kill any previous polybars
killall -q polybar
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# For each monitor in list up to ':'
for m in $(polybar --list-monitors | cut -d":" -f1); do