summary refs log tree commit diff
path: root/home/.local/bin/clock
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xhome/.local/bin/clock17
1 files changed, 17 insertions, 0 deletions
diff --git a/home/.local/bin/clock b/home/.local/bin/clock
new file mode 100755
index 00000000..ef8cd6d8
--- /dev/null
+++ b/home/.local/bin/clock
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -eu
+
+tput civis
+sleep=$(( 60 - $(date +'%S' | sed 's/^0//') ))
+while :; do
+	if [ $(apm -a) -eq 1 ]; then
+		printf '%3s%%' "$(apm -l)"
+	else
+		test $(apm -b) -eq 2 && tput setaf 1 bold
+		printf '%3.3sm' "$(apm -m)"
+		tput sgr0
+	fi
+	printf ' %s\r' "$(date +'%a %H:%M')"
+	sleep $sleep
+	sleep=60
+done