separate battery script with colors
This commit is contained in:
parent
df6363a298
commit
c0a2cce420
2 changed files with 26 additions and 4 deletions
|
@ -47,11 +47,11 @@ interval=10
|
|||
|
||||
[wifi]
|
||||
label=📶
|
||||
#instance=wlp3s0
|
||||
instance=wlp2s0
|
||||
interval=10
|
||||
|
||||
[battery]
|
||||
command=echo $(cat /sys/class/power_supply/BAT0/status | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/❓/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g") $(cat /sys/class/power_supply/BAT0/capacity | sed -e 's/$/%/')
|
||||
command=i3battery
|
||||
interval=5
|
||||
|
||||
[time]
|
||||
|
|
|
@ -1,2 +1,24 @@
|
|||
#!/bin/sh
|
||||
#acpi | cut -d " " -f3-5 | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g"
|
||||
#!/bin/bash
|
||||
NUM=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
STATE=$(cat /sys/class/power_supply/BAT0/status)
|
||||
|
||||
colorget() {
|
||||
if [[ $NUM -ge 80 ]]; then
|
||||
color="#00FF00"
|
||||
elif [[ $NUM -ge 60 ]]; then
|
||||
color="#FF0000"
|
||||
elif [[ $NUM -ge 40 ]]; then
|
||||
color="#FFF600"
|
||||
elif [[ $NUM -ge 20 ]]; then
|
||||
color="#FFAE00"
|
||||
else
|
||||
color="#FF0000"
|
||||
fi ;}
|
||||
|
||||
if [[ $STATE == "Charging" ]]; then
|
||||
color="#ffffff"
|
||||
else
|
||||
colorget
|
||||
fi
|
||||
|
||||
echo "<span color='$color'>$(echo $STATE | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/❓/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g") $(echo $NUM | sed -e 's/$/%/')</span>"
|
||||
|
|
Loading…
Reference in a new issue