From ada270d130d6372840169fd6de64adbfde9fb924 Mon Sep 17 00:00:00 2001 From: winston Date: Sun, 31 Jul 2022 09:23:51 +0200 Subject: [PATCH] fix(sketchybar,polybar): better fallback date --- dot_config/polybar/config.ini | 2 +- dot_config/sketchybar/plugins/executable_ddate.sh | 3 +-- dot_local/bin/executable_bar_date | 7 +++++++ 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 dot_local/bin/executable_bar_date diff --git a/dot_config/polybar/config.ini b/dot_config/polybar/config.ini index 5954aea..9b5b19a 100644 --- a/dot_config/polybar/config.ini +++ b/dot_config/polybar/config.ini @@ -107,7 +107,7 @@ type = custom/script interval = 60 # fall back to normie date if discordian date is not available -exec = (ddate +'%{%A, %b %d%}' || date +'%A, %b %d') +exec = bar_date format-foreground = ${colors.blue} label =  %output% diff --git a/dot_config/sketchybar/plugins/executable_ddate.sh b/dot_config/sketchybar/plugins/executable_ddate.sh index b932590..1fddd44 100644 --- a/dot_config/sketchybar/plugins/executable_ddate.sh +++ b/dot_config/sketchybar/plugins/executable_ddate.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -DATE="$(ddate +'%{%A, %b %d%}' | date +'%A, %b %d')" -sketchybar --set "$NAME" label="$DATE" icon=" " +sketchybar --set "$NAME" label="$(bar_date)" icon=" " diff --git a/dot_local/bin/executable_bar_date b/dot_local/bin/executable_bar_date new file mode 100644 index 0000000..3916ad0 --- /dev/null +++ b/dot_local/bin/executable_bar_date @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [[ -x "$(command -v ddate)" ]]; then + ddate +'%{%A, %b %d%}' +else + date +'%A, %b %d' +fi