]> piware.de Git - bin.git/commitdiff
daytime-term: Support "day" and "night" options
authorMartin Pitt <martin@piware.de>
Wed, 29 Jun 2022 20:19:38 +0000 (22:19 +0200)
committerMartin Pitt <martin@piware.de>
Wed, 29 Jun 2022 20:19:38 +0000 (22:19 +0200)
Use them in sway key bindings to change to the correct palettes.

daytime-term

index eef0ccfc323afb0d0139b319fee33579cf3463f7..102e417c8ced4479a89f62eb3152a86e7ed5437b 100755 (executable)
@@ -1,9 +1,19 @@
 #!/bin/sh
+set -eu
 
-if [ `date +%k` -ge 20 ] || [ `date +%k` -lt 5 ]; then
-    ARGS="-bg black -fg lightgray"
+if [ "${1:-}" = "night" ]; then
+    shift
+    night=1
+elif [ "${1:-}" = "day" ]; then
+    night=
+elif [ `date +%k` -ge 20 ] || [ `date +%k` -lt 5 ]; then
+    night=1
+fi
+
+if [ -n "${night:-}" ]; then
+    ARGS="-bg black -fg lightgray -palette #000000,#aa0000,#00aa00,#aaaa00,#6060f0,#aa00aa,#00aaaa,#aaaaaa,#545454,#ff5454,#54ff54,#ffff54,#5454ff,#ff54ff,#54ffff,#ffffff"
 else
-    ARGS="-bg white -fg black"
+    ARGS="-bg white -fg black -palette #000000,#aa0000,#00aa00,#aa5400,#3030cc,#aa00aa,#00aaaa,#aaaaaa,#545454,#ff5454,#54ff54,#ffff54,#5454ff,#ff54ff,#54ffff,#ffffff"
 fi
 
 simple-term -fn "monospace 9" $ARGS "$@"