chore: Added baterry level
This commit is contained in:
parent
f0033b25e0
commit
2ca7b71832
2 changed files with 69 additions and 3 deletions
64
.config/xmobar/scripts/battery.sh
Executable file
64
.config/xmobar/scripts/battery.sh
Executable file
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
batLevel=$(acpi --battery | grep -Po '(\d+)\%' | sed 's/%//')
|
||||
|
||||
charging=$(acpi --ac-adapter | grep -Po '(off-line|on-line)')
|
||||
|
||||
if [ $batLevel -le 20 ];
|
||||
then
|
||||
if [ $charging == "on-line" ];
|
||||
then
|
||||
echo "<fn=3> $batLevel</fn>"
|
||||
else
|
||||
echo "<fn=4> $batLevel</fn>"
|
||||
fi
|
||||
elif [ $batLevel -le 30 ];
|
||||
then
|
||||
if [ $charging == "on-line" ];
|
||||
then
|
||||
echo "<fn=3> $batLevel</fn>"
|
||||
else
|
||||
echo "<fn=4> $batLevel</fn>"
|
||||
fi
|
||||
elif [ $batLevel -le 40 ];
|
||||
then
|
||||
if [ $charging == "on-line" ];
|
||||
then
|
||||
echo "<fn=3> $batLevel</fn>"
|
||||
else
|
||||
echo "<fn=3> $batLevel</fn>"
|
||||
fi
|
||||
elif [ $batLevel -le 60 ];
|
||||
then
|
||||
if [ $charging == "on-line" ];
|
||||
then
|
||||
echo "<fn=3> $batLevel</fn>"
|
||||
else
|
||||
echo "<fn=4> $batLevel</fn>"
|
||||
fi
|
||||
elif [ $batLevel -le 80 ];
|
||||
then
|
||||
if [ $charging == "on-line" ];
|
||||
then
|
||||
echo "<fn=3> $batLevel</fn>"
|
||||
else
|
||||
echo "<fn=4> $batLevel</fn>"
|
||||
fi
|
||||
elif [ $batLevel -le 95 ];
|
||||
then
|
||||
if [ $charging == "on-line" ];
|
||||
then
|
||||
echo "<fn=3> $batLevel</fn>"
|
||||
else
|
||||
echo "<fn=4> $batLevel</fn>"
|
||||
fi
|
||||
elif [ $batLevel -g 95 ];
|
||||
then
|
||||
if [ $charging == "on-line" ];
|
||||
then
|
||||
echo "<fn=3> $batLevel</fn>"
|
||||
else
|
||||
echo "<fn=4> $batLevel</fn>"
|
||||
fi
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue