From 5d4a749b7c51649bcd3953cd1686856408d08121 Mon Sep 17 00:00:00 2001 From: davidpkj Date: Sat, 3 Dec 2022 22:26:26 +0100 Subject: Merge in dotfiles --- scripts/.local/bin/personal/bar/status | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 scripts/.local/bin/personal/bar/status (limited to 'scripts/.local/bin/personal/bar/status') diff --git a/scripts/.local/bin/personal/bar/status b/scripts/.local/bin/personal/bar/status new file mode 100755 index 0000000..10c33de --- /dev/null +++ b/scripts/.local/bin/personal/bar/status @@ -0,0 +1,30 @@ +#!/bin/dash + +# loads colors +. ~/.cache/wal/colors.sh + +SEPARATOR=" " + +# default color button +use() { + printf "%s^c%s^^b%s^ %s ^b%s^ %s ^b%s^" "$SEPARATOR" "$color0" "$color1" "$1" "$color2" "$2" "$color0" +} + +# show in specified color if specified condition is true +usecolorif() { + if [ "$3" = "1" ]; then + printf "%s^c%s^^b%s^ %s ^c%s^^b%s^ %s ^b%s^" "$SEPARATOR" "$color1" "$color0" "$1" "$color2" "$color0" "$2" "$color0" + else + use "$1" "$2" + fi +} + +# only show if content is not zero +useif() { + if [ -n "$2" ]; then + use "$1" "$2" + fi +} + +# actual string +echo "$(useif "" "$(updates read)")$(useif "" "$(volume)")$(use "" "$(lights)")$(usecolorif "ﴞ" "$(battery)" "$(battery condition)")$(useif "說" "$(network)")$(use "" "$(datetime time)")$(use "" "$(datetime date)")" -- cgit v1.2.3