From 940d2927125755702eaecc01dfa57913783cafff Mon Sep 17 00:00:00 2001 From: Luis Freixial <48995671+lfreixial@users.noreply.github.com> Date: Sat, 5 Jul 2025 22:38:49 +0100 Subject: [PATCH 01/11] script to get two time --- scripts/dracula.sh | 145 ++++++++++++++++++++++--------------------- scripts/dual_time.sh | 16 +++++ 2 files changed, 90 insertions(+), 71 deletions(-) create mode 100755 scripts/dual_time.sh diff --git a/scripts/dracula.sh b/scripts/dracula.sh index 172a6da0..ee263231 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -2,7 +2,7 @@ # setting the locale, some users have issues with different locales, this forces the correct one export LC_ALL=en_US.UTF-8 -current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source $current_dir/utils.sh main() { @@ -41,9 +41,9 @@ main() { narrow_mode=$(get_tmux_option "@dracula-narrow-mode" false) if $narrow_mode; then - IFS=' ' read -r -a plugins <<< $(get_tmux_option "@dracula-narrow-plugins" "compact-alt battery network weather") + IFS=' ' read -r -a plugins <<<$(get_tmux_option "@dracula-narrow-plugins" "compact-alt battery network weather") else - IFS=' ' read -r -a plugins <<< $(get_tmux_option "@dracula-plugins" "battery network weather") + IFS=' ' read -r -a plugins <<<$(get_tmux_option "@dracula-plugins" "battery network weather") fi # Dracula Color Pallette @@ -67,16 +67,16 @@ main() { # Set transparency variables - Colors and window dividers if $transparent_powerline_bg; then - bg_color="default" - if $show_edge_icons; then - window_sep_fg=${dark_purple} - window_sep_bg=default - window_sep="$show_right_sep" - else - window_sep_fg=${dark_purple} - window_sep_bg=default - window_sep="$show_inverse_divider" - fi + bg_color="default" + if $show_edge_icons; then + window_sep_fg=${dark_purple} + window_sep_bg=default + window_sep="$show_right_sep" + else + window_sep_fg=${dark_purple} + window_sep_bg=default + window_sep="$show_inverse_divider" + fi else bg_color=${gray} if $show_edge_icons; then @@ -92,18 +92,24 @@ main() { # Handle left icon configuration case $show_left_icon in - smiley) - left_icon="☺";; - session) - left_icon="#S";; - window) - left_icon="#W";; - hostname) - left_icon="#H";; - shortname) - left_icon="#h";; - *) - left_icon=$show_left_icon;; + smiley) + left_icon="☺" + ;; + session) + left_icon="#S" + ;; + window) + left_icon="#W" + ;; + hostname) + left_icon="#H" + ;; + shortname) + left_icon="#h" + ;; + *) + left_icon=$show_left_icon + ;; esac # Handle left icon padding @@ -122,20 +128,24 @@ main() { # Set timezone unless hidden by configuration if [[ -z "$timezone" ]]; then case $show_timezone in - false) - timezone="";; - true) - timezone="#(date +%Z)";; + false) + timezone="" + ;; + true) + timezone="#(date +%Z)" + ;; esac fi case $show_flags in - false) - flags="" - current_flags="";; - true) - flags="#{?window_flags,#[fg=${dark_purple}]#{window_flags},}" - current_flags="#{?window_flags,#[fg=${light_purple}]#{window_flags},}" + false) + flags="" + current_flags="" + ;; + true) + flags="#{?window_flags,#[fg=${dark_purple}]#{window_flags},}" + current_flags="#{?window_flags,#[fg=${light_purple}]#{window_flags},}" + ;; esac # sets refresh interval to every 5 seconds @@ -183,7 +193,7 @@ main() { for plugin in "${plugins[@]}"; do - if case $plugin in custom:*) true;; *) false;; esac; then + if case $plugin in custom:*) true ;; *) false ;; esac then script=${plugin#"custom:"} if [[ -x "${current_dir}/${script}" ]]; then IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-custom-plugin-colors" "cyan dark_gray") @@ -195,64 +205,64 @@ main() { fi elif [ $plugin = "compact-alt" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-compact-alt-colors" "dark_gray white") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-compact-alt-colors" "dark_gray white") tmux set-option -g status-right-length 250 script="#($current_dir/compact_alt.sh)" elif [ $plugin = "cwd" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-cwd-colors" "dark_gray white") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-cwd-colors" "dark_gray white") tmux set-option -g status-right-length 250 script="#($current_dir/cwd.sh)" elif [ $plugin = "fossil" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-fossil-colors" "green dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-fossil-colors" "green dark_gray") tmux set-option -g status-right-length 250 script="#($current_dir/fossil.sh)" elif [ $plugin = "git" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-git-colors" "green dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-git-colors" "green dark_gray") tmux set-option -g status-right-length 250 script="#($current_dir/git.sh)" elif [ $plugin = "hg" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-hg-colors" "green dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-hg-colors" "green dark_gray") tmux set-option -g status-right-length 250 script="#($current_dir/hg.sh)" elif [ $plugin = "battery" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-battery-colors" "pink dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-battery-colors" "pink dark_gray") script="#($current_dir/battery.sh)" elif [ $plugin = "gpu-usage" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-gpu-usage-colors" "pink dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-gpu-usage-colors" "pink dark_gray") script="#($current_dir/gpu_usage.sh)" elif [ $plugin = "gpu-ram-usage" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-gpu-ram-usage-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-gpu-ram-usage-colors" "cyan dark_gray") script="#($current_dir/gpu_ram_info.sh)" elif [ $plugin = "gpu-power-draw" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-gpu-power-draw-colors" "green dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-gpu-power-draw-colors" "green dark_gray") script="#($current_dir/gpu_power.sh)" elif [ $plugin = "cpu-usage" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-cpu-usage-colors" "orange dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-cpu-usage-colors" "orange dark_gray") script="#($current_dir/cpu_info.sh)" elif [ $plugin = "ram-usage" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-ram-usage-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-ram-usage-colors" "cyan dark_gray") script="#($current_dir/ram_info.sh)" elif [ $plugin = "tmux-ram-usage" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-tmux-ram-usage-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-tmux-ram-usage-colors" "cyan dark_gray") script="#($current_dir/tmux_ram_info.sh)" elif [ $plugin = "network" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-network-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-network-colors" "cyan dark_gray") script="#($current_dir/network.sh)" elif [ $plugin = "network-bandwidth" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-network-bandwidth-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-network-bandwidth-colors" "cyan dark_gray") tmux set-option -g status-right-length 250 script="#($current_dir/network_bandwidth.sh)" @@ -297,34 +307,27 @@ main() { script="#($current_dir/continuum.sh)" elif [ $plugin = "weather" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-weather-colors" "orange dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-weather-colors" "orange dark_gray") script="#($current_dir/weather_wrapper.sh $show_fahrenheit $show_location '$fixed_location')" elif [ $plugin = "time" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-time-colors" "dark_purple white") - if [ -n "$time_format" ]; then - script=${time_format} + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-time-colors" "dark_purple white") + if $show_military; then + script="#($current_dir/dual_time.sh military)" else - 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="%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 + script="#($current_dir/dual_time.sh)" fi + elif [ $plugin = "synchronize-panes" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-synchronize-panes-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-synchronize-panes-colors" "cyan dark_gray") script="#($current_dir/synchronize_panes.sh $show_synchronize_panes_label)" elif [ $plugin = "libreview" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-libre-colors" "white dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-libre-colors" "white dark_gray") script="#($current_dir/libre.sh $show_libreview)" elif [ $plugin = "ssh-session" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-ssh-session-colors" "green dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-ssh-session-colors" "green dark_gray") script="#($current_dir/ssh_session.sh $show_ssh_session_port)" elif [ $plugin = "network-public-ip" ]; then @@ -332,15 +335,15 @@ main() { script="#($current_dir/network-public-ip.sh)" elif [ $plugin = "sys-temp" ]; then - IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-sys-temp-colors" "green dark_gray") + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-sys-temp-colors" "green dark_gray") script="#($current_dir/sys_temp.sh)" elif [ $plugin = "cpu-arch" ]; then - IFS=$' ' read -r -a colors <<< $(get_tmux_option "@dracula-cpu-arch-colors" "default default") + IFS=$' ' read -r -a colors <<<$(get_tmux_option "@dracula-cpu-arch-colors" "default default") script="#($current_dir/cpu_arch.sh)" elif [ $plugin = "uptime" ]; then - IFS=$' ' read -r -a colors <<< $(get_tmux_option "@dracula-uptime-colors" "default default") + IFS=$' ' read -r -a colors <<<$(get_tmux_option "@dracula-uptime-colors" "default default") script="#($current_dir/uptime.sh)" else @@ -359,8 +362,8 @@ main() { if $show_empty_plugins; then tmux set-option -ga status-right " #[fg=${!colors[0]},bg=${background_color},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon" else - tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[0]},nobold,nounderscore,noitalics] ${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon}" - fi + tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[0]},nobold,nounderscore,noitalics] ${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon}" + fi powerbg=${!colors[0]} else if $show_empty_plugins; then diff --git a/scripts/dual_time.sh b/scripts/dual_time.sh new file mode 100755 index 00000000..4d519f60 --- /dev/null +++ b/scripts/dual_time.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +belfast_label="Belfast" +belfast_tz="Europe/London" +newyork_label="New York" +newyork_tz="America/New_York" +if [ "$1" = "military" ]; then + time_fmt="%H:%M" +else + time_fmt="%I:%M %p" +fi + +belfast_time=$(env TZ=$belfast_tz /bin/date +"${belfast_label} ${time_fmt}") +newyork_time=$(env TZ=$newyork_tz /bin/date +"${newyork_label} ${time_fmt}") + +echo "$belfast_time | $newyork_time" From fc042863c96d667ce0aff99080371e0167f1efe3 Mon Sep 17 00:00:00 2001 From: Luis Freixial <48995671+lfreixial@users.noreply.github.com> Date: Tue, 8 Jul 2025 22:19:41 +0100 Subject: [PATCH 02/11] support different times --- scripts/dracula.sh | 6 +----- scripts/dual_time.sh | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/scripts/dracula.sh b/scripts/dracula.sh index ee263231..d1574e05 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -312,11 +312,7 @@ main() { elif [ $plugin = "time" ]; then IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-time-colors" "dark_purple white") - if $show_military; then - script="#($current_dir/dual_time.sh military)" - else - script="#($current_dir/dual_time.sh)" - fi + script="#($current_dir/dual_time.sh)" elif [ $plugin = "synchronize-panes" ]; then IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-synchronize-panes-colors" "cyan dark_gray") diff --git a/scripts/dual_time.sh b/scripts/dual_time.sh index 4d519f60..c3ee951c 100755 --- a/scripts/dual_time.sh +++ b/scripts/dual_time.sh @@ -1,16 +1,35 @@ #!/usr/bin/env bash -belfast_label="Belfast" -belfast_tz="Europe/London" -newyork_label="New York" -newyork_tz="America/New_York" -if [ "$1" = "military" ]; then +military=$(tmux show-option -gqv "@dracula-time-military" | tr '[:upper:]' '[:lower:]') + +time_fmt="%I:%M %p" + +if [[ "$military" == "true" || "$military" == "1" ]]; then time_fmt="%H:%M" -else - time_fmt="%I:%M %p" fi -belfast_time=$(env TZ=$belfast_tz /bin/date +"${belfast_label} ${time_fmt}") -newyork_time=$(env TZ=$newyork_tz /bin/date +"${newyork_label} ${time_fmt}") +timezones=$(tmux show-option -gqv "@dracula-time") +[ -z "$timezones" ] && timezones="UTC" + +IFS=',' read -ra TZ_ARRAY <<<"$timezones" + +output=() +for tz in "${TZ_ARRAY[@]}"; do + tz=$(echo "$tz" | xargs) # Trim whitespace + label=$(basename "$tz" | tr '_' ' ') + if [ -f "/usr/share/zoneinfo/$tz" ]; then + time=$(env TZ="$tz" /bin/date +"${label} ${time_fmt}") + output+=("$time") + else + output+=("${label} N/A") + fi +done -echo "$belfast_time | $newyork_time" +joined="" +for i in "${!output[@]}"; do + if [ "$i" -gt 0 ]; then + joined+=" | " + fi + joined+="${output[$i]}" +done +echo "$joined" From d59c78226c68a9a03a89b623a93e4f2ed2ca7a88 Mon Sep 17 00:00:00 2001 From: Luis Freixial <48995671+lfreixial@users.noreply.github.com> Date: Wed, 9 Jul 2025 22:10:35 +0100 Subject: [PATCH 03/11] show repo name on status bar --- scripts/git.sh | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/scripts/git.sh b/scripts/git.sh index 965d9eca..adc32b90 100755 --- a/scripts/git.sh +++ b/scripts/git.sh @@ -9,6 +9,7 @@ IFS=' ' read -r -a diff_symbol <<< $(get_tmux_option "@dracula-git-show-diff-sym IFS=' ' read -r -a no_repo_message <<< $(get_tmux_option "@dracula-git-no-repo-message" "") IFS=' ' read -r -a no_untracked_files <<< $(get_tmux_option "@dracula-git-no-untracked-files" "false") IFS=' ' read -r -a show_remote_status <<< $(get_tmux_option "@dracula-git-show-remote-status" "false") +IFS=' ' read -r -a show_repo_name <<<$(get_tmux_option "@dracula-git-show-repo-name" "false") # Get added, modified, updated and deleted files from git status getChanges() @@ -129,11 +130,25 @@ getRemoteInfo() echo "$out" } +getRepoName() +{ + if [ "$show_repo_name" = "true" ]; then + if [ $(checkForGitDir) == "true" ]; then + echo "$(basename "$(git -C $path rev-parse --show-toplevel 2>/dev/null)") |" + else + echo "" + fi + else + echo "" + fi +} + # return the final message for the status bar getMessage() { if [ $(checkForGitDir) == "true" ]; then branch="$(getBranch)" + repo_name="$(getRepoName)" output="" if [ $(checkForChanges) == "true" ]; then @@ -142,23 +157,23 @@ getMessage() if [ "${hide_status}" == "false" ]; then if [ $(checkEmptySymbol $diff_symbol) == "true" ]; then - output=$(echo "${changes} $branch") + output=$(echo "$repo_name ${changes} $branch") else - output=$(echo "$diff_symbol ${changes} $branch") + output=$(echo "$repo_name $diff_symbol ${changes} $branch") fi else if [ $(checkEmptySymbol $diff_symbol) == "true" ]; then - output=$(echo "$branch") + output=$(echo "$repo_name $branch") else - output=$(echo "$diff_symbol $branch") + output=$(echo "$repo_name $diff_symbol $branch") fi fi else if [ $(checkEmptySymbol $current_symbol) == "true" ]; then - output=$(echo "$branch") + output=$(echo "$repo_name $branch") else - output=$(echo "$current_symbol $branch") + output=$(echo "$repo_name $current_symbol $branch") fi fi From 9990a5ffe25cb394120432dc2fd4f75eb0f4977f Mon Sep 17 00:00:00 2001 From: Luis Freixial <48995671+lfreixial@users.noreply.github.com> Date: Wed, 9 Jul 2025 22:17:42 +0100 Subject: [PATCH 04/11] remove changes from fork repo --- scripts/dracula.sh | 145 ++++++++++++++++++++++--------------------- scripts/dual_time.sh | 35 ----------- 2 files changed, 73 insertions(+), 107 deletions(-) delete mode 100755 scripts/dual_time.sh diff --git a/scripts/dracula.sh b/scripts/dracula.sh index d1574e05..172a6da0 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -2,7 +2,7 @@ # setting the locale, some users have issues with different locales, this forces the correct one export LC_ALL=en_US.UTF-8 -current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source $current_dir/utils.sh main() { @@ -41,9 +41,9 @@ main() { narrow_mode=$(get_tmux_option "@dracula-narrow-mode" false) if $narrow_mode; then - IFS=' ' read -r -a plugins <<<$(get_tmux_option "@dracula-narrow-plugins" "compact-alt battery network weather") + IFS=' ' read -r -a plugins <<< $(get_tmux_option "@dracula-narrow-plugins" "compact-alt battery network weather") else - IFS=' ' read -r -a plugins <<<$(get_tmux_option "@dracula-plugins" "battery network weather") + IFS=' ' read -r -a plugins <<< $(get_tmux_option "@dracula-plugins" "battery network weather") fi # Dracula Color Pallette @@ -67,16 +67,16 @@ main() { # Set transparency variables - Colors and window dividers if $transparent_powerline_bg; then - bg_color="default" - if $show_edge_icons; then - window_sep_fg=${dark_purple} - window_sep_bg=default - window_sep="$show_right_sep" - else - window_sep_fg=${dark_purple} - window_sep_bg=default - window_sep="$show_inverse_divider" - fi + bg_color="default" + if $show_edge_icons; then + window_sep_fg=${dark_purple} + window_sep_bg=default + window_sep="$show_right_sep" + else + window_sep_fg=${dark_purple} + window_sep_bg=default + window_sep="$show_inverse_divider" + fi else bg_color=${gray} if $show_edge_icons; then @@ -92,24 +92,18 @@ main() { # Handle left icon configuration case $show_left_icon in - smiley) - left_icon="☺" - ;; - session) - left_icon="#S" - ;; - window) - left_icon="#W" - ;; - hostname) - left_icon="#H" - ;; - shortname) - left_icon="#h" - ;; - *) - left_icon=$show_left_icon - ;; + smiley) + left_icon="☺";; + session) + left_icon="#S";; + window) + left_icon="#W";; + hostname) + left_icon="#H";; + shortname) + left_icon="#h";; + *) + left_icon=$show_left_icon;; esac # Handle left icon padding @@ -128,24 +122,20 @@ main() { # Set timezone unless hidden by configuration if [[ -z "$timezone" ]]; then case $show_timezone in - false) - timezone="" - ;; - true) - timezone="#(date +%Z)" - ;; + false) + timezone="";; + true) + timezone="#(date +%Z)";; esac fi case $show_flags in - false) - flags="" - current_flags="" - ;; - true) - flags="#{?window_flags,#[fg=${dark_purple}]#{window_flags},}" - current_flags="#{?window_flags,#[fg=${light_purple}]#{window_flags},}" - ;; + false) + flags="" + current_flags="";; + true) + flags="#{?window_flags,#[fg=${dark_purple}]#{window_flags},}" + current_flags="#{?window_flags,#[fg=${light_purple}]#{window_flags},}" esac # sets refresh interval to every 5 seconds @@ -193,7 +183,7 @@ main() { for plugin in "${plugins[@]}"; do - if case $plugin in custom:*) true ;; *) false ;; esac then + if case $plugin in custom:*) true;; *) false;; esac; then script=${plugin#"custom:"} if [[ -x "${current_dir}/${script}" ]]; then IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-custom-plugin-colors" "cyan dark_gray") @@ -205,64 +195,64 @@ main() { fi elif [ $plugin = "compact-alt" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-compact-alt-colors" "dark_gray white") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-compact-alt-colors" "dark_gray white") tmux set-option -g status-right-length 250 script="#($current_dir/compact_alt.sh)" elif [ $plugin = "cwd" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-cwd-colors" "dark_gray white") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-cwd-colors" "dark_gray white") tmux set-option -g status-right-length 250 script="#($current_dir/cwd.sh)" elif [ $plugin = "fossil" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-fossil-colors" "green dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-fossil-colors" "green dark_gray") tmux set-option -g status-right-length 250 script="#($current_dir/fossil.sh)" elif [ $plugin = "git" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-git-colors" "green dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-git-colors" "green dark_gray") tmux set-option -g status-right-length 250 script="#($current_dir/git.sh)" elif [ $plugin = "hg" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-hg-colors" "green dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-hg-colors" "green dark_gray") tmux set-option -g status-right-length 250 script="#($current_dir/hg.sh)" elif [ $plugin = "battery" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-battery-colors" "pink dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-battery-colors" "pink dark_gray") script="#($current_dir/battery.sh)" elif [ $plugin = "gpu-usage" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-gpu-usage-colors" "pink dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-gpu-usage-colors" "pink dark_gray") script="#($current_dir/gpu_usage.sh)" elif [ $plugin = "gpu-ram-usage" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-gpu-ram-usage-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-gpu-ram-usage-colors" "cyan dark_gray") script="#($current_dir/gpu_ram_info.sh)" elif [ $plugin = "gpu-power-draw" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-gpu-power-draw-colors" "green dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-gpu-power-draw-colors" "green dark_gray") script="#($current_dir/gpu_power.sh)" elif [ $plugin = "cpu-usage" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-cpu-usage-colors" "orange dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-cpu-usage-colors" "orange dark_gray") script="#($current_dir/cpu_info.sh)" elif [ $plugin = "ram-usage" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-ram-usage-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-ram-usage-colors" "cyan dark_gray") script="#($current_dir/ram_info.sh)" elif [ $plugin = "tmux-ram-usage" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-tmux-ram-usage-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-tmux-ram-usage-colors" "cyan dark_gray") script="#($current_dir/tmux_ram_info.sh)" elif [ $plugin = "network" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-network-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-network-colors" "cyan dark_gray") script="#($current_dir/network.sh)" elif [ $plugin = "network-bandwidth" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-network-bandwidth-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-network-bandwidth-colors" "cyan dark_gray") tmux set-option -g status-right-length 250 script="#($current_dir/network_bandwidth.sh)" @@ -307,23 +297,34 @@ main() { script="#($current_dir/continuum.sh)" elif [ $plugin = "weather" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-weather-colors" "orange dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-weather-colors" "orange dark_gray") script="#($current_dir/weather_wrapper.sh $show_fahrenheit $show_location '$fixed_location')" elif [ $plugin = "time" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-time-colors" "dark_purple white") - script="#($current_dir/dual_time.sh)" - + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-time-colors" "dark_purple white") + if [ -n "$time_format" ]; then + script=${time_format} + else + 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="%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 elif [ $plugin = "synchronize-panes" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-synchronize-panes-colors" "cyan dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-synchronize-panes-colors" "cyan dark_gray") script="#($current_dir/synchronize_panes.sh $show_synchronize_panes_label)" elif [ $plugin = "libreview" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-libre-colors" "white dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-libre-colors" "white dark_gray") script="#($current_dir/libre.sh $show_libreview)" elif [ $plugin = "ssh-session" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-ssh-session-colors" "green dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-ssh-session-colors" "green dark_gray") script="#($current_dir/ssh_session.sh $show_ssh_session_port)" elif [ $plugin = "network-public-ip" ]; then @@ -331,15 +332,15 @@ main() { script="#($current_dir/network-public-ip.sh)" elif [ $plugin = "sys-temp" ]; then - IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-sys-temp-colors" "green dark_gray") + IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-sys-temp-colors" "green dark_gray") script="#($current_dir/sys_temp.sh)" elif [ $plugin = "cpu-arch" ]; then - IFS=$' ' read -r -a colors <<<$(get_tmux_option "@dracula-cpu-arch-colors" "default default") + IFS=$' ' read -r -a colors <<< $(get_tmux_option "@dracula-cpu-arch-colors" "default default") script="#($current_dir/cpu_arch.sh)" elif [ $plugin = "uptime" ]; then - IFS=$' ' read -r -a colors <<<$(get_tmux_option "@dracula-uptime-colors" "default default") + IFS=$' ' read -r -a colors <<< $(get_tmux_option "@dracula-uptime-colors" "default default") script="#($current_dir/uptime.sh)" else @@ -358,8 +359,8 @@ main() { if $show_empty_plugins; then tmux set-option -ga status-right " #[fg=${!colors[0]},bg=${background_color},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon" else - tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[0]},nobold,nounderscore,noitalics] ${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon}" - fi + tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[0]},nobold,nounderscore,noitalics] ${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon}" + fi powerbg=${!colors[0]} else if $show_empty_plugins; then diff --git a/scripts/dual_time.sh b/scripts/dual_time.sh deleted file mode 100755 index c3ee951c..00000000 --- a/scripts/dual_time.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -military=$(tmux show-option -gqv "@dracula-time-military" | tr '[:upper:]' '[:lower:]') - -time_fmt="%I:%M %p" - -if [[ "$military" == "true" || "$military" == "1" ]]; then - time_fmt="%H:%M" -fi - -timezones=$(tmux show-option -gqv "@dracula-time") -[ -z "$timezones" ] && timezones="UTC" - -IFS=',' read -ra TZ_ARRAY <<<"$timezones" - -output=() -for tz in "${TZ_ARRAY[@]}"; do - tz=$(echo "$tz" | xargs) # Trim whitespace - label=$(basename "$tz" | tr '_' ' ') - if [ -f "/usr/share/zoneinfo/$tz" ]; then - time=$(env TZ="$tz" /bin/date +"${label} ${time_fmt}") - output+=("$time") - else - output+=("${label} N/A") - fi -done - -joined="" -for i in "${!output[@]}"; do - if [ "$i" -gt 0 ]; then - joined+=" | " - fi - joined+="${output[$i]}" -done -echo "$joined" From 7c44e2e6c82266a0648b1ee52b80216920c15eaf Mon Sep 17 00:00:00 2001 From: Luis Freixial <48995671+lfreixial@users.noreply.github.com> Date: Wed, 9 Jul 2025 22:26:24 +0100 Subject: [PATCH 05/11] address coderabbit comment --- scripts/git.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/scripts/git.sh b/scripts/git.sh index adc32b90..ec526b00 100755 --- a/scripts/git.sh +++ b/scripts/git.sh @@ -132,14 +132,9 @@ getRemoteInfo() getRepoName() { - if [ "$show_repo_name" = "true" ]; then - if [ $(checkForGitDir) == "true" ]; then - echo "$(basename "$(git -C $path rev-parse --show-toplevel 2>/dev/null)") |" - else - echo "" - fi - else - echo "" + if [ "$show_repo_name" == "true" ] && [ "$(checkForGitDir)" == "true" ]; then + repo="$(basename "$(git -C $path rev-parse --show-toplevel 2>/dev/null)")" + echo "$repo |" fi } From 0e215d9af2c93f1346a6ada900c5c842bcc80a0c Mon Sep 17 00:00:00 2001 From: Luis Freixial <48995671+lfreixial@users.noreply.github.com> Date: Fri, 11 Jul 2025 21:18:28 +0100 Subject: [PATCH 06/11] chore: address coderabbit comments --- scripts/git.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/git.sh b/scripts/git.sh index ec526b00..d23ab945 100755 --- a/scripts/git.sh +++ b/scripts/git.sh @@ -9,7 +9,7 @@ IFS=' ' read -r -a diff_symbol <<< $(get_tmux_option "@dracula-git-show-diff-sym IFS=' ' read -r -a no_repo_message <<< $(get_tmux_option "@dracula-git-no-repo-message" "") IFS=' ' read -r -a no_untracked_files <<< $(get_tmux_option "@dracula-git-no-untracked-files" "false") IFS=' ' read -r -a show_remote_status <<< $(get_tmux_option "@dracula-git-show-remote-status" "false") -IFS=' ' read -r -a show_repo_name <<<$(get_tmux_option "@dracula-git-show-repo-name" "false") +show_repo_name="$(get_tmux_option "@dracula-git-show-repo-name" "false")" # Get added, modified, updated and deleted files from git status getChanges() @@ -154,7 +154,7 @@ getMessage() if [ $(checkEmptySymbol $diff_symbol) == "true" ]; then output=$(echo "$repo_name ${changes} $branch") else - output=$(echo "$repo_name $diff_symbol ${changes} $branch") + output="$repo_name ${diff_symbol[0]} ${changes:+$changes }$branch" fi else if [ $(checkEmptySymbol $diff_symbol) == "true" ]; then From 960a6d27676e29441f043143744d917af426d63a Mon Sep 17 00:00:00 2001 From: Luis Freixial <48995671+lfreixial@users.noreply.github.com> Date: Fri, 11 Jul 2025 21:24:23 +0100 Subject: [PATCH 07/11] chore: address coderabbit comments --- scripts/git.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/git.sh b/scripts/git.sh index d23ab945..778a2616 100755 --- a/scripts/git.sh +++ b/scripts/git.sh @@ -132,8 +132,8 @@ getRemoteInfo() getRepoName() { - if [ "$show_repo_name" == "true" ] && [ "$(checkForGitDir)" == "true" ]; then - repo="$(basename "$(git -C $path rev-parse --show-toplevel 2>/dev/null)")" + if [ "$show_repo_name" = "true" ] && [ "$(checkForGitDir)" = "true" ]; then + repo="$(basename "$(git -C "$path" --no-optional-locks rev-parse --show-toplevel 2>/dev/null)")" echo "$repo |" fi } @@ -152,7 +152,7 @@ getMessage() if [ "${hide_status}" == "false" ]; then if [ $(checkEmptySymbol $diff_symbol) == "true" ]; then - output=$(echo "$repo_name ${changes} $branch") + output="$repo_name${changes:+ ${changes}} $branch" else output="$repo_name ${diff_symbol[0]} ${changes:+$changes }$branch" fi @@ -168,7 +168,7 @@ getMessage() if [ $(checkEmptySymbol $current_symbol) == "true" ]; then output=$(echo "$repo_name $branch") else - output=$(echo "$repo_name $current_symbol $branch") + output="$repo_name ${current_symbol[0]} $branch" fi fi From fe202ab469851b58b811c6af59f49be20d6c5742 Mon Sep 17 00:00:00 2001 From: Luis Freixial <48995671+lfreixial@users.noreply.github.com> Date: Fri, 11 Jul 2025 21:28:42 +0100 Subject: [PATCH 08/11] docs: update docs --- docs/CONFIG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 06d19292..5439d6aa 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -347,6 +347,12 @@ Show remote tracking branch together with diverge/sync state set -g @dracula-git-show-remote-status true ``` +Show the current repository name in the status bar +```bash +# default is false +set -g @dracula-git-show-repo-name true +``` + ### gpu-info - [up](#table-of-contents) These widgets display the current computational, ram, and power usage of installed graphics cards. They are split into widgets with the names: `gpu-usage, gpu-ram-usage, gpu-power-draw`. From 80b3993f4fd85d48109455504bd4ba7dcbdd90f4 Mon Sep 17 00:00:00 2001 From: Luis Freixial <48995671+lfreixial@users.noreply.github.com> Date: Fri, 11 Jul 2025 21:35:04 +0100 Subject: [PATCH 09/11] chore: address coderabbit comments --- scripts/git.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/git.sh b/scripts/git.sh index 778a2616..67dc5362 100755 --- a/scripts/git.sh +++ b/scripts/git.sh @@ -151,13 +151,13 @@ getMessage() changes="$(getChanges)" if [ "${hide_status}" == "false" ]; then - if [ $(checkEmptySymbol $diff_symbol) == "true" ]; then + if [ "$(checkEmptySymbol "${diff_symbol[0]}")" = "true" ]; then output="$repo_name${changes:+ ${changes}} $branch" else output="$repo_name ${diff_symbol[0]} ${changes:+$changes }$branch" fi else - if [ $(checkEmptySymbol $diff_symbol) == "true" ]; then + if [ "$(checkEmptySymbol "${diff_symbol[0]}")" = "true" ]; then output=$(echo "$repo_name $branch") else output=$(echo "$repo_name $diff_symbol $branch") From 389c4eb735ff36001efe447f40b22413739d0bfe Mon Sep 17 00:00:00 2001 From: Hugo/ Theo Meinhof Date: Sat, 12 Jul 2025 04:08:01 +0200 Subject: [PATCH 10/11] move around whitespace regarding repo_name - changed getRepoName to just return the repo name for clarity and reusability - moved pipe and spaces to separate into variable - removed space from behind repo_name - this is important to me because otherwise this widget would have an additional leading whitespace for everyone not using the repo_name option --- scripts/git.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/git.sh b/scripts/git.sh index 67dc5362..cc3bc5ca 100755 --- a/scripts/git.sh +++ b/scripts/git.sh @@ -134,7 +134,7 @@ getRepoName() { if [ "$show_repo_name" = "true" ] && [ "$(checkForGitDir)" = "true" ]; then repo="$(basename "$(git -C "$path" --no-optional-locks rev-parse --show-toplevel 2>/dev/null)")" - echo "$repo |" + echo "$repo" fi } @@ -143,7 +143,7 @@ getMessage() { if [ $(checkForGitDir) == "true" ]; then branch="$(getBranch)" - repo_name="$(getRepoName)" + repo_name="$(getRepoName) | " output="" if [ $(checkForChanges) == "true" ]; then @@ -154,21 +154,21 @@ getMessage() if [ "$(checkEmptySymbol "${diff_symbol[0]}")" = "true" ]; then output="$repo_name${changes:+ ${changes}} $branch" else - output="$repo_name ${diff_symbol[0]} ${changes:+$changes }$branch" + output="$repo_name${diff_symbol[0]} ${changes:+$changes }$branch" fi else if [ "$(checkEmptySymbol "${diff_symbol[0]}")" = "true" ]; then - output=$(echo "$repo_name $branch") + output=$(echo "$repo_name$branch") else - output=$(echo "$repo_name $diff_symbol $branch") + output=$(echo "$repo_name$diff_symbol $branch") fi fi else if [ $(checkEmptySymbol $current_symbol) == "true" ]; then - output=$(echo "$repo_name $branch") + output=$(echo "$repo_name$branch") else - output="$repo_name ${current_symbol[0]} $branch" + output="$repo_name${current_symbol[0]} $branch" fi fi From 7de8c315fbec2f339820469010aa1c5db3e1583b Mon Sep 17 00:00:00 2001 From: Hugo/ Theo Meinhof Date: Sat, 12 Jul 2025 04:11:50 +0200 Subject: [PATCH 11/11] undoing my mistake... and now this mistake is burned into the repo foreverrrr --- scripts/git.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/git.sh b/scripts/git.sh index cc3bc5ca..503f2978 100755 --- a/scripts/git.sh +++ b/scripts/git.sh @@ -134,7 +134,7 @@ getRepoName() { if [ "$show_repo_name" = "true" ] && [ "$(checkForGitDir)" = "true" ]; then repo="$(basename "$(git -C "$path" --no-optional-locks rev-parse --show-toplevel 2>/dev/null)")" - echo "$repo" + echo "$repo | " fi } @@ -143,7 +143,7 @@ getMessage() { if [ $(checkForGitDir) == "true" ]; then branch="$(getBranch)" - repo_name="$(getRepoName) | " + repo_name="$(getRepoName)" output="" if [ $(checkForChanges) == "true" ]; then