From 45e4db99d709cf278415e681c98a0204a9c8ca9e Mon Sep 17 00:00:00 2001 From: NPScript Date: Sun, 1 May 2022 14:39:40 +0200 Subject: first sketch --- Makefile | 2 ++ README.md | 3 +++ status | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 Makefile create mode 100644 README.md create mode 100755 status 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 diff --git a/status b/status new file mode 100755 index 0000000..def0663 --- /dev/null +++ b/status @@ -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 -- cgit v1.2.3-70-g09d2