45 lines
1.8 KiB
Bash
Executable file
45 lines
1.8 KiB
Bash
Executable file
#!/bin/zsh
|
|
|
|
SCREEN=0
|
|
|
|
func_power() {
|
|
if [ -e /proc/acpi/battery/BAT0/info ]; then
|
|
CAP=$(grep full /proc/acpi/battery/BAT0/info | awk '{print $4}')
|
|
REM=$(grep remaining /proc/acpi/battery/BAT0/state | awk '{print $3}')
|
|
CHARGING=$(grep "charging state" /proc/acpi/battery/BAT0/state | awk '{print $3}')
|
|
STATE=$(($REM * 100 / $CAP))"%"
|
|
|
|
if [ "$CHARGING" = "charged" ]; then
|
|
echo $SCREEN widget_tell topbar power_logo image /home/xeno/etc/icons/tango/actions/go-next.png | awesome-client
|
|
elif [ "$CHARGING" = "discharging" ]; then
|
|
echo $SCREEN widget_tell topbar power_logo image /home/xeno/etc/icons/tango/actions/go-down.png | awesome-client
|
|
elif [ "$CHARGING" = "charging" ]; then
|
|
echo $SCREEN widget_tell topbar power_logo image /home/xeno/etc/icons/tango/actions/go-up.png | awesome-client
|
|
fi
|
|
|
|
echo $STATE
|
|
else
|
|
echo "No Battery"
|
|
fi
|
|
}
|
|
|
|
func_mem() {
|
|
TOT=$(free -m | grep Mem | awk '{print $2}')
|
|
USE=$(free -m | grep buffers/cache | awk '{print $3}')
|
|
MEM=$(($USE * 100 / $TOT))
|
|
echo $MEM
|
|
}
|
|
|
|
while true; do
|
|
echo $SCREEN widget_tell topbar power text " `func_power` " | awesome-client
|
|
echo $SCREEN widget_tell topbar mem data mem_state " `func_mem` " | awesome-client
|
|
echo $SCREEN widget_tell topbar hdd data hdd_root `df / | tail -n 1 | awk '{print $4+100-100}'` | awesome-client
|
|
echo $SCREEN widget_tell topbar hdd data hdd_home `df /home | tail -n 1 | awk '{print $4+100-100}'` | awesome-client
|
|
echo $SCREEN widget_tell topbar wlan text " `/sbin/ifconfig | grep -A 1 wlan0 | tail -n 1 | awk '{print $2}' | sed 's/Adresse://g'` " | awesome-client
|
|
echo $SCREEN widget_tell topbar clock text " `date +"%x %T"` " | awesome-client
|
|
echo $SCREEN widget_tell topbar hostname text " `hostname` " | awesome-client
|
|
|
|
sleep 1
|
|
done
|
|
|
|
# vim: set tw=0 ts=4:
|