Merge pull request #124 from ucchiee/feature/time/arbitrary_format

Added new options to use arbitrary time format.
This commit is contained in:
Ethan Edwards 2023-04-08 14:47:32 -04:00 committed by GitHub
commit 96a3984158
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,7 @@ main()
show_border_contrast=$(get_tmux_option "@dracula-border-contrast" false)
show_day_month=$(get_tmux_option "@dracula-day-month" false)
show_refresh=$(get_tmux_option "@dracula-refresh-rate" 5)
time_format=$(get_tmux_option "@dracula-time-format" "%Y-%m-%d(%a) %H:%M")
show_kubernetes_context_label=$(get_tmux_option "@dracula-kubernetes-context-label" "")
IFS=' ' read -r -a plugins <<< $(get_tmux_option "@dracula-plugins" "battery network weather")
@ -192,14 +193,18 @@ main()
elif [ $plugin = "time" ]; then
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-time-colors" "dark_purple white")
if $show_day_month && $show_military ; then # military time and dd/mm
script="%a %d/%m %R ${timezone} "
elif $show_military; then # only military time
script="%a %m/%d %R ${timezone} "
elif $show_day_month; then # only dd/mm
script="%a %d/%m %I:%M %p ${timezone} "
if [ -n "$time_format" ]; then
script=${time_format}
else
script="%a %m/%d %I:%M %p ${timezone} "
if $show_day_month && $show_military ; then # military time and dd/mm
script="%a %d/%m %R ${timezone} "
elif $show_military; then # only military time
script="%a %m/%d %R ${timezone} "
elif $show_day_month; then # only dd/mm
script="%a %d/%m %I:%M %p ${timezone} "
else
script="%a %m/%d %I:%M %p ${timezone} "
fi
fi
else