From: Martin Pitt Date: Wed, 29 Jun 2022 20:19:38 +0000 (+0200) Subject: daytime-term: Support "day" and "night" options X-Git-Url: https://piware.de/gitweb/?a=commitdiff_plain;h=c62af55fc23133e2e230a545c29606ac1cad4bac;p=bin.git daytime-term: Support "day" and "night" options Use them in sway key bindings to change to the correct palettes. --- diff --git a/daytime-term b/daytime-term index eef0ccf..102e417 100755 --- a/daytime-term +++ b/daytime-term @@ -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 "$@"