guest@dotshare [~/groups/info/dzen2] $ ls Dzen-Panel/ | cat

Dzen Panel (scrot, raw, dl) (+2 likes)

boroshlawa Apr 14, 2014 (info/dzen2)

SCROT

  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
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/sh

BG="#121212"
FG="#d9d9d9"
CURE="-*-Ohsnap-*-*-*-*-9-*-*-*-*-*-*-*"
SNAP="-*-Ohsnap-*-*-*-*-9-*-*-*-*-*-*-*"

BAR_OPS="-fg #d9d9d9 -bg #555555 -h 7 -w 25 -s o -ss 1 -sw 2"

# Icons
CLOCK="$HOME/.dzen/xbm/clock.xbm"
BAT_EMP="$HOME/.dzen/xbm/bat_empty_01.xbm"
BAT_LOW="$HOME/.dzen/xbm/bat_low_01.xbm"
BAT_FUL="$HOME/.dzen/xbm/bat_full_01.xbm"
VOL="$HOME/.dzen/xbm/spkr_01.xbm"

CPU="$HOME/.dzen/xbm/cpu.xbm"
MEM="$HOME/.dzen/xbm/mem.xbm"
FS="$HOME/.dzen/xbm/fs_02.xbm"

MAIL="$HOME/.dzen/xbm/mail.xbm"
INFO="$HOME/.dzen/xbm/info_03.xbm"
MUSIC="$HOME/.dzen/xbm/note.xbm"
TEMP="$HOME/.dzen/xbm/temp.xbm"
USB="$HOME/.dzen/xbm/usb_02.xbm"
PACMAN="$HOME/.dzen/xbm/pacman.xbm"

NET_DOWN="$HOME/.dzen/xbm/net_down_02.xbm"
NET_UP="$HOME/.dzen/xbm/net_up_02.xbm"
WIFI="$HOME/.dzen/xbm/wifi_02.xbm"

space(){
	echo "^fn($SNAP)^fg(#555555) | ^fg()^fn()"
}
sysinfo(){
	echo "^ca(3, $HOME/.dzen/script/sysinfo.sh)^fg(#80203d)^i($INFO)^fg() Info^ca()"
}
disk(){
	# SWAP
	# SPROC=$(free -t | grep Swap | awk '{print ($3 / $2) * 100"%"}')
	# SBAR=`echo $SPROC | gdbar $BAR_OPS -max 100`
	# echo "$SBAR $SPROC"

	CPROC=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
	CBAR=`echo $CPROC | gdbar $BAR_OPS -max 100`
	echo "^fg(#80203d)^i($CPU)^fg() $CBAR $CPROC"

	MMAX=$(cat /proc/meminfo | grep MemTotal | cut -d " " -f9)
	MFREE=$(cat /proc/meminfo | grep MemFree | cut -d " " -f10)
	MUSED=$(($MMAX-$MFREE))
	MPROC=$(($MMAX/$MUSED))"%"
	MBAR=`echo $MUSED | gdbar $BAR_OPS -max $MMAX`
	echo "^fg(#80203d)^i($MEM)^fg() $MBAR $MPROC"

	SDA2=$(df -h / | awk '/\/$/ {print $5}' | tr -d '%')
	FS_MAX=$(df -h / | awk '/\/$/ {print $2}' | tr -d '%' | sed 's/G//')
	FS_USE=$(df -h / | awk '/\/$/ {print $3}' | tr -d '%' | sed 's/G//')
	echo -n "^fg(#80293d)^i($FS)^fg() $(echo $SDA2 |gdbar $BAR_OPS -nonl) ${FS_USE}/${FS_MAX} GB ${SDA2}%"
}
bat(){
	BATPROC=$(cat /sys/class/power_supply/BAT1/uevent | grep POWER_SUPPLY_CAPACITY | cut -d '=' -f2)
	BATSTATE=$(cat /sys/class/power_supply/BAT1/uevent | grep POWER_SUPPLY_STATUS | cut -d '=' -f2)
	BATBAR=`echo $BATPROC | gdbar $BAR_OPS -max 100`
	
	if [[ $BATPROC > 70 ]]; then
		echo "^fg(#80203d)^i($BAT_FUL)^fg() $BATBAR $BATPROC"
	elif [[ $BATPROC < 30 ]]; then
		echo "^fg(#80203d)^i($BAT_EMP)^fg() $BATBAR $BATPROC"
	else
		echo "^fg(#80203d)^i($BAT_LOW)^fg() $BATBAR $BATPROC"
	fi
	echo "%"
}
music(){
	echo "^fg(#80203d)^i($MUSIC)^fg() Damian Marley - Welcone To Jamrock"
}
net(){
	NET=$(iwconfig wlp2s0)
	ESSID=$(echo "$NET" | grep -oP '(?<=ESSID:).[^\s]*')
	if [[ $ESSID == "off/any" ]]; then
		echo "^fg(#80203d)^i($WIFI)^fg() Offline"
	else
		DOWN=$(cat /proc/net/dev | grep wlp2s0 | cut -d ':' -f2 | awk '{print $1}')
		UP=$(cat /proc/net/dev | grep wlp2s0 | cut -d ':' -f2 | awk '{print $9}')
		
		DOWNMB=$(($DOWN/131072))
		UPMB=$(($UP/1048576))

		echo "$DOWN Bit/s ^fg(#80293d)^i($NET_DOWN)^i($NET_UP)^fg() $UP Bit/s"
	fi
}
weather(){
	NET=$(iwconfig wlp2s0)
	ESSID=$(echo "$NET" | grep -oP '(?<=ESSID:).[^\s]*')
	if [[ ! $ESSID == "off/any" ]]; then

	script=$(python /home/boroshlawa/.dzen/script/weather.py)
	echo "^fg(#80203d)^i($TEMP)^fg() $script $(space)"

	fi
}
mail(){
	echo "^fg(#80203d)^i($MAIL)^fg() 4 new"
}
vol(){
	ismute=`amixer get Master|grep %|awk '{ print $6 }'|sed 's/\[//g'|sed 's/\]//g'`
	if [ "$ismute" == "off" ]; then
		VBS="0"
	else
		VBS=`amixer get Master|grep %|awk '{ print $4 }'|sed 's/%//g'|sed 's/\[//g'|sed 's/\]//g'`
	fi	
	
	VBAR=`echo "$VBS" | gdbar $BAR_OPS |awk '{ print $1 }'`
	echo "^fg(#80293d)^i($VOL)^fg() $VBAR"
}
dateTime(){
	
	DATE=`date +"%b %d %A,"`
	TIME=`date +"%I:%M:%S"`
	# echo "^ca(3, $HOME/.dzen/script/date.sh)^fg(#80203d)^i($CLOCK)^fg() $TIME^ca()"
	echo "^fg(#80203d)^i($CLOCK)^fg() $DATE $TIME"
}

while true ; do
	echo $(sysinfo)$(space)$(disk)$(space)$(net)$(space)$(bat)$(space)$(mail)$(space)$(vol)$(space)$(dateTime)	
done | dzen2 -p -h 20 -fg $FG -bg $BG -fn $CURE -e 'button2=;'

CLICK TO VIEW

x