aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNPScript <nathan@reinerweb.ch>2022-05-01 14:39:40 +0200
committerNPScript <nathan@reinerweb.ch>2022-05-01 14:39:40 +0200
commit45e4db99d709cf278415e681c98a0204a9c8ca9e (patch)
tree1c99c327d11ee6e2a35c3cefafe26ff1c094d5ac
first sketch
-rw-r--r--Makefile2
-rw-r--r--README.md3
-rwxr-xr-xstatus42
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
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