summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/bat.sh40
-rw-r--r--bin/clock.sh25
-rw-r--r--bin/dzen2_pgrp.sh21
-rw-r--r--bin/mem.sh21
-rw-r--r--bin/sound.sh25
-rwxr-xr-xdzen2_all.sh8
-rw-r--r--icons/cpu.xbm4
-rw-r--r--icons/mem.xbm4
-rw-r--r--icons/power-ac.xbm4
-rw-r--r--icons/power-bat-empty.xbm4
-rw-r--r--icons/power-bat-full.xbm4
-rw-r--r--icons/power-bat-low.xbm4
-rw-r--r--icons/vol-hi.xbm4
-rw-r--r--icons/vol-mute.xbm4
14 files changed, 172 insertions, 0 deletions
diff --git a/bin/bat.sh b/bin/bat.sh
new file mode 100644
index 0000000..e546209
--- /dev/null
+++ b/bin/bat.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+STATEFILE='/proc/acpi/battery/BAT0/state' # battery's state file
+INFOFILE='/proc/acpi/battery/BAT0/info' # battery's info file
+
+while true
+do
+ BAT_FULL=`cat $INFOFILE | grep "last full" |cut -d " " -f 9`;
+ STATUS=`cat $STATEFILE | grep charging |cut -d " " -f 12`;
+ RCAP=`cat $STATEFILE | grep remaining |cut -d " " -f 8`;
+
+ RPERCT=`expr $RCAP \* 100`;
+ RPERC=`expr $RPERCT / $BAT_FULL`;
+
+ echo -n '^p(10)'
+
+ if [ $RPERC -ge 100 ]
+ then
+ RPERC=100
+ fi
+
+ # draw the bar and pipe everything into dzen
+ COLOR="#999"
+ IMAGE="power-ac"
+
+ if [ "$STATUS" == "discharging" ]
+ then
+ if [ $RPERC -le 20 ]
+ then
+ COLOR="#f00"
+ IMAGE="power-bat-empty"
+ else
+ IMAGE="power-bat-full"
+ fi
+ fi
+
+ echo $RPERC | gdbar -h 6 -w 50 -fg "${COLOR}" -bg '#444' -l "^i(/home/alex/.dzen2/icons/${IMAGE}.xbm) " -nonl
+ echo " ${RPERC}%"
+ sleep 5;
+done
diff --git a/bin/clock.sh b/bin/clock.sh
new file mode 100644
index 0000000..5b54a6a
--- /dev/null
+++ b/bin/clock.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+OLD_TODAY=0
+
+while /bin/true
+do
+ echo "^tw() ^fg(#ff0000)`date`"
+
+ TODAY=$(expr `date +'%d'` + 0)
+
+ if [ $TODAY -ne $OLD_TODAY ]
+ then
+ MONTH=`date +'%m' | sed "s/^0//"`
+ YEAR=`date +'%Y'`
+ [ $MONTH -eq 12 ] && YEAR=$(($YEAR + 1))
+ OLD_TODAY=$TODAY
+
+ echo "^cs()"
+ echo
+ cal -m | sed "s/$/ /;s/^\(.\{20\}\).*$/\1/" | sed -u -re "s/(^|[ ])($TODAY)($|[ ])/\1^fg(#ff0000)\2^fg()\3/"
+ echo " "
+ cal -m $((($MONTH % 12) +1)) $YEAR | sed "s/$/ /;s/^\(.\{20\}\).*$/\1/"
+ fi
+
+ sleep 1
+done
diff --git a/bin/dzen2_pgrp.sh b/bin/dzen2_pgrp.sh
new file mode 100644
index 0000000..0473db8
--- /dev/null
+++ b/bin/dzen2_pgrp.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+DIR="${HOME}/.dzen2/"
+
+cat $* | dzen2 -xs 1 -x 0 -w 1223 -ta l -fn '-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*' -bg black -e 'button1=none' &
+MAIN=$!
+
+sh "${DIR}/bin/bat.sh" | dzen2 -xs 1 -x 1360 -w 120 -fn '-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*' -bg black -e 'button1=none' &
+
+sh "${DIR}/bin/clock.sh" | dzen2 -xs 1 -x 1480 -w 200 -fn '-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*' -bg black -l 17 -p -sa c -e 'button1=exec:xscreensaver-command -lock;button3=exec:xcalendar;button2=exec:xscreensaver-command -prefs;onstart=collapse;entertitle=uncollapse,unhide;leavetitle=collapse' &
+
+gcpubar -fg '#999' -bg '#444' -w 50 -h 7 -l "^i(${DIR}/icons/cpu.xbm) " | sed -u 's/#D56F6C/#ff0000/' | dzen2 -xs 1 -x 1240 -w 120 -fn '-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*' -bg black -e 'button1=none' &
+
+sh "${DIR}/bin/sound.sh" | dzen2 -xs 1 -x 1223 -tw 17 -w 100 -fn '-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*' -bg black -sa c -l 1 -e 'entertitle=uncollapse,unhide;leavetitle=collapse;button1=exec:amixer -q -c0 set Master toggle;button2=exec:pavucontrol;button3=exec:amixer -c0 -- set Master playback 80%;button4=exec:amixer -c0 -- set Master playback 2%+;button5=exec:amixer -c0 -- set Master playback 2%-' &
+
+# kill bars on new RandR config
+( ${DIR}/bin/xrandr-notify && kill ${MAIN} ) &
+
+wait $MAIN
+
+# kill all
+kill -TERM -$$
diff --git a/bin/mem.sh b/bin/mem.sh
new file mode 100644
index 0000000..decc2fd
--- /dev/null
+++ b/bin/mem.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+AWKS='/MemTotal/ {mtotal=$2};
+/MemFree/ {mfree=$2};
+/Active/ {mactive=$2};
+/^Cached/ {mcached=$2};
+/SwapTotal/ {swtotal=$2};
+/SwapFree/ {swfree=$2};
+END {
+ print mtotal-mfree " " mtotal;
+ print mactive " " mtotal;
+ print mcached " " mtotal;
+ print swtotal-swfree " " swtotal; }'
+
+echo "$AWKS"
+#while echo ' ^tw()Mem:
+#Active:
+#Cached:
+#Swap : ' | paste -d ' ' - < (awk "$AWKS" /proc/meminfo | gdbar -fg '#aecf96' -bg '#37383a' -w 50 -h 7); do
+#sleep 5
+#done
diff --git a/bin/sound.sh b/bin/sound.sh
new file mode 100644
index 0000000..036b1c0
--- /dev/null
+++ b/bin/sound.sh
@@ -0,0 +1,25 @@
+function print_mute {
+ local stat VOL MUTE
+
+ stat=$(amixer -c0 get Master | grep "Front Left:")
+ VOL=$(sed 's/^.*\[\(.*\)%\].*$/\1/g' <<< "${stat}")
+ MUTE=$(sed 's/^.*\[\([^\[]*\)\]$/\1/g' <<< "${stat}")
+# VOL=$(amixer -c0 get Master | grep " 0:" | awk '{ print $6 }')
+
+# VOL=$(aumix -d /dev/mixer -q l | grep vol | awk '{ print $3 }')
+# MUTE=${VOL}
+ if [ "${MUTE}" == "off" -o "${MUTE}" == "0" ]
+ then
+ echo "^tw()^fg(#FF0000)^i(/home/alex/.dzen2/icons/vol-mute.xbm)"
+ else
+ echo "^tw()^fg()^i(/home/alex/.dzen2/icons/vol-hi.xbm)"
+ fi
+
+ echo "$(echo "$VOL" | tail -n 1)" | gdbar -h 6 -w 50 -fg '#999' -bg '#444'
+}
+
+print_mute
+inotifywait -q -m /dev/snd/controlC0 -e ACCESS | while read i
+do
+ print_mute
+done
diff --git a/dzen2_all.sh b/dzen2_all.sh
new file mode 100755
index 0000000..8e96722
--- /dev/null
+++ b/dzen2_all.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# Wrapper to start dzen2 processes in new a process group.
+# With this, it is easier to kill all processes.
+
+while true; do
+ setsid /bin/sh ${HOME}/.dzen2/bin/dzen2_pgrp.sh $@
+ wait $!
+done
diff --git a/icons/cpu.xbm b/icons/cpu.xbm
new file mode 100644
index 0000000..4c34d58
--- /dev/null
+++ b/icons/cpu.xbm
@@ -0,0 +1,4 @@
+#define cpu_width 8
+#define cpu_height 8
+static unsigned char cpu_bits[] = {
+ 0xDB, 0x81, 0x3C, 0xBD, 0xBD, 0x3C, 0x81, 0xDB };
diff --git a/icons/mem.xbm b/icons/mem.xbm
new file mode 100644
index 0000000..a1c354e
--- /dev/null
+++ b/icons/mem.xbm
@@ -0,0 +1,4 @@
+#define mem_width 8
+#define mem_height 8
+static unsigned char mem_bits[] = {
+ 0xAA, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0x00, 0xAA };
diff --git a/icons/power-ac.xbm b/icons/power-ac.xbm
new file mode 100644
index 0000000..66592d7
--- /dev/null
+++ b/icons/power-ac.xbm
@@ -0,0 +1,4 @@
+#define ac_01_width 8
+#define ac_01_height 8
+static unsigned char ac_01_bits[] = {
+ 0x30, 0x28, 0xE4, 0x27, 0x27, 0xE4, 0x28, 0x30 };
diff --git a/icons/power-bat-empty.xbm b/icons/power-bat-empty.xbm
new file mode 100644
index 0000000..e26be8c
--- /dev/null
+++ b/icons/power-bat-empty.xbm
@@ -0,0 +1,4 @@
+#define bat_empty_02_width 8
+#define bat_empty_02_height 8
+static unsigned char bat_empty_02_bits[] = {
+ 0x00, 0x7F, 0x41, 0xC1, 0xC1, 0x41, 0x7F, 0x00 };
diff --git a/icons/power-bat-full.xbm b/icons/power-bat-full.xbm
new file mode 100644
index 0000000..93d2327
--- /dev/null
+++ b/icons/power-bat-full.xbm
@@ -0,0 +1,4 @@
+#define bat_full_02_width 8
+#define bat_full_02_height 8
+static unsigned char bat_full_02_bits[] = {
+ 0x00, 0x7F, 0x41, 0xDD, 0xDD, 0x41, 0x7F, 0x00 };
diff --git a/icons/power-bat-low.xbm b/icons/power-bat-low.xbm
new file mode 100644
index 0000000..d80a464
--- /dev/null
+++ b/icons/power-bat-low.xbm
@@ -0,0 +1,4 @@
+#define bat_low_02_width 8
+#define bat_low_02_height 8
+static unsigned char bat_low_02_bits[] = {
+ 0x00, 0x7F, 0x41, 0xC5, 0xC5, 0x41, 0x7F, 0x00 };
diff --git a/icons/vol-hi.xbm b/icons/vol-hi.xbm
new file mode 100644
index 0000000..7c2ffc4
--- /dev/null
+++ b/icons/vol-hi.xbm
@@ -0,0 +1,4 @@
+#define spkr_01_width 8
+#define spkr_01_height 8
+static unsigned char spkr_01_bits[] = {
+ 0x08, 0x4C, 0x8F, 0xAF, 0xAF, 0x8F, 0x4C, 0x08 };
diff --git a/icons/vol-mute.xbm b/icons/vol-mute.xbm
new file mode 100644
index 0000000..8265bf8
--- /dev/null
+++ b/icons/vol-mute.xbm
@@ -0,0 +1,4 @@
+#define spkr_02_width 8
+#define spkr_02_height 8
+static unsigned char spkr_02_bits[] = {
+ 0x08, 0x0C, 0x0F, 0x1F, 0x1F, 0x0F, 0x0C, 0x08 };