From 739dfb66a915ddad48144b3a845eee9808ea8e87 Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Sat, 17 Dec 2022 00:30:08 +0100 Subject: [PATCH] Switch to built-in battery widget. --- _desktop/_scripts/sb-battery | 17 ----------------- _desktop/qtile/config.py | 11 +++++++++-- 2 files changed, 9 insertions(+), 19 deletions(-) delete mode 100755 _desktop/_scripts/sb-battery diff --git a/_desktop/_scripts/sb-battery b/_desktop/_scripts/sb-battery deleted file mode 100755 index e50d677..0000000 --- a/_desktop/_scripts/sb-battery +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -for battery in /sys/class/power_supply/BAT?*; do - # If non-first battery, print a space separator. - [ -n "${capacity+x}" ] && printf " " - # Sets up the status and capacity - case "$(cat "$battery/status")" in - "Full") status="\uf102" ;; - "Discharging") status="\uf078" ;; - "Charging") status="\uf077" ;; - "Not charging") status="\uf444" ;; - "Unknown") status="\uf128" ;; - esac - capacity=$(cat "$battery/capacity") - # Will make a warn variable if discharging and low - [ "$capacity" -le 20 ] && printf "${status} ${capacity}%%" || printf "${status} ${capacity}%%" -done && exit 0 diff --git a/_desktop/qtile/config.py b/_desktop/qtile/config.py index f488d4e..e712a32 100644 --- a/_desktop/qtile/config.py +++ b/_desktop/qtile/config.py @@ -159,9 +159,16 @@ screens = [ update_interval=1, cmd="sb-volume", ), - widget.GenPollCommand( + widget.Battery( + format='{char} {percent:2.0%}', + charge_char='\uf077', + discharge_char='\uf078', + unknown_char='\uf444', + full_char='\uf102', update_interval=1, - cmd="sb-battery", + low_background='#770000', + low_foreground='#ffffff', + low_percentage=0.2, ), widget.Clock( format='[%d] %H:%M:%S',