Skip to content

Commit

Permalink
Merge pull request #124 from ucchiee/feature/time/arbitrary_format
Browse files Browse the repository at this point in the history
Added new options to use arbitrary time format.
  • Loading branch information
ethancedwards8 authored Apr 8, 2023
2 parents 872c128 + ffcefe3 commit 96a3984
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions scripts/dracula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 96a3984

Please sign in to comment.