41 lines
1.2 KiB
Bash
Executable file
41 lines
1.2 KiB
Bash
Executable file
#!/bin/zsh
|
|
# dzen2 script by Stefan Ritter <xeno@thehappy.de>
|
|
|
|
COUNT=0
|
|
|
|
func_date() {
|
|
date +%x" "%T
|
|
}
|
|
|
|
func_cputemp() {
|
|
if [ -e /proc/acpi/thermal_zone/THRM/temperature ]; then
|
|
echo $(cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $2 "°"}')
|
|
fi
|
|
}
|
|
|
|
func_battery() {
|
|
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}')
|
|
echo $(($REM * 100 / $CAP))"%"
|
|
fi
|
|
}
|
|
|
|
func_load() {
|
|
echo $(cat /proc/loadavg | awk '{print $1 " " $2 " " $3}')
|
|
}
|
|
|
|
func_volume() {
|
|
amixer | grep -A 6 \'PCM\' | tail -n 1 | awk '{print $5}' | sed 's/\[//g' | sed 's/\]//g'
|
|
}
|
|
|
|
func_wlanip() {
|
|
/sbin/ifconfig | grep -A 1 wlan0 | tail -n 1 | awk '{print $2}' | sed 's/Adresse://g'
|
|
}
|
|
|
|
while true; do
|
|
print "^i(etc/pixelicons/spkr_01.xbm) $(func_volume) ^i(etc/pixelicons/info_01.xbm) $(func_load) ^i(etc/pixelicons/bat_full_02.xbm) $(func_battery) ^i(etc/pixelicons/temp.xbm) $(func_cputemp) ^ca(1,wicd-client -n)^i(etc/pixelicons/wifi_02.xbm)^ca() $(func_wlanip) ^i(etc/pixelicons/clock.xbm) $(func_date) ^fg(red)$(hostname) "
|
|
sleep 1
|
|
done
|
|
|
|
# vim: set tw=0:
|