2 # $Id: bin/statusbar,v 1.5 2016/12/18 11:09:10 fstef Exp $
4 # dzen status bar configuration file
7 # ------------------------------------------------------------------------------
8 # Copywhat (?) 2016 stefano ferro <fstef@cryptolab.net>
10 # This work is protected by the Berne Convention but nobody can tell us
11 # what we can do and what we can't, so we don't care.
12 # Anybody caught use, copy, hacking, and distribute this work for any
13 # purpose, or otherwise experience it, without our permission.
14 # Credit the creator of this work is a matter of ethics, not a matter
15 # of law, so is up to you.
17 # THE WORK IS PROVIDED "AS IS" AND YOU USE IT AT YOUR OWN RISK.
18 # ------------------------------------------------------------------------------
27 FONT
="-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*"
31 GREEN
="^fg(green)^bg()"
32 YELLOW
="^fg(yellow)^bg()"
33 WHITE
="^fg(#ffdead)^bg()"
35 CHARC
="^fg(#008b8b)^bg()"
36 #CHARC="^fg(#36454f)^bg()"
41 echo -n " ${CHARC}::${NC} "
44 FORMAT
="%a, %b %d %H:%M:%S"
45 DATE
=$
(date "+${FORMAT}")
46 echo -n "${WHITE}${DATE}${NC} "
50 VOLSTAT
=$
(mixerctl outputs.master.mute |
sed -e 's/outputs.master.mute=//')
51 # VOL=$(mixerctl outputs.master | sed -e 's/outputs.master=//')
52 if [ $VOLSTAT == "off" ]; then
53 echo -n "${ICOLOR}>>>${NC}"
55 echo -n "${ICOLOR}<<<${NC}"
60 NMAIL
=$
(new |
awk '/total/ {print $2}' |
sed -e 's/\.//')
61 if [[ $NMAIL -eq 0 ]]; then
64 echo -n "${ICOLOR}@${NC}${NMAIL}"
69 TMP
=$
(sysctl |
grep acpitz |
sed -e 's/hw\.sensors\.acpitz0\.temp0=//' -e 's/\.00 degC (zone temperature)//')
70 if [ $TMP -lt 75 ]; then
73 echo -n "t:${RED}${TMP}°${NC}"
78 FAN
=$
(sysctl |
grep fan |
sed -e 's/hw.sensors.acpithinkpad0.fan0=//' -e 's/ RPM/rpm/')
83 MEM
=$
(/usr
/bin
/top |
grep Free
: | cut
-d " " -f6)
88 # STATUS=$(ifconfig em0 | grep "status" | awk '{$1=$1}{ print $2}')
91 # echo -n "${GREEN}||${RED}||${NC}"
100 # LABEL=$(ifconfig iwn0 | awk '/status/ {print $2}')
103 # echo -n "${GREEN}||${RED}||${NC}"
111 STATUS
=$
(ifconfig em0 |
grep "status" |
awk '{$1=$1}{ print $2}')
112 LABEL
=$
(ifconfig iwn0 |
awk '/status/ {print $2}')
113 if [[ $STATUS = "active" ]]; then
114 echo -n "${GREEN}||${RED}||${NC}"
115 elif [[ $LABEL = "active" ]]; then
116 echo -n "${GREEN}||${RED}||${NC}"
123 # typeset -R4 _1=${1} _2=${2} _3=${3} _4=${4} _5=${5}
124 # echo -n "CPU:${_1}% User${_2}% Nice${_3}% Sys${_4}% Int${_5}% Idle "
129 # # iostat prints each column justified to 3 chars, so if one counter
130 # # is 100, it jams up agains the preceeding one. sort this out.
131 # while [ "${1}x" != "x" ]; do
132 # if [ ${1} -gt 99 ]; then
133 # OUT="$OUT ${1%100} 100"
147 # if [ $AC_STATUS -ne 255 -o $BAT_STATUS -lt 4 ]; then
149 # if [ $AC_STATUS -eq 0 ]; then
150 # if [ $BAT_STATUS -eq 0 ]; then
151 # echo -n " ${GREEN}^i($BATF)${NC}${BAT_LEVEL}% "
153 # if [ $BAT_STATUS -eq 1 ]; then
154 # echo -n " ${YELLOW}^i($BATL)${NC}${BAT_LEVEL}% "
156 # if [ $BAT_STATUS -eq 2 ]; then
157 # echo -n " ${RED}^i($BATE)${NC}${BAT_LEVEL}% "
160 # if [ $AC_STATUS -eq 1 ]; then
162 # if [ $BAT_STATUS -eq 0 ]; then
163 # echo -n " ${GREEN}^i($ACI)${NC}${BAT_LEVEL}% "
165 # if [ $BAT_STATUS -eq 1 ]; then
166 # echo -n " ${YELLOW}^i($ACI)${NC}${BAT_LEVEL}% "
168 # if [ $BAT_STATUS -eq 2 ]; then
169 # echo -n " ${RED}^i($ACI)${NC}${BAT_LEVEL}% "
171 # if [ $BAT_STATUS -eq 3 ]; then
172 # echo -n " battery charging ${GREEN}${BAT_LEVEL}%${NC} "
183 if [ $AC_STATUS -ne 255 -o $BAT_STATUS -lt 4 ]; then
184 if [ $AC_STATUS -eq 0 ]; then
186 if [ $BAT_STATUS -eq 0 ]; then
187 echo -n "${GREEN}[${NC}${BAT_LEVEL}%${GREEN}]${NC}"
189 if [ $BAT_STATUS -eq 1 ]; then
190 echo -n "${YELLOW}[${NC}${BAT_LEVEL}%${YELLOW}]${NC}"
192 if [ $BAT_STATUS -eq 2 ]; then
193 echo -n "${RED}[${NC}${BAT_LEVEL}%${RED}]${NC}"
195 if [ $BAT_STATUS -eq 3 ]; then
196 echo -n "battery charging ${GREEN}${BAT_LEVEL}%${NC}"
202 AC_STRING
="${ICOLOR}+${NC}"
213 BAT_STRING
="no battery"
216 BAT_STRING
="${BAT_LEVEL}%"
219 BAT_STRING
="battery unknown"
223 FULL
="${AC_STRING}${BAT_STRING}"
224 if [ "$FULL" != "" ]; then
232 CPU_SPEED
=$
(/sbin
/sysctl hw.cpuspeed | cut
-d "=" -f2)
233 echo -n "cpu:${CPU_SPEED}MHz"
239 # /usr/sbin/iostat -C -c 1 |&
243 # trap "kill $PID; exit" TERM
245 # if [ $(( ${I} % 1 )) -eq 0 ]; then
246 APM_DATA
=$
(/usr
/sbin
/apm
-alb)
248 # if [ $I -ge 2 ]; then
272 # I=$(( ( ${I} + 1 ) % 22 ));
277 done | dzen2
-h $HEIGHT -ta r
-x $XPOINT -w $WIDTH -h 14 -fg $FG -bg $BG -fn $FONT