Back to custom sb-battery script.
This commit is contained in:
parent
dfa6ab2633
commit
3529e172bf
17
_desktop/_scripts/sb-battery
Executable file
17
_desktop/_scripts/sb-battery
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/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"; exit 0 ;;
|
||||||
|
"Unknown") status="\uf128" ;;
|
||||||
|
esac
|
||||||
|
capacity=$(cat "$battery/capacity")
|
||||||
|
# Will make a warn variable if discharging and low
|
||||||
|
[ "$capacity" -le 20 ] && printf "<span size='140%%' background='#770000' foreground='#ffffff'>${status} ${capacity}%%</span>" || printf "${status} ${capacity}%%"
|
||||||
|
done && exit 0
|
@ -166,17 +166,9 @@ screens = [
|
|||||||
update_interval=1,
|
update_interval=1,
|
||||||
cmd="sb-network",
|
cmd="sb-network",
|
||||||
),
|
),
|
||||||
widget.Battery(
|
widget.GenPollCommand(
|
||||||
format='{char} {percent:2.0%}',
|
|
||||||
charge_char='\uf077',
|
|
||||||
discharge_char='\uf078',
|
|
||||||
unknown_char='\uf444',
|
|
||||||
full_char='\uf102',
|
|
||||||
update_interval=1,
|
update_interval=1,
|
||||||
hide_threshold=0.8,
|
cmd="sb-battery",
|
||||||
low_background='#770000',
|
|
||||||
low_foreground='#feffff',
|
|
||||||
low_percentage=0.2,
|
|
||||||
),
|
),
|
||||||
widget.Clock(
|
widget.Clock(
|
||||||
format='[%d] %H:%M:%S',
|
format='[%d] %H:%M:%S',
|
||||||
|
Loading…
Reference in New Issue
Block a user