guest@dotshare [~/groups/info/dzen2] $ ls Dzen2-Status-Bar-for-i3/ | cat

Dzen2 Status Bar for i3 (scrot, raw, dl) (+1 likes)

homelinen Sep 20, 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/bin/bash

# ------------------------------------------------------
# file:     $HOME/.scripts/dzenstat.sh
# author:   Ramon Solis - http://cyb3rpunk.wordpress.com
# modified: June 2011
# vim:fenc=utf-8:nu:ai:si:et:ts=4:sw=4:ft=sh:
# ------------------------------------------------------

# -------------------------
# Dzen settings & Variables
# -------------------------
ICONPATH="/usr/share/icons/stlarch_icons"
COLOR_ICON="#EE3B3B"
CRIT_COLOR="#ff2c4a"
DZEN_FG="#A0A0A0"
DZEN_BG="#222222"
HEIGHT=12
WIDTH=0
RESOLUTION=$(xrandr | grep " connected" | cut -d" " -f 3)
RESOLUTIONW=$(echo $RESOLUTION | cut -d"x" -f1) 
RESOLUTIONH=$(echo $RESOLUTION | cut -d"x" -f2 | cut -d'+' -f 1) 
X=$(($RESOLUTIONW-$WIDTH))
Y=$(($RESOLUTIONH-$HEIGHT-1))
BAR_FG="#EE3B3B"
BAR_BG="#808080"
BAR_H=10
BAR_W=65
#FONT="-artwiz-anorexia-medium-r-normal--11-110-75-75-p-90-iso8859-1"
FONT="-*-terminus-medium-r-*-*-12-*-*-*-*-*-iso10646-*"

SLEEP=5
VUP="amixer -c0 -q set Master 2dB+"
VDOWN="amixer -c0 -q set Master 2dB-"
#EVENT="button3=exit;button4=exec:$VUP;button5=exec:$VDOWN"
DZEN="dzen2 -fn $FONT -ta r -bg $DZEN_BG -fg $DZEN_FG -dock" 

# -------------
# Infinite loop
# -------------
while :; do
sleep ${SLEEP}

# ---------
# Functions
# ---------
Vol ()
{
	#ONF=$(amixer get Master | awk '/Front\ Left:/ {print $7}' | tr -d '[]')
	#VOL=$(amixer get Master | egrep -o "[0-9]+%" | tr -d '%')
    VOL=$(pulseaudio-ctl | grep "Volume level" | cut -d":" -f 2 | grep -Eo "[0-9]+ %" | tr -d ' %')
	echo -n "^fg($COLOR_ICON)^i($ICONPATH/vol1.xbm)^fg()" $(echo $VOL | gdbar -fg $BAR_FG -bg $BAR_BG -h 7 -w 40 -s o -nonl)
	return
}

Mem ()
{
	MEM=$(free -m | grep '-' | awk '{print $3}')
	echo -n "^fg($COLOR_ICON)^i($ICONPATH/mem1.xbm)^fg() ${MEM} MB"
	return
}

Temp ()
{
	TEMP=$(acpi -t | awk '{print $4}' | tr -d '.0')
		if [[ ${TEMP} -gt 63 ]] ; then
			echo -n "^fg($CRIT_COLOR)^i($ICONPATH/temp.xbm)^fg($CRIT_COLOR) ${TEMP}°C" $(echo ${TEMP} | gdbar -fg $CRIT_COLOR -bg $BAR_BG -h $BAR_H -s v -sw 5 -ss 0 -sh 1 -nonl)
		else 
			echo -n "^fg($COLOR_ICON)^i($ICONPATH/temp.xbm)^fg() ${TEMP}°C" $(echo ${TEMP} | gdbar -fg $BAR_FG -bg $BAR_BG -h $BAR_H -s v -sw 5 -ss 0 -sh 1 -nonl)
		fi
	return
}

Disk ()
{
	SDA2=$(df -h / | awk '/\/$/ {print $5}' | tr -d '%')
	#SDA3=$(df -h /home | awk '/home/ {print $5}' | tr -d '%')
	if [[ ${SDA2} -gt 60 ]] ; then
		echo -n "^fg($COLOR_ICON)^i($ICONPATH/file1.xbm)^fg() /:${SDA2}% $(echo $SDA2 | gdbar -fg $CRIT_COLOR -bg $BAR_BG -h 7 -w 40 -s o -ss 0 -sw 2 -nonl)"
	else
		echo -n "^fg($COLOR_ICON)^i($ICONPATH/file1.xbm)^fg() /:${SDA2}% $(echo $SDA2 | gdbar -fg $BAR_FG -bg $BAR_BG -h 7 -w 40 -s o -ss 0 -sw 2 -nonl)"
	fi
	return
}

MPD ()
{
	MPDSTATUS=$(mpc | awk '/\[/ {print $1}' | tr -d "[]")
	MPDINFO=$(mpc | grep -v 'volume:' | head -n1)
	if [[ $MPDSTATUS == "playing" ]] ; then
		echo -n "^fg($COLOR_ICON)^i($ICONPATH/note1.xbm)^fg(#a0a0a0) $MPDINFO"
	elif [[ $MPDSTATUS == "paused" ]] ; then
		echo -n "^fg($COLOR_ICON)^i($ICONPATH/note1.xbm)^fg(#a0a0a0) [Paused]"
	else
		echo -n "^fg($COLOR_ICON)^i($ICONPATH/note1.xbm)^fg(#a0a0a0) [Stopped]"
	fi
	return
}

Kernel ()
{
	KERNEL=$(uname -a | awk '{print $3}')
	echo -n "Kernel: $KERNEL"
	return
}

Date ()
{
	TIME=$(date +"%R, %a %e")
		echo -n "^fg($COLOR_ICON)^i($ICONPATH/clock1.xbm)^fg(#a0a0a0) ${TIME}"
	return
}

Between ()
{
    echo -n " ^fg(#A0A0A0)^r(2x2)^fg() "
	return
}

# Change logo on battery status
Battery () {
    BAT_PERCENT=$(acpi -b | grep -Po "\d{1,}%")

    BAT_CHARGING=$(acpi -b | grep -Eo "(arging|Full)")
    if [[ -n $BAT_CHARGING ]]; then

        BAT_VAL=$(echo $BAT_PERCENT | grep -Po "\d{2,}")
        if [[ $BAT_VAL -gt 70 ]]; then
            echo -n "^fg($COLOR_ICON)^i($ICONPATH/batt5full.xbm)^fg()"
        elif [[ $BAT_VAL -gt 30 ]]; then
            echo -n "^fg($COLOR_ICON)^i($ICONPATH/batt5half.xbm)^fg()"
        else 
            echo -n "^fg($COLOR_ICON)^i($ICONPATH/batt5empty.xbm)^fg()"
        fi
        
        echo -n " $BAT_PERCENT"
    else
        echo -n "^fg($COLOR_ICON)^i($ICONPATH/ac14.xbm)^fg()"
    fi

    return
}

Network() {

    echo -n "^fg($COLOR_ICON)^i($ICONPATH/wireless1.xbm)^fg() "
    NETWORK=$(netctl list | awk '/*/ {print $2}')
    if [ -n "$NETWORK" ]; then
        echo -n "$NETWORK"
    else
        echo -n "Not Connected"
    fi
    return
}

OSLogo ()
{
	echo -n " ^fg($COLOR_ICON)^i($ICONPATH/arch1.xbm)^fg() "
	return
}
# --------- End Of Functions

# -----
# Print 
# -----
Print () {
#		OSLogo
#		Kernel
#		Between
#		MPD
#		Between
#		Temp
#		Between
        Network
        Between
        Mem
        Between
        Disk
        Between
        Vol
        Between
        Battery
        Between
        Date
        echo
    return
}

echo "$(Print)" 
done | $DZEN

CLICK TO VIEW

x

Notes

Controls for:

  • Wireless with netctl
  • Audio with pulseaudio-ctl
  • Battery with acpi