Added baterry level
This commit is contained in:
parent
9c4d6d9ff8
commit
59716d53ef
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
|
|
@ -8,9 +8,8 @@ Config {font = "xft:Ubuntu:weight=bold:pixelsize=14:antialias=true:hinting=true"
|
|||
, additionalFonts =
|
||||
[ "xft:Font Awesome 6 Free Solid:pixelsize=14"
|
||||
, "xft:Font Awesome 6 Free Solid:pixelsize=12:bold"
|
||||
, "xft:Font Awesome 6 Free Solid:pixelsize=16"
|
||||
, "xft:Hack Nerd Font Mono:pixelsize=21"
|
||||
, "xft:Hack Nerd Font Mono:pixelsize=25"
|
||||
, "xft:FiraCode Nerd Font Mono:pixelsize=16"
|
||||
, "xft:FiraCode Nerd Font Mono:pixelsize=12"
|
||||
]
|
||||
, bgColor = "#2B2E37"
|
||||
, fgColor = "#929AAD"
|
||||
|
@ -34,6 +33,7 @@ Config {font = "xft:Ubuntu:weight=bold:pixelsize=14:antialias=true:hinting=true"
|
|||
, Run Com "/home/afonso/.config/xmobar/scripts/volume.sh" [] "volume" 10
|
||||
, Run Com "/home/afonso/.config/xmobar/scripts/bluetooth.sh" [] "bluetooth" 10
|
||||
, Run Com "/home/afonso/.config/xmobar/scripts/network.sh" [] "network" 10
|
||||
, Run Com "/home/afonso/.config/xmobar/scripts/battery.sh" [] "battery" 20
|
||||
, Run Com "/home/afonso/.config/xmobar/scripts/trayer-padding-icon.sh" [] "trayerpad" 20
|
||||
]
|
||||
, sepChar = "%"
|
||||
|
@ -63,6 +63,8 @@ Config {font = "xft:Ubuntu:weight=bold:pixelsize=14:antialias=true:hinting=true"
|
|||
\ \
|
||||
\%volume%\
|
||||
\ \
|
||||
\%battery%\
|
||||
\ \
|
||||
\|\
|
||||
\%trayerpad%"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue