From 7fa1cfe21fc09a3b18a68a7bae3daf9fa9a07b80 Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Tue, 24 Mar 2020 10:54:45 -0400 Subject: [PATCH] Add battery module to polybar, update start-polybar.sh to kill previously running bars --- .config/polybar/config | 124 +++++++++++++++++++++++++++++-- .config/polybar/start-polybar.sh | 5 ++ 2 files changed, 122 insertions(+), 7 deletions(-) diff --git a/.config/polybar/config b/.config/polybar/config index 05282f6..bc54040 100644 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -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 = 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: +; (default) +; +; +; +format-charging = + +; Available tags: +; (default) +; +; +; +format-discharging = + +; Available tags: +; (default) +; +; +format-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 is used +ramp-capacity-0 =  +ramp-capacity-1 =  +ramp-capacity-2 =  +ramp-capacity-3 =  +ramp-capacity-4 =  + +; Only applies if 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 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 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] diff --git a/.config/polybar/start-polybar.sh b/.config/polybar/start-polybar.sh index 64dd3d7..3ce326c 100755 --- a/.config/polybar/start-polybar.sh +++ b/.config/polybar/start-polybar.sh @@ -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