diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | README.md | 3 | ||||
| -rwxr-xr-x | status | 42 |
3 files changed, 47 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..90259b2 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +install: + install -D status /usr/local/bin diff --git a/README.md b/README.md new file mode 100644 index 0000000..eb26d3e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# status + +This is a status script for dwm @@ -0,0 +1,42 @@ +#!/bin/sh + +CMDFIFO=~/.cache/status + +clockupdate() { + while (true); do + echo update clock > $CMDFIFO + sleep 60 + done +} + +daemon() { + [ ! -p "$CMDFIFO" ] && mkfifo $CMDFIFO + + clockupdate & + + status() { + xsetroot -name " $(cat) " + } + + cmd="" + + while (true); do + echo "$(volume)|$(clock)" | column -t -s '|' | status + cmd=$(cat $CMDFIFO) + done + + rm $CMDFIFO +} + +help() { + echo "status:" + echo " -h - this help page" + echo " -u [unit] - update unit" + echo " -d - run daemon" +} + +case "$1" in + -d) daemon;; + -u) echo "$2" > $CMDFIFO;; + -h) help;; +esac |