summaryrefslogtreecommitdiffstats
path: root/dzen2.sh
blob: fa46549b51788802fa65ca500422257271b4155a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/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: