From c62af55fc23133e2e230a545c29606ac1cad4bac Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 29 Jun 2022 22:19:38 +0200 Subject: [PATCH] daytime-term: Support "day" and "night" options Use them in sway key bindings to change to the correct palettes. --- daytime-term | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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 "$@" -- 2.39.5