From e3960e53475dda8833cdf65f7943675d21d8436b Mon Sep 17 00:00:00 2001 From: Matthew Broomfield Date: Fri, 7 Aug 2020 19:55:19 +0000 Subject: [PATCH 01/52] added icon for mouse mode, fixes #295 mouse icon is to the left of the battery by default. _toggle_mouse no longer prints a status message as the status icon should give enough information. --- .tmux.conf | 12 +++++++++--- .tmux.conf.local | 9 ++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 1b210a8..f6ec15b 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -278,8 +278,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # new="on" # fi # -# tmux set -g mouse $new \;\ -# display "mouse: $new" +# tmux set -g mouse $new # } # # _battery_info() { @@ -981,6 +980,11 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # tmux_conf_theme_prefix_bg=${tmux_conf_theme_prefix_bg:-none} # tmux_conf_theme_prefix_attr=${tmux_conf_theme_prefix_attr:-none} # +# tmux_conf_theme_mouse=${tmux_conf_theme_mouse:-↗} # U+2197 +# tmux_conf_theme_mouse_fg=${tmux_conf_theme_mouse_fg:-none} +# tmux_conf_theme_mouse_bg=${tmux_conf_theme_mouse_bg:-none} +# tmux_conf_theme_mouse_attr=${tmux_conf_theme_mouse_attr:-none} +# # tmux_conf_theme_root=${tmux_conf_theme_root:-!} # tmux_conf_theme_root_fg=${tmux_conf_theme_root_fg:-none} # tmux_conf_theme_root_bg=${tmux_conf_theme_root_bg:-none} @@ -1002,6 +1006,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # status_left=$(echo "$tmux_conf_theme_status_left" | sed \ # -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ # -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix$tmux_conf_theme_prefix ,$(print "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ +# -e "s/#{mouse}/#[fg=$tmux_conf_theme_mouse_fg]#[bg=$tmux_conf_theme_mouse_bg]#[$tmux_conf_theme_mouse_attr]#{?mouse,$tmux_conf_theme_mouse ,$(print "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \ # -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g') # @@ -1080,7 +1085,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # # # -- status-right style # -# tmux_conf_theme_status_right=${tmux_conf_theme_status_right-' #{prefix}#{pairing}#{synchronized}#{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '} +# tmux_conf_theme_status_right=${tmux_conf_theme_status_right-' #{prefix}#{mouse}#{pairing}#{synchronized}#{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '} # tmux_conf_theme_status_right_fg=${tmux_conf_theme_status_right_fg:-$tmux_conf_theme_colour_12,$tmux_conf_theme_colour_13,$tmux_conf_theme_colour_14} # tmux_conf_theme_status_right_bg=${tmux_conf_theme_status_right_bg:-$tmux_conf_theme_colour_15,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_17} # tmux_conf_theme_status_right_attr=${tmux_conf_theme_status_right_attr:-none,none,bold} @@ -1089,6 +1094,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # status_right=$(echo "$tmux_conf_theme_status_right" | sed \ # -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ # -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix,$tmux_conf_theme_prefix ,$(printf "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ +# -e "s/#{mouse}/#[fg=$tmux_conf_theme_mouse_fg]#[bg=$tmux_conf_theme_mouse_bg]#[$tmux_conf_theme_mouse_attr]#{?mouse,$tmux_conf_theme_mouse ,$(printf "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \ # -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g') # diff --git a/.tmux.conf.local b/.tmux.conf.local index 4ae12eb..dab4aa7 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -206,6 +206,7 @@ tmux_conf_theme_right_separator_sub="|" # - #{hostname_ssh} # - #{hostname} # - #{loadavg} +# - #{mouse} # - #{pairing} # - #{prefix} # - #{root} @@ -218,7 +219,7 @@ tmux_conf_theme_right_separator_sub="|" # - #{username} # - #{username_ssh} tmux_conf_theme_status_left=" ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} " -tmux_conf_theme_status_right=" #{prefix}#{pairing}#{synchronized}#{?battery_status,#{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} " +tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{?battery_status,#{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} " # status left style tmux_conf_theme_status_left_fg="$tmux_conf_theme_colour_6,$tmux_conf_theme_colour_7,$tmux_conf_theme_colour_8" @@ -242,6 +243,12 @@ tmux_conf_theme_prefix_fg="none" tmux_conf_theme_prefix_bg="none" tmux_conf_theme_prefix_attr="none" +# mouse indicator +tmux_conf_theme_mouse="↗" # U+2197 +tmux_conf_theme_mouse_fg="none" +tmux_conf_theme_mouse_bg="none" +tmux_conf_theme_mouse_attr="none" + # root indicator tmux_conf_theme_root="!" tmux_conf_theme_root_fg="none" From e74dc67a7d40c800d730b4569f5b653d77c2a436 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 5 Dec 2020 10:32:42 +0100 Subject: [PATCH 02/52] improved status line rendering, fixes #419 (2) - do not apply attr to spacers - fixed attr for last window, window with activity and window with bell --- .tmux.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index f6ec15b..e15aba0 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -941,7 +941,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # else # window_status_separator='' # fi -# tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#[none]" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#[none]" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#[none]" if !/default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}$tmux_conf_theme_window_status_format#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#[none]$tmux_conf_theme_right_separator_main" +# tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#{?window_last_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#{?window_activity_flag?,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#{?window_bell_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')$tmux_conf_theme_window_status_format#[none]#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#[none]$tmux_conf_theme_right_separator_main" # tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none]$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr]$spacer_current$tmux_conf_theme_window_status_current_format$spacer_current#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_right_separator_main" # else # if [ -z "$tmux_conf_theme_left_separator_main" ]; then @@ -949,7 +949,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # else # window_status_separator='' # fi -# tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#[none]" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#[none]" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#[none]" if /!default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}$tmux_conf_theme_window_status_format#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#[none]$tmux_conf_theme_left_separator_main" +# tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#{?window_last_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#{?window_activity_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#{?window_bell_flag,#[none],}" if /!default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')$tmux_conf_theme_window_status_format#[none]#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main" # tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr]$spacer_current$tmux_conf_theme_window_status_current_format$spacer_current#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg]$tmux_conf_theme_left_separator_main" # fi # From 8a4dabb19616ac9cfb377194daa60611a4f90b98 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 5 Dec 2020 22:55:25 +0100 Subject: [PATCH 03/52] added support for #{hostname_full} and #{hostname_full_ssh}, closes #361 --- .tmux.conf | 54 ++++++++++++++++++++++++++++++------------------ .tmux.conf.local | 8 +++++++ 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index e15aba0..af84cd6 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -585,6 +585,8 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # _hostname() { # tty=${1:-$(tmux display -p '#{pane_tty}')} # ssh_only=$2 +# full=$3 +# h_or_H=$4 # # tty_info=$(_tty_info "$tty") # command=${tty_info#*:} @@ -597,17 +599,19 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # # shellcheck disable=SC2086 # [ -z "$hostname" ] && hostname=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%hostname%% %h >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%hostname% / { print $2; exit }') # -# case "$hostname" in -# *[a-z-].*) -# hostname=${hostname%%.*} -# ;; -# 127.0.0.1) -# hostname="localhost" -# ;; -# esac +# if ! _is_enabled "$full"; then +# case "$hostname" in +# *[a-z-].*) +# hostname=${hostname%%.*} +# ;; +# 127.0.0.1) +# hostname="localhost" +# ;; +# esac +# fi # else # if ! _is_enabled "$ssh_only"; then -# hostname=$3 +# hostname="$h_or_H" # fi # fi # @@ -887,9 +891,11 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #h #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g') +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') # # tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-$tmux_conf_theme_colour_3} # tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-$tmux_conf_theme_colour_1} @@ -957,16 +963,20 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #h #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g') +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') # tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed \ # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #h #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g') +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') # # # -- indicators # @@ -1205,17 +1215,21 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # fi # # case "$status_left $status_right" in -# *'#{username}'*|*'#{hostname}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*) +# *'#{username}'*|*'#{hostname}'*|*'#{hostname_full}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*|*'#{hostname_full_ssh}'*) # status_left=$(echo "$status_left" | sed \ # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #h #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g') +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') # status_right=$(echo "$status_right" | sed \ # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #h #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g') +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') # ;; # esac # diff --git a/.tmux.conf.local b/.tmux.conf.local index dab4aa7..f40cedc 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -134,6 +134,8 @@ tmux_conf_theme_status_attr="none" # - #{circled_session_name} # - #{hostname} # - #{hostname_ssh} +# - #{hostname_full} +# - #{hostname_full_ssh} # - #{username} # - #{username_ssh} tmux_conf_theme_terminal_title="#h ❐ #S ● #I #W" @@ -144,6 +146,8 @@ tmux_conf_theme_terminal_title="#h ❐ #S ● #I #W" # - #{circled_session_name} # - #{hostname} # - #{hostname_ssh} +# - #{hostname_full} +# - #{hostname_full_ssh} # - #{username} # - #{username_ssh} tmux_conf_theme_window_status_fg="$tmux_conf_theme_colour_3" @@ -159,6 +163,8 @@ tmux_conf_theme_window_status_format="#I #W" # - #{circled_session_name} # - #{hostname} # - #{hostname_ssh} +# - #{hostname_full} +# - #{hostname_full_ssh} # - #{username} # - #{username_ssh} tmux_conf_theme_window_status_current_fg="$tmux_conf_theme_colour_1" @@ -205,6 +211,8 @@ tmux_conf_theme_right_separator_sub="|" # - #{circled_session_name} # - #{hostname_ssh} # - #{hostname} +# - #{hostname_full} +# - #{hostname_full_ssh} # - #{loadavg} # - #{mouse} # - #{pairing} From 249f0be096b4a30c0fb66eb776e6b95efb8e4e3b Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 12 Dec 2020 18:35:01 +0100 Subject: [PATCH 04/52] fixed use of invalid 'print' command --- .tmux.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index af84cd6..fbc7e23 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1015,8 +1015,8 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # if [ -n "$tmux_conf_theme_status_left" ]; then # status_left=$(echo "$tmux_conf_theme_status_left" | sed \ # -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ -# -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix$tmux_conf_theme_prefix ,$(print "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ -# -e "s/#{mouse}/#[fg=$tmux_conf_theme_mouse_fg]#[bg=$tmux_conf_theme_mouse_bg]#[$tmux_conf_theme_mouse_attr]#{?mouse,$tmux_conf_theme_mouse ,$(print "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \ +# -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix$tmux_conf_theme_prefix ,$(printf "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ +# -e "s/#{mouse}/#[fg=$tmux_conf_theme_mouse_fg]#[bg=$tmux_conf_theme_mouse_bg]#[$tmux_conf_theme_mouse_attr]#{?mouse,$tmux_conf_theme_mouse ,$(printf "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \ # -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g') # From 8df1666ddc91e4ac8c9797082c2aa662a4e0040b Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 12 Dec 2020 18:39:37 +0100 Subject: [PATCH 05/52] improved status line rendering, fixes #419 (3) fixed spacers --- .tmux.conf | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index fbc7e23..08fbb8a 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -919,35 +919,44 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # tmux_conf_theme_window_status_last_bg=${tmux_conf_theme_window_status_last_bg:-default} # tmux_conf_theme_window_status_last_attr=${tmux_conf_theme_window_status_last_attr:-none} # -# if [ x"$tmux_conf_theme_status_bg" = x"$tmux_conf_theme_window_status_bg" ]; then +# if [ x"$tmux_conf_theme_window_status_bg" = x"$tmux_conf_theme_status_bg" ] || [ x"$tmux_conf_theme_window_status_bg" = x"default" ]; then # spacer='' # spacer_current=' ' # else # spacer=' ' # spacer_current=' ' # fi -# if [ x"$tmux_conf_theme_status_bg" = x"$tmux_conf_theme_window_status_last_bg" ]; then +# if [ x"$tmux_conf_theme_window_status_last_bg" = x"$tmux_conf_theme_status_bg" ] || [ x"$tmux_conf_theme_window_status_last_bg" = x"default" ] ; then # spacer_last='' # else # spacer_last=' ' # fi -# if [ x"$tmux_conf_theme_status_bg" = x"$tmux_conf_theme_window_status_activity_bg" ]; then +# if [ x"$tmux_conf_theme_window_status_activity_bg" = x"$tmux_conf_theme_status_bg" ] || [ x"$tmux_conf_theme_window_status_activity_bg" = x"default" ] ; then # spacer_activity='' +# spacer_last_activity="$spacer_last" # else # spacer_activity=' ' +# spacer_last_activity=' ' # fi -# if [ x"$tmux_conf_theme_status_bg" = x"$tmux_conf_theme_window_status_bell_bg" ]; then +# if [ x"$tmux_conf_theme_window_status_bell_bg" = x"$tmux_conf_theme_status_bg" ] || [ x"$tmux_conf_theme_window_status_bell_bg" = x"default" ] ; then # spacer_bell='' +# spacer_last_bell="$spacer_last" +# spacer_activity_bell="$spacer_activity" +# spacer_last_activity_bell="$spacer_last_activity" # else # spacer_bell=' ' +# spacer_last_bell=' ' +# spacer_activity_bell=' ' +# spacer_last_activity_bell=' ' # fi +# spacer="#{?window_last_flag,#{?window_activity_flag,#{?window_bell_flag,$spacer_last_activity_bell,$spacer_last_activity},#{?window_bell_flag,$spacer_last_bell,$spacer_last}},#{?window_activity_flag,#{?window_bell_flag,$spacer_activity_bell,$spacer_activity},#{?window_bell_flag,$spacer_bell,$spacer}}}" # if [ x"$(tmux show -g -v status-justify)" = x"right" ]; then # if [ -z "$tmux_conf_theme_right_separator_main" ]; then # window_status_separator=' ' # else # window_status_separator='' # fi -# tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#{?window_last_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#{?window_activity_flag?,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#{?window_bell_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')$tmux_conf_theme_window_status_format#[none]#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#[none]$tmux_conf_theme_right_separator_main" +# tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$spacer$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#{?window_last_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#{?window_activity_flag?,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#{?window_bell_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')$tmux_conf_theme_window_status_format#[none]$spacer#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#[none]$tmux_conf_theme_right_separator_main" # tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none]$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr]$spacer_current$tmux_conf_theme_window_status_current_format$spacer_current#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_right_separator_main" # else # if [ -z "$tmux_conf_theme_left_separator_main" ]; then @@ -955,7 +964,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # else # window_status_separator='' # fi -# tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#{?window_last_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#{?window_activity_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#{?window_bell_flag,#[none],}" if /!default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')$tmux_conf_theme_window_status_format#[none]#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main" +# tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$spacer$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#{?window_last_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#{?window_activity_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#{?window_bell_flag,#[none],}" if /!default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')$tmux_conf_theme_window_status_format#[none]$spacer#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main" # tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr]$spacer_current$tmux_conf_theme_window_status_current_format$spacer_current#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg]$tmux_conf_theme_left_separator_main" # fi # From 53d7ce831127b6f1b6f1600b53213cb3060b7e6d Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sun, 13 Dec 2020 20:50:04 +0100 Subject: [PATCH 06/52] fixed indentation in _apply_overrides() --- .tmux.conf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 08fbb8a..7dc2978 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -705,13 +705,13 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-false} # tmux_conf_24b_colour=${tmux_conf_24b_colour:-$tmux_conf_theme_24b_colour} # if _is_enabled "$tmux_conf_24b_colour"; then -# case "$TERM" in -# screen-*|tmux-*) -# ;; -# *) -# tmux set-option -ga terminal-overrides ",*256col*:Tc" -# ;; -# esac +# case "$TERM" in +# screen-*|tmux-*) +# ;; +# *) +# tmux set-option -ga terminal-overrides ",*256col*:Tc" +# ;; +# esac # fi # } # From 2aaacfbd8f6cc394df05c472f115378a2f2fa914 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 9 Jan 2021 20:47:20 +0100 Subject: [PATCH 07/52] mention 'reattach-no-usernamespace' is not needed for tmux > 2.6 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 52978a4..fccca2a 100644 --- a/README.md +++ b/README.md @@ -299,7 +299,7 @@ tmux_conf_theme_status_right='#(echo foo %% bar)' ``` See `man 3 strftime`. -### Accessing the macOS clipboard from within tmux sessions +### Accessing the macOS clipboard from within tmux sessions (tmux `< 2.6`) [Chris Johnsen created the `reattach-to-user-namespace` utility][reattach-to-user-namespace] that makes `pbcopy` and `pbpaste` work From d950ee3c8c3a967cf6f52ab4caf4cfccfa7b702f Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 10 Oct 2020 18:56:13 +0200 Subject: [PATCH 08/52] added support for tpm, resolves #61 --- .gitignore | 1 + .tmux.conf | 80 ++++++++++++++++++++++++++++++++++++++++-------- .tmux.conf.local | 31 +++++++++++++++++++ README.md | 22 +++++++++++-- 4 files changed, 118 insertions(+), 16 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9bfd626 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +plugins/** diff --git a/.tmux.conf b/.tmux.conf index 7dc2978..8d0e36f 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -162,13 +162,12 @@ bind P choose-buffer # choose which buffer to paste from # -- user defined overrides ---------------------------------------------------- -if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local' +source -q ~/.tmux.conf.local # -- 8< ------------------------------------------------------------------------ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' -run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-time 3000 \; display "This configuration will soon require tmux >= 2.4" \; set -u display-time || true' # EOF @@ -1332,19 +1331,72 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # setw -g clock-mode-style "$tmux_conf_theme_clock_style" # } # +# __apply_plugins() { +# window_active="$1" +# tmux_conf_update_plugins_on_launch="$2" +# tmux_conf_update_plugins_on_reload="$3" +# +# TMUX_PLUGIN_MANAGER_PATH=${TMUX_PLUGIN_MANAGER_PATH:-~/.tmux/plugins} +# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then +# install_tpm=true +# tmux display 'Installing tpm and plugins...' +# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm" +# elif { [ -z "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_reload"; }; then +# update_tpm=true +# tmux display 'Updating tpm and plugins...' +# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master) +# fi +# if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then +# perl -0777 -p -i -e 's/git clone --recursive/git clone --recursive --depth 1 --shallow-submodules/g +# ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh" +# perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh" +# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH" +# fi +# if [ x"$update_tpm" = x"true" ]; then +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >/dev/null 2>&1 +# tmux display 'Done updating tpm and plugins...' +# elif [ x"$install_tpm" = x"true" ]; then +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1 +# tmux display 'Done installing tpm and plugins...' +# fi +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" +# if [ -z "$window_active" ] && [ $_tmux_version -lt 204 ]; then +# tmux run -b "sleep $(expr $(tmux display -p '#{display-time}') / 500) && tmux set display-time 3000 \; display 'This configuration will soon require tmux 2.4+' \; set -u display-time" +# fi +# } +# +# _apply_plugins() { +# tmux_conf_update_plugins_on_launch=${tmux_conf_update_plugins_on_launch:-true} +# tmux_conf_update_plugins_on_reload=${tmux_conf_update_plugins_on_reload:-true} +# if [ -n "$(tmux show -gv '@plugin')" ] || [ -n "$(tmux show -gv '@tpm_plugins')" ]; then +# tmux run -b "cut -c3- ~/.tmux.conf | sh -s __apply_plugins \"$window_active\" \"$tmux_conf_update_plugins_on_launch\" \"$tmux_conf_update_plugins_on_reload\"" +# elif [ -z "$window_active" ]; then +# if [ $_tmux_version -lt 204 ]; then +# tmux run -b 'tmux set display-time 3000 \; display "This configuration will soon require tmux 2.4+" \; set -u display-time' +# fi +# fi +# } +# # _apply_configuration() { # -# if ! command -v perl > /dev/null 2>&1; then -# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires perl" \; set -u display-time' -# return -# fi -# if ! command -v sed > /dev/null 2>&1; then -# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires sed" \; set -u display-time' -# return -# fi -# if ! command -v awk > /dev/null 2>&1; then -# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time' -# return +# window_active="$(tmux display -p '#{window_active}' 2>/dev/null || true)" +# if [ -z "$window_active" ]; then +# if ! command -v perl > /dev/null 2>&1; then +# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires perl" \; set -u display-time \; run "sleep 3" \; kill-server' +# return +# fi +# if ! command -v sed > /dev/null 2>&1; then +# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires sed" \; set -u display-time \; run "sleep 3" \; kill-server' +# return +# fi +# if ! command -v awk > /dev/null 2>&1; then +# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time \; run "sleep 3" \; kill-server' +# return +# fi +# if [ $_tmux_version -lt 203 ]; then +# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires tmux 2.3+" \; set -u display-time \; run "sleep 3" \; kill-server' +# return +# fi # fi # # # see https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard @@ -1374,6 +1426,8 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # # shellcheck disable=SC2046 # tmux setenv -gu tmux_conf_dummy $(printenv | grep -E -o '^tmux_conf_[^=]+' | awk '{printf "; setenv -gu %s", $0}') # wait +# +# _apply_plugins # } # # _urlview() { diff --git a/.tmux.conf.local b/.tmux.conf.local index f40cedc..fc749dc 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -347,8 +347,39 @@ tmux_conf_copy_to_os_clipboard=false # move status line to top #set -g status-position top +# -- tpm ----------------------------------------------------------------------- + +# while I don't use tpm myself, many people requested official support so here +# is a seamless integration that automatically installs plugins in parallel + +# whenever a plugin introduces a variable to be used in 'status-left' or +# 'status-right', you can use it in 'tmux_conf_theme_status_left' and +# 'tmux_conf_theme_status_right' variables. + +# by default, launching tmux will update tpm and all plugins +# - true (default) +# - false +tmux_conf_update_plugins_on_launch=true + +# by default, reloading the configuration will update tpm and all plugins +# - true (default) +# - false +tmux_conf_update_plugins_on_reload=true + +# /!\ do not add set -g @plugin 'tmux-plugins/tpm' +# /!\ do not add run '~/.tmux/plugins/tpm/tpm' + +# to enable a plugin, use the 'set -g @plugin' syntax: +# visit https://github.com/tmux-plugins for available plugins +#set -g @plugin 'tmux-plugins/tmux-copycat' +#set -g @plugin 'tmux-plugins/tmux-cpu' +#set -g @plugin 'tmux-plugins/tmux-resurrect' +#set -g @plugin 'tmux-plugins/tmux-continuum' +#set -g @continuum-restore 'on' + # -- custom variables ---------------------------------------------------------- + # to define a custom #{foo} variable, define a POSIX shell function between the # '# EOF' and the '# "$@"' lines. Please note that the opening brace { character # must be on the same line as the function name otherwise the parse won't detect diff --git a/README.md b/README.md index fccca2a..c007560 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Installation Requirements: - - tmux **`>= 2.1`** (soon `>= 2.4`) running inside Linux, Mac, OpenBSD, Cygwin + - tmux **`>= 2.3`** (soon `>= 2.4`) running inside Linux, Mac, OpenBSD, Cygwin or WSL - awk, perl and sed - outside of tmux, `$TERM` must be set to `xterm-256color` @@ -109,12 +109,12 @@ Features if available - laptop battery status line information - uptime status line information - - optional highlight of focused pane (tmux `>= 2.1`) + - optional highlight of focused pane - configurable new windows and panes behavior (optionally retain current path) - SSH/Mosh aware split pane (reconnects to remote server) - copy to OS clipboard (needs [`reattach-to-user-namespace`][reattach-to-user-namespace] on macOS, `xsel` or `xclip` on Linux) - - support for 4-digit hexadecimal Unicode characters (requires `perl` or Bash >= 4.1.2) + - support for 4-digit hexadecimal Unicode characters - [Facebook PathPicker][] integration if available - [Urlview][] integration if available @@ -299,6 +299,22 @@ tmux_conf_theme_status_right='#(echo foo %% bar)' ``` See `man 3 strftime`. +### Using TPM plugins + +This configuration now comes with built-in [TPM] support: +- use the `set -g @plugin ...` syntax to enable a plugin +- whenever a plugin introduces a variable to be used in `status-left` or + `status-right`, you can use it in `tmux_conf_theme_status_left` and + `tmux_conf_theme_status_right` variables, see instructions above 👆 +- ⚠️ do not add `set -g @plugin 'tmux-plugins/tpm'` +- ⚠️ do not add `run '~/.tmux/plugins/tpm/tpm'` to `~/.tmux.conf` or your +- `~/.tmux.conf.local` copy ← people who are used to alter + `.tmux.conf` to add TPM support will have to adapt their configuration + +See `~/.tmux.conf.local` for instructions. + +[TPM]: https://github.com/tmux-plugins/tpm + ### Accessing the macOS clipboard from within tmux sessions (tmux `< 2.6`) [Chris Johnsen created the `reattach-to-user-namespace` From 41af713ff786ae2ea38ec52f7d7ef258ccd9fb9c Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Sun, 10 Jan 2021 19:34:57 +1100 Subject: [PATCH 09/52] fixed BusyBox's tr command compatibility, fixes #441 --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 8d0e36f..cab2275 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -189,7 +189,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _uname_s=$(uname -s) # -# _tmux_version=$(tmux -V | tr -cd '[:digit:].' | cut -d' ' -f2 | awk -F '.' '{print $1 * 100 + $2}') +# _tmux_version=$(tmux -V | tr -cd '0123456789.' | cut -d' ' -f2 | awk -F '.' '{print $1 * 100 + $2}') # # _is_enabled() { # [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"enabled" ] || [ x"$1" = x"1" ] From 788ffd8e6f51d268a502c94e563f5bef32bec882 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 12 Nov 2020 13:39:43 +0100 Subject: [PATCH 10/52] fixed variable replacement in tmux_conf_theme_status_right and tmux_conf_theme_status_left, fixes #356 --- .tmux.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index cab2275..e31b67a 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1196,7 +1196,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # _battery_info # if [ "$charge" != 0 ]; then # case "$status_left $status_right" in -# *'#{battery_status}'*|*'#{battery_bar}'*|*'#{battery_hbar}'*|*'#{battery_vbar}'*|*'#{battery_percentage}'*) +# *'#{?battery_status'*|*'#{?battery_bar'*|*'#{?battery_hbar'*|*'#{?battery_vbar'*|*'#{?battery_percentage'*) # status_left=$(echo "$status_left" | sed -E \ # -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \ # -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \ @@ -1243,7 +1243,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _uptime' # case "$status_left $status_right" in -# *'#{uptime_d}'*|*'#{uptime_h}'*|*'#{uptime_m}'*|*'#{uptime_s}'*) +# *'#{?uptime_d'*|*'#{?uptime_h'*|*'#{?uptime_m'*|*'#{?uptime_s'*) # status_left=$(echo "$status_left" | sed -E \ # -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \ # -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \ @@ -1276,7 +1276,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _loadavg' # case "$status_left $status_right" in -# *'#{loadavg}'*) +# *'#{?loadavg'*) # status_left=$(echo "$status_left" | sed -E \ # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') # status_right=$(echo "$status_right" | sed -E \ From d2b5758bdd42364f0add8791444f1581ae3b7bf5 Mon Sep 17 00:00:00 2001 From: Neil Mahoney Date: Sun, 10 Jan 2021 21:39:42 -0500 Subject: [PATCH 11/52] fix left status prefix rendering --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index e31b67a..9ceaa61 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1023,7 +1023,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # if [ -n "$tmux_conf_theme_status_left" ]; then # status_left=$(echo "$tmux_conf_theme_status_left" | sed \ # -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ -# -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix$tmux_conf_theme_prefix ,$(printf "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ +# -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix,$tmux_conf_theme_prefix ,$(printf "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ # -e "s/#{mouse}/#[fg=$tmux_conf_theme_mouse_fg]#[bg=$tmux_conf_theme_mouse_bg]#[$tmux_conf_theme_mouse_attr]#{?mouse,$tmux_conf_theme_mouse ,$(printf "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \ # -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g') From 4bf9263fbded44928ca9bf95333582503c73b584 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Mon, 11 Jan 2021 07:50:47 +0100 Subject: [PATCH 12/52] fixed variable replacement in tmux_conf_theme_status_right and tmux_conf_theme_status_left (2), fixes #442 --- .tmux.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 9ceaa61..1bf77f6 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1196,7 +1196,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # _battery_info # if [ "$charge" != 0 ]; then # case "$status_left $status_right" in -# *'#{?battery_status'*|*'#{?battery_bar'*|*'#{?battery_hbar'*|*'#{?battery_vbar'*|*'#{?battery_percentage'*) +# *'#{battery_'*|*'#{?battery_'*) # status_left=$(echo "$status_left" | sed -E \ # -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \ # -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \ @@ -1243,7 +1243,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _uptime' # case "$status_left $status_right" in -# *'#{?uptime_d'*|*'#{?uptime_h'*|*'#{?uptime_m'*|*'#{?uptime_s'*) +# *'#{uptime_'*|*'#{?uptime_'*) # status_left=$(echo "$status_left" | sed -E \ # -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \ # -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \ @@ -1276,7 +1276,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _loadavg' # case "$status_left $status_right" in -# *'#{?loadavg'*) +# *'#{loadavg'*|*'#{?loadavg'*) # status_left=$(echo "$status_left" | sed -E \ # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') # status_right=$(echo "$status_right" | sed -E \ From 7a71a82b43cc9afe77850bf05f5e807880a37b68 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Mon, 25 Jan 2021 17:38:46 +0100 Subject: [PATCH 13/52] fixed #{online} custom variable implementation as ping -t is not portable, fixes #451 --- .tmux.conf.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf.local b/.tmux.conf.local index fc749dc..ffdf2eb 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -397,7 +397,7 @@ tmux_conf_update_plugins_on_reload=true # } # # online() { -# ping -t 1 -c 1 1.1.1.1 >/dev/null 2>&1 && printf '✔' || printf '✘' +# ping -c 1 1.1.1.1 >/dev/null 2>&1 && printf '✔' || printf '✘' # } # # "$@" From 5abe651ccb810c90b13758a30e3100c8a6d5551a Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 25 Feb 2021 14:02:46 +0100 Subject: [PATCH 14/52] remind people to not "uncomment" local functions in .tmux.conf.local --- .tmux.conf.local | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.tmux.conf.local b/.tmux.conf.local index ffdf2eb..b97d67b 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -391,6 +391,8 @@ tmux_conf_update_plugins_on_reload=true # # /!\ do not remove the following line # EOF # +# # /!\ do not "uncomment" the functions: the leading "# " characters are needed +# # weather() { # curl -m 1 wttr.in?format=3 2>/dev/null # sleep 900 # sleep for 15 minutes, throttle network requests whatever the value of status-interval From a752c41bca59622987e9a7275404893d7c9013eb Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 4 Mar 2021 17:10:37 +0100 Subject: [PATCH 15/52] fixed copy to os clipboard on macOS when xclip or xsel is installed, fixes #459 --- .tmux.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 1bf77f6..ee6968c 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -142,12 +142,12 @@ run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true' run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true' run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true' -# copy to macOS clipboard -if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"' -if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"' # copy to X11 clipboard if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"' if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"' +# copy to macOS clipboard +if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"' +if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"' # copy to Windows clipboard if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"' if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"' @@ -776,10 +776,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # fi # # tmux_conf_copy_to_os_clipboard=${tmux_conf_copy_to_os_clipboard:-false} -# command -v pbcopy > /dev/null 2>&1 && command='pbcopy' -# command -v reattach-to-user-namespace > /dev/null 2>&1 && command='reattach-to-user-namespace pbcopy' # command -v xsel > /dev/null 2>&1 && command='xsel -i -b' # ! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1 && command='xclip -i -selection clipboard > \/dev\/null 2>\&1' +# command -v pbcopy > /dev/null 2>&1 && command='pbcopy' +# command -v reattach-to-user-namespace > /dev/null 2>&1 && command='reattach-to-user-namespace pbcopy' # command -v clip.exe > /dev/null 2>&1 && command='clip\.exe' # [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard' # From 4868ac4bd9910de3c8a89ab5b1d150e24caf2c6f Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Fri, 5 Mar 2021 19:02:15 +0100 Subject: [PATCH 16/52] worked around broken /sys/class/power_supply//capacity > 100, resolves #460 --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index ee6968c..503d9c6 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -303,7 +303,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false") # bat_capacity="$batpath/capacity" # if [ -r "$bat_capacity" ]; then -# charge=$(awk -v charge="$charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + capacity / 100 }') +# charge=$(awk -v charge="$charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + (capacity > 100 ? 100 : capacity) / 100 }') # else # bat_energy_full="$batpath/energy_full" # bat_energy_now="$batpath/energy_now" From 8aefa1e79809de7f69259ea91299313cca7579f7 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 4 Mar 2021 08:15:45 +0100 Subject: [PATCH 17/52] made version detection more robust in case tmux executable is renamed (2), fixes #457 --- .tmux.conf | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 503d9c6..4d0ef4a 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -189,7 +189,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _uname_s=$(uname -s) # -# _tmux_version=$(tmux -V | tr -cd '0123456789.' | cut -d' ' -f2 | awk -F '.' '{print $1 * 100 + $2}') +# _tmux_version=$(tmux -V | awk '{print ($2+0) * 100}') # # _is_enabled() { # [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"enabled" ] || [ x"$1" = x"1" ] @@ -1211,9 +1211,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g') # status_right="#(printf '\n'; nice cut -c3- ~/.tmux.conf | sh -s _battery_status \"$tmux_conf_battery_status_charging\" \"$tmux_conf_battery_status_discharging\")$status_right" # interval=60 -# if [ $_tmux_version -ge 302 ]; then +# if [ $_tmux_version -ge 320 ]; then # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done" -# elif [ $_tmux_version -gt 204 ]; then +# elif [ $_tmux_version -gt 240 ]; then # status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\")$status_right" @@ -1264,9 +1264,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # interval=$(tmux show -gv status-interval) # ;; # esac -# if [ $_tmux_version -ge 302 ]; then +# if [ $_tmux_version -ge 320 ]; then # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done" -# elif [ $_tmux_version -gt 204 ]; then +# elif [ $_tmux_version -gt 240 ]; then # status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _uptime)$status_right" @@ -1282,9 +1282,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # status_right=$(echo "$status_right" | sed -E \ # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') # interval=$(tmux show -gv status-interval) -# if [ $_tmux_version -ge 302 ]; then +# if [ $_tmux_version -ge 320 ]; then # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done" -# elif [ $_tmux_version -gt 204 ]; then +# elif [ $_tmux_version -gt 240 ]; then # status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right" @@ -1360,7 +1360,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux display 'Done installing tpm and plugins...' # fi # "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" -# if [ -z "$window_active" ] && [ $_tmux_version -lt 204 ]; then +# if [ -z "$window_active" ] && [ $_tmux_version -lt 240 ]; then # tmux run -b "sleep $(expr $(tmux display -p '#{display-time}') / 500) && tmux set display-time 3000 \; display 'This configuration will soon require tmux 2.4+' \; set -u display-time" # fi # } @@ -1371,7 +1371,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # if [ -n "$(tmux show -gv '@plugin')" ] || [ -n "$(tmux show -gv '@tpm_plugins')" ]; then # tmux run -b "cut -c3- ~/.tmux.conf | sh -s __apply_plugins \"$window_active\" \"$tmux_conf_update_plugins_on_launch\" \"$tmux_conf_update_plugins_on_reload\"" # elif [ -z "$window_active" ]; then -# if [ $_tmux_version -lt 204 ]; then +# if [ $_tmux_version -lt 240 ]; then # tmux run -b 'tmux set display-time 3000 \; display "This configuration will soon require tmux 2.4+" \; set -u display-time' # fi # fi @@ -1393,7 +1393,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time \; run "sleep 3" \; kill-server' # return # fi -# if [ $_tmux_version -lt 203 ]; then +# if [ $_tmux_version -lt 230 ]; then # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires tmux 2.3+" \; set -u display-time \; run "sleep 3" \; kill-server' # return # fi From 3bfec1a25a8a66dd251d37f4efcd6a0e9f30a6da Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 18 Mar 2021 11:54:39 +0100 Subject: [PATCH 18/52] made version detection more robust in case tmux executable is renamed (3), fixes #462 fixed a regression introduced by commit 8aefa1e79809de7f69259ea91299313cca7579f7 that breaks version detection for tmux HEAD for which 'tmux -V' prints e.g. tmux next-3.3 --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 4d0ef4a..7f2f988 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -189,7 +189,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _uname_s=$(uname -s) # -# _tmux_version=$(tmux -V | awk '{print ($2+0) * 100}') +# _tmux_version=$(tmux -V | awk '{gsub(/[^0-9.]/, "", $2); print ($2+0) * 100}') # # _is_enabled() { # [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"enabled" ] || [ x"$1" = x"1" ] From 760bf4fabda9a41f67f8ad7e202c2a66a2a3d4e1 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 24 Apr 2021 19:26:16 +0200 Subject: [PATCH 19/52] made _apply_bindings() work with tmux 3.2 stock bindings, fixes #472 --- .tmux.conf | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 7f2f988..6f66866 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -785,9 +785,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # if [ -n "$command" ]; then # if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then -# perl -p -i -e "s/\bcopy-selection(-and-cancel)?\b/copy-pipe\1 '$command'/g" "$cfg" +# perl -p -i -e "s/(?!.*?$command)\bcopy-(?:selection|pipe)(-and-cancel)?\b/copy-pipe\1 '$command'/g" "$cfg" # else -# perl -p -i -e "s/\bcopy-pipe(-and-cancel)?\b\s+(\"|')?$command\2/copy-selection\1/g" "$cfg" +# if [ $_tmux_version -ge 320 ]; then +# perl -p -i -e "s/\bcopy-pipe(-and-cancel)?\b\s+(\"|')?$command\2?/copy-pipe\1/g" "$cfg" +# else +# perl -p -i -e "s/\bcopy-pipe(-and-cancel)?\b\s+(\"|')?$command\2?/copy-selection\1/g" "$cfg" +# fi # fi # fi # @@ -998,7 +1002,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux_conf_theme_prefix_bg=${tmux_conf_theme_prefix_bg:-none} # tmux_conf_theme_prefix_attr=${tmux_conf_theme_prefix_attr:-none} # -# tmux_conf_theme_mouse=${tmux_conf_theme_mouse:-↗} # U+2197 +# tmux_conf_theme_mouse=${tmux_conf_theme_mouse:-↗} # U+2197 # tmux_conf_theme_mouse_fg=${tmux_conf_theme_mouse_fg:-none} # tmux_conf_theme_mouse_bg=${tmux_conf_theme_mouse_bg:-none} # tmux_conf_theme_mouse_attr=${tmux_conf_theme_mouse_attr:-none} From 1f91646af104ed423054a1dd47a3b8c7ae69cfbc Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 8 May 2021 22:46:02 +0200 Subject: [PATCH 20/52] replaced printf '\n' calls by echo calls, fixes #479 TPM plugins further editing status-left or status-right may alter the content in such a way that the line feed character becomes a space --- .tmux.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 6f66866..8e7b05a 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1213,12 +1213,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \ # -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \ # -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g') -# status_right="#(printf '\n'; nice cut -c3- ~/.tmux.conf | sh -s _battery_status \"$tmux_conf_battery_status_charging\" \"$tmux_conf_battery_status_discharging\")$status_right" +# status_right="#(echo; nice cut -c3- ~/.tmux.conf | sh -s _battery_status \"$tmux_conf_battery_status_charging\" \"$tmux_conf_battery_status_discharging\")$status_right" # interval=60 # if [ $_tmux_version -ge 320 ]; then # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done" # elif [ $_tmux_version -gt 240 ]; then -# status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done)$status_right" +# status_right="#(echo; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\")$status_right" # fi @@ -1271,7 +1271,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # if [ $_tmux_version -ge 320 ]; then # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done" # elif [ $_tmux_version -gt 240 ]; then -# status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done)$status_right" +# status_right="#(echo; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _uptime)$status_right" # fi @@ -1289,7 +1289,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # if [ $_tmux_version -ge 320 ]; then # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done" # elif [ $_tmux_version -gt 240 ]; then -# status_right="#(printf '\n'; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done)$status_right" +# status_right="#(echo; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right" # fi From ed0b83a1184929ec967921d0db6bb0c4e6e9a2c5 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 5 Jun 2021 22:21:39 +0200 Subject: [PATCH 21/52] use single quotes for strings containing Unicode escapes, fixes #486 --- .tmux.conf.local | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.tmux.conf.local b/.tmux.conf.local index b97d67b..057b2b2 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -194,10 +194,10 @@ tmux_conf_theme_left_separator_main="" tmux_conf_theme_left_separator_sub="|" tmux_conf_theme_right_separator_main="" tmux_conf_theme_right_separator_sub="|" -#tmux_conf_theme_left_separator_main="\uE0B0" # /!\ you don't need to install Powerline -#tmux_conf_theme_left_separator_sub="\uE0B1" # you only need fonts patched with -#tmux_conf_theme_right_separator_main="\uE0B2" # Powerline symbols or the standalone -#tmux_conf_theme_right_separator_sub="\uE0B3" # PowerlineSymbols.otf font, see README.md +#tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline +#tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with +#tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone +#tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md # status left/right content: # - separate main sections with "|" From 67b1d38a87e40c09c75fd49a728e80b5f7bdc505 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Tue, 13 Jul 2021 18:40:54 +0200 Subject: [PATCH 22/52] mitigate tmux displaying its "<... not ready>" message, closes #496 the "flickering" perceived when the "<... not ready>" message is long won't be totally eliminated until tmux 3.3 though (commit 38c5788232e0e3abdd08ade55a9d4fbcda637df1) --- .tmux.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.tmux.conf b/.tmux.conf index 8e7b05a..9a5434a 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -558,6 +558,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _username() { +# echo # tty=${1:-$(tmux display -p '#{pane_tty}')} # ssh_only=$2 # @@ -582,6 +583,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _hostname() { +# echo # tty=${1:-$(tmux display -p '#{pane_tty}')} # ssh_only=$2 # full=$3 @@ -618,6 +620,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _root() { +# echo # tty=${1:-$(tmux display -p '#{pane_tty}')} # root=$2 # From 4ef0626b6db5c63ca22c9c6849668f78f2a0da4c Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 19 Aug 2021 11:51:49 +0200 Subject: [PATCH 23/52] revert "mitigate tmux displaying its "<... not ready>" message, closes #496" this reverts commit 67b1d38a87e40c09c75fd49a728e80b5f7bdc505. the proposed mitigation causes flickering for some, see followups in #496 --- .tmux.conf | 3 --- 1 file changed, 3 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 9a5434a..8e7b05a 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -558,7 +558,6 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _username() { -# echo # tty=${1:-$(tmux display -p '#{pane_tty}')} # ssh_only=$2 # @@ -583,7 +582,6 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _hostname() { -# echo # tty=${1:-$(tmux display -p '#{pane_tty}')} # ssh_only=$2 # full=$3 @@ -620,7 +618,6 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _root() { -# echo # tty=${1:-$(tmux display -p '#{pane_tty}')} # root=$2 # From a63dc5c6a9a59a935c058fba12009495ef0c4100 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sun, 29 Aug 2021 11:02:08 +0200 Subject: [PATCH 24/52] check connectivity to github.com before installing and/or updating tpm and plugins, fixes #513 --- .tmux.conf | 50 +++++++++++++++++++++++++++--------------------- .tmux.conf.local | 1 + 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 8e7b05a..18df782 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1341,29 +1341,35 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux_conf_update_plugins_on_reload="$3" # # TMUX_PLUGIN_MANAGER_PATH=${TMUX_PLUGIN_MANAGER_PATH:-~/.tmux/plugins} -# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then -# install_tpm=true -# tmux display 'Installing tpm and plugins...' -# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm" -# elif { [ -z "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_reload"; }; then -# update_tpm=true -# tmux display 'Updating tpm and plugins...' -# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master) +# +# if curl -Ikfs -o /dev/null --connect-timeout 2 --max-time 2 https://github.com; then +# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then +# install_tpm=true +# tmux display 'Installing tpm and plugins...' +# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm" +# elif { [ -z "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_reload"; }; then +# update_tpm=true +# tmux display 'Updating tpm and plugins...' +# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master) +# fi +# if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then +# perl -0777 -p -i -e 's/git clone --recursive/git clone --recursive --depth 1 --shallow-submodules/g +# ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh" +# perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh" +# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH" +# fi +# if [ x"$update_tpm" = x"true" ]; then +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >/dev/null 2>&1 +# tmux display 'Done updating tpm and plugins...' +# elif [ x"$install_tpm" = x"true" ]; then +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1 +# tmux display 'Done installing tpm and plugins...' +# fi +# else +# tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..." # fi -# if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then -# perl -0777 -p -i -e 's/git clone --recursive/git clone --recursive --depth 1 --shallow-submodules/g -# ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh" -# perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh" -# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH" -# fi -# if [ x"$update_tpm" = x"true" ]; then -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >/dev/null 2>&1 -# tmux display 'Done updating tpm and plugins...' -# elif [ x"$install_tpm" = x"true" ]; then -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1 -# tmux display 'Done installing tpm and plugins...' -# fi -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" +# +# [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" # if [ -z "$window_active" ] && [ $_tmux_version -lt 240 ]; then # tmux run -b "sleep $(expr $(tmux display -p '#{display-time}') / 500) && tmux set display-time 3000 \; display 'This configuration will soon require tmux 2.4+' \; set -u display-time" # fi diff --git a/.tmux.conf.local b/.tmux.conf.local index 057b2b2..c440076 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -347,6 +347,7 @@ tmux_conf_copy_to_os_clipboard=false # move status line to top #set -g status-position top + # -- tpm ----------------------------------------------------------------------- # while I don't use tpm myself, many people requested official support so here From 4f332e6b1748c1bc54db9e456c64f8509b465da8 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Tue, 31 Aug 2021 09:37:48 +0200 Subject: [PATCH 25/52] fixed _battery_info() when pmset doesn't report a charge percentage, fixes #512 --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 18df782..060f134 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -288,7 +288,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # while IFS= read -r line; do # [ -z "$line" ] && continue # discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false") -# percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%') +# percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%' || echo "0%") # charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }') # count=$((count + 1)) # done << EOF From a97e3021cca1f8220cdf906233e1aef0bda044f5 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 4 Sep 2021 18:00:02 +0200 Subject: [PATCH 26/52] updated tpm integration - automatically delete tpm when not used - automatically delete unused plugins - install plugins when subsequently enabling then in ~/.tmux.conf.local - use + u to update plugins as + U is bound to Urlview, fixes #507 --- .tmux.conf | 75 +++++++++++++++++++++++++++--------------------- .tmux.conf.local | 11 +++++++ README.md | 5 ++++ 3 files changed, 59 insertions(+), 32 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 060f134..82d7313 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1339,37 +1339,53 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # window_active="$1" # tmux_conf_update_plugins_on_launch="$2" # tmux_conf_update_plugins_on_reload="$3" +# tmux_conf_uninstall_plugins_on_reload="$4" # # TMUX_PLUGIN_MANAGER_PATH=${TMUX_PLUGIN_MANAGER_PATH:-~/.tmux/plugins} -# -# if curl -Ikfs -o /dev/null --connect-timeout 2 --max-time 2 https://github.com; then -# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then -# install_tpm=true -# tmux display 'Installing tpm and plugins...' -# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm" -# elif { [ -z "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_reload"; }; then -# update_tpm=true -# tmux display 'Updating tpm and plugins...' -# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master) -# fi -# if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then -# perl -0777 -p -i -e 's/git clone --recursive/git clone --recursive --depth 1 --shallow-submodules/g -# ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh" -# perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh" -# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH" -# fi -# if [ x"$update_tpm" = x"true" ]; then -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >/dev/null 2>&1 -# tmux display 'Done updating tpm and plugins...' -# elif [ x"$install_tpm" = x"true" ]; then -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1 -# tmux display 'Done installing tpm and plugins...' +# if [ -z "$(tmux show -gv '@plugin')" ] && [ -z "$(tmux show -gv '@tpm_plugins')" ]; then +# if _is_enabled "$tmux_conf_uninstall_plugins_on_reload" && [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then +# tmux display 'Uninstalling tpm and plugins...' +# rm -rf "$TMUX_PLUGIN_MANAGER_PATH" +# tmux display 'Done uninstalling tpm and plugins...' # fi # else -# tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..." +# if curl -Ikfs -o /dev/null --connect-timeout 2 --max-time 2 https://github.com; then +# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then +# install_tpm=true +# tmux display 'Installing tpm and plugins...' +# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm" +# elif { [ -z "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_reload"; }; then +# update_tpm=true +# tmux display 'Updating tpm and plugins...' +# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master) +# fi +# if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then +# perl -0777 -p -i -e 's/git clone/git clone --depth 1 --shallow-submodules/g +# ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh"& +# perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh"& +# wait +# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH" +# fi +# if [ x"$update_tpm" = x"true" ]; then +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1 +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >/dev/null 2>&1 +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all >/dev/null 2>&1 +# tmux display 'Done updating tpm and plugins...' +# elif [ x"$install_tpm" = x"true" ]; then +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1 +# tmux display 'Done installing tpm and plugins...' +# fi +# else +# tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..." +# fi +# +# [ -z "$(tmux show -gv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I' +# [ -z "$(tmux show -gv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u' +# [ -z "$(tmux show -gv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u' +# [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" +# tmux set -gu '@tpm-install' \; set -gu '@tpm-update' \; set -gu '@tpm-clean' \; set -gu '@plugin' # fi # -# [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" # if [ -z "$window_active" ] && [ $_tmux_version -lt 240 ]; then # tmux run -b "sleep $(expr $(tmux display -p '#{display-time}') / 500) && tmux set display-time 3000 \; display 'This configuration will soon require tmux 2.4+' \; set -u display-time" # fi @@ -1378,13 +1394,8 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # _apply_plugins() { # tmux_conf_update_plugins_on_launch=${tmux_conf_update_plugins_on_launch:-true} # tmux_conf_update_plugins_on_reload=${tmux_conf_update_plugins_on_reload:-true} -# if [ -n "$(tmux show -gv '@plugin')" ] || [ -n "$(tmux show -gv '@tpm_plugins')" ]; then -# tmux run -b "cut -c3- ~/.tmux.conf | sh -s __apply_plugins \"$window_active\" \"$tmux_conf_update_plugins_on_launch\" \"$tmux_conf_update_plugins_on_reload\"" -# elif [ -z "$window_active" ]; then -# if [ $_tmux_version -lt 240 ]; then -# tmux run -b 'tmux set display-time 3000 \; display "This configuration will soon require tmux 2.4+" \; set -u display-time' -# fi -# fi +# tmux_conf_uninstall_plugins_on_reload=${tmux_conf_uninstall_plugins_on_reload:-true} +# tmux run -b "cut -c3- ~/.tmux.conf | sh -s __apply_plugins \"$window_active\" \"$tmux_conf_update_plugins_on_launch\" \"$tmux_conf_update_plugins_on_reload\" \"$tmux_conf_uninstall_plugins_on_reload\"" # } # # _apply_configuration() { diff --git a/.tmux.conf.local b/.tmux.conf.local index c440076..515bc31 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -367,6 +367,17 @@ tmux_conf_update_plugins_on_launch=true # - false tmux_conf_update_plugins_on_reload=true +# by default, reloading the configuration will uninstall tpm and plugins when no +# plugins are enabled +# - true (default) +# - false +tmux_conf_uninstall_plugins_on_reload=true + +# /!\ the tpm bindings differ slightly from upstream: +# - installing plugins: + I +# - uninstalling plugins: + Alt + u +# - updating plugins: + u + # /!\ do not add set -g @plugin 'tmux-plugins/tpm' # /!\ do not add run '~/.tmux/plugins/tpm/tpm' diff --git a/README.md b/README.md index c007560..84263e5 100644 --- a/README.md +++ b/README.md @@ -311,6 +311,11 @@ This configuration now comes with built-in [TPM] support: - `~/.tmux.conf.local` copy ← people who are used to alter `.tmux.conf` to add TPM support will have to adapt their configuration +⚠️ The TPM bindings differ slightly from upstream: + - installing plugins: ` + I` + - uninstalling plugins: ` + Alt + u` + - updating plugins: ` + u` + See `~/.tmux.conf.local` for instructions. [TPM]: https://github.com/tmux-plugins/tpm From df46ab2ba97d7022cfe15d16a59baf3156b299b8 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 2 Oct 2021 23:49:58 +0200 Subject: [PATCH 27/52] fixed tpm plugins not installing on CentOS 7, fixes #520 - drop git clone --shallow-submodules as it requires git >= 2.9.0 - display a message when one of the tpm script fails --- .tmux.conf | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 82d7313..7a56936 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1360,19 +1360,21 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master) # fi # if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then -# perl -0777 -p -i -e 's/git clone/git clone --depth 1 --shallow-submodules/g +# perl -0777 -p -i -e 's/git clone/git clone --depth 1/g # ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh"& # perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh"& # wait # tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH" # fi # if [ x"$update_tpm" = x"true" ]; then -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1 -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >/dev/null 2>&1 -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all >/dev/null 2>&1 -# tmux display 'Done updating tpm and plugins...' +# { +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\ +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\ +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\ +# tmux display 'Done updating tpm and plugins...' +# } || tmux display 'Failed updating tpm and plugins...' # elif [ x"$install_tpm" = x"true" ]; then -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >/dev/null 2>&1 +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 # tmux display 'Done installing tpm and plugins...' # fi # else From f8a5a0886808f7dcef96a87103f726d213d8e237 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sun, 3 Oct 2021 09:43:18 +0200 Subject: [PATCH 28/52] worked around Falcon.app agent slowing everything down, fixes #492 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it appears the Falcon anti-malware product for end-points slows down ps -t /dev/ttysXXX commands 🤷 the workaround consists in passing ttysXXX instead of /dev/ttysXXX and is achieved by removing the /dev/ prefix in #{pane_tty} expansion with the help of formats substitutions --- .tmux.conf | 78 +++++++++++++++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 7a56936..6f2537e 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -558,7 +558,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _username() { -# tty=${1:-$(tmux display -p '#{pane_tty}')} +# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} # ssh_only=$2 # # tty_info=$(_tty_info "$tty") @@ -582,7 +582,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _hostname() { -# tty=${1:-$(tmux display -p '#{pane_tty}')} +# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} # ssh_only=$2 # full=$3 # h_or_H=$4 @@ -618,7 +618,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _root() { -# tty=${1:-$(tmux display -p '#{pane_tty}')} +# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} # root=$2 # # username=$(_username "$tty" false) @@ -675,7 +675,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _split_window_ssh() { -# tty=${1:-$(tmux display -p '#{pane_tty}')} +# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} # shift # # tty_info=$(_tty_info "$tty") @@ -726,7 +726,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # perl -p -i -e " # s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g # ; -# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{pane_tty}\2\5\1/g +# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{s,/dev/,,:pane_tty}\2\5\1/g # ; # s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{pane_tty\}\3)(.*?)\2/split-window\4/g # ; @@ -893,12 +893,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux_conf_theme_terminal_title=$(echo "$tmux_conf_theme_terminal_title" | sed \ # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g') # # tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-$tmux_conf_theme_colour_3} # tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-$tmux_conf_theme_colour_1} @@ -974,21 +974,21 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed \ # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g') # tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed \ # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g') # # # -- indicators # @@ -1034,10 +1034,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # if [ -n "$(tmux display -p '#{version}')" ]; then # status_left=$(echo "$status_left" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") # else # status_left=$(echo "$status_left" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") # fi # # status_left=$(printf '%s' "$status_left" | awk \ @@ -1122,10 +1122,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # if [ -n "$(tmux display -p '#{version}')" ]; then # status_right=$(echo "$status_right" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") # else # status_right=$(echo "$status_right" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") # fi # # status_right=$(printf '%s' "$status_right" | awk \ @@ -1229,19 +1229,19 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # case "$status_left $status_right" in # *'#{username}'*|*'#{hostname}'*|*'#{hostname_full}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*|*'#{hostname_full_ssh}'*) # status_left=$(echo "$status_left" | sed \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g') # status_right=$(echo "$status_right" | sed \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g') # ;; # esac # From a976b17bede13d4dd1cb13f39d954d0d03c5fb97 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Wed, 6 Oct 2021 16:17:36 +0200 Subject: [PATCH 29/52] worked around Falcon.app agent slowing everything down (2), fixes #522 --- .tmux.conf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 6f2537e..5506d52 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -726,9 +726,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # perl -p -i -e " # s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g # ; -# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{s,/dev/,,:pane_tty}\2\5\1/g +# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{s,\/dev\/,,:pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{s,\/dev\/,,:pane_tty}\2\5\1/g # ; -# s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{pane_tty\}\3)(.*?)\2/split-window\4/g +# s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{s,\/dev\/,,:pane_tty\}\3)(.*?)\2/split-window\4/g # ; # s/\bsplit-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" \ # "$cfg" @@ -743,13 +743,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # fi # # perl -p -i -e " -# s/\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window_ssh #\{pane_tty\}\1'/g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\ +# s/\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window_ssh #\{s,\/dev\/,,:pane_tty\}\1'/g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\ # "$cfg" # # tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true} # tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false} # if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then -# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{pane_tty\}\1'/g" "$cfg" +# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{s,\/dev\/,,:pane_tty\}\1'/g" "$cfg" # fi # # if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then @@ -758,9 +758,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # ; # s/\bsplit-window\b/split-window -c '#{pane_current_path}'\1/g # ; -# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\2'/g if /\bdisplay-menu\b/ +# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{s,\/dev\/,,:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{s,\/dev\/,,:pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\2'/g if /\bdisplay-menu\b/ # ; -# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{pane_tty\} -c \"#\{pane_current_path\}\"\2'/g" \ +# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{s,\/dev\/,,:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{s,\/dev\/,,:pane_tty\} -c \"#\{pane_current_path\}\"\2'/g" \ # "$cfg" # fi # From 18775e12a4ec8d4ecd7f8f9bd698f47ceedfbabd Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Mon, 11 Oct 2021 20:36:38 +0200 Subject: [PATCH 30/52] reworked pane / tty introspection, fixes #403, fixes #458 - renamed _tty_info() to _pane_info() - pass both #{pane_pid} and #{pane_tty} to _pane_info() - when inspecting ps output, walk down from #{pane_pid} to the child-most pid --- .tmux.conf | 147 +++++++++++++++++++++++++---------------------------- 1 file changed, 69 insertions(+), 78 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 5506d52..c4af41f 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -493,51 +493,39 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # set -g '@battery_percentage' "$battery_percentage" # } # -# _tty_info() { -# tty="${1##/dev/}" +# _pane_info() { +# pane_pid="$1" +# tty="${2##/dev/}" # case "$_uname_s" in # *CYGWIN*) -# ps -al | tail -n +2 | awk -v tty="$tty" ' +# ps -al | tail -n +2 | awk -v pane_pid="$pane_pid" -v tty="$tty" ' # ((/ssh/ && !/-W/) || !/ssh/) && $5 == tty { # user[$1] = $6; parent[$1] = $2; child[$2] = $1 # } # END { -# for (i in parent) -# { -# j = i -# while (parent[j]) -# j = parent[j] +# pid = pane_pid +# while (child[pid]) +# pid = child[pid] # -# if (!(i in child) && j != 1) -# { -# file = "/proc/" i "/cmdline"; getline command < file; close(file) -# gsub(/\0/, " ", command) -# "id -un " user[i] | getline username -# print i":"username":"command -# exit -# } -# } +# print pid":"user[pid]":"command[pid] +# file = "/proc/" pid "/cmdline"; getline command < file; close(file) +# gsub(/\0/, " ", command) +# "id -un " user[pid] | getline username +# print pid":"username":"command # } # ' # ;; # *) -# ps -t "$tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk ' +# ps -t "$tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" ' # NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) { # user[$2] = $1; parent[$2] = $3; child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4) # } # END { -# for (i in parent) -# { -# j = i -# while (parent[j]) -# j = parent[j] +# pid = pane_pid +# while (child[pid]) +# pid = child[pid] # -# if (!(i in child) && j != 1) -# { -# print i":"user[i]":"command[i] -# exit -# } -# } +# print pid":"user[pid]":"command[pid] # } # ' # ;; @@ -558,11 +546,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _username() { -# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} -# ssh_only=$2 +# pane_pid=${1:-$(tmux display -p '#{pane_pid}')} +# tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} +# ssh_only=$3 # -# tty_info=$(_tty_info "$tty") -# command=${tty_info#*:} +# pane_info=$(_pane_info "$pane_pid" "$tty") +# command=${pane_info#*:} # command=${command#*:} # # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command") @@ -573,7 +562,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # [ -z "$username" ] && username=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%username% / { print $2; exit }') # else # if ! _is_enabled "$ssh_only"; then -# username=${tty_info#*:} +# username=${pane_info#*:} # username=${username%%:*} # fi # fi @@ -582,13 +571,14 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _hostname() { -# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} -# ssh_only=$2 -# full=$3 -# h_or_H=$4 +# pane_pid=${1:-$(tmux display -p '#{pane_pid}')} +# tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} +# ssh_only=$3 +# full=$4 +# h_or_H=$5 # -# tty_info=$(_tty_info "$tty") -# command=${tty_info#*:} +# pane_info=$(_pane_info "$pane_pid" "$tty") +# command=${pane_info#*:} # command=${command#*:} # # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command") @@ -675,11 +665,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _split_window_ssh() { -# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} +# pane_pid=${1:-$(tmux display -p '#{pane_pid}')} +# tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} # shift # -# tty_info=$(_tty_info "$tty") -# command=${tty_info#*:} +# pane_info=$(_pane_info "$pane_pid" "$tty") +# command=${pane_info#*:} # command=${command#*:} # # case "$command" in @@ -726,7 +717,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # perl -p -i -e " # s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g # ; -# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{s,\/dev\/,,:pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{s,\/dev\/,,:pane_tty}\2\5\1/g +# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{s,\/dev\/,,:pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{pane_pid} #{s,\/dev\/,,:pane_tty}\2\5\1/g # ; # s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{s,\/dev\/,,:pane_tty\}\3)(.*?)\2/split-window\4/g # ; @@ -743,13 +734,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # fi # # perl -p -i -e " -# s/\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window_ssh #\{s,\/dev\/,,:pane_tty\}\1'/g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\ +# s/\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window_ssh #\{pane_pid\} #\{s,\/dev\/,,:pane_tty\}\1'/g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\ # "$cfg" # # tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true} # tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false} # if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then -# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{s,\/dev\/,,:pane_tty\}\1'/g" "$cfg" +# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{pane_pid\} #\{s,\/dev\/,,:pane_tty\}\1'/g" "$cfg" # fi # # if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then @@ -893,12 +884,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux_conf_theme_terminal_title=$(echo "$tmux_conf_theme_terminal_title" | sed \ # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true true #H #D)%g') # # tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-$tmux_conf_theme_colour_3} # tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-$tmux_conf_theme_colour_1} @@ -974,21 +965,21 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed \ # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true true #H #D)%g') # tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed \ # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true true #H #D)%g') # # # -- indicators # @@ -1034,7 +1025,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # if [ -n "$(tmux display -p '#{version}')" ]; then # status_left=$(echo "$status_left" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") # else # status_left=$(echo "$status_left" | sed \ # -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") @@ -1122,7 +1113,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # if [ -n "$(tmux display -p '#{version}')" ]; then # status_right=$(echo "$status_right" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") # else # status_right=$(echo "$status_right" | sed \ # -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") @@ -1229,19 +1220,19 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # case "$status_left $status_right" in # *'#{username}'*|*'#{hostname}'*|*'#{hostname_full}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*|*'#{hostname_full_ssh}'*) # status_left=$(echo "$status_left" | sed \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true true #H #D)%g') # status_right=$(echo "$status_right" | sed \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true true #H #D)%g') # ;; # esac # From a71d0d9f8de4773893d52befba18d7735b37faaa Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 28 Aug 2021 23:15:03 +0200 Subject: [PATCH 31/52] made background sleep process exit immediately when exiting tmux, fixes #509 --- .tmux.conf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index c4af41f..97f6c23 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1207,9 +1207,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # status_right="#(echo; nice cut -c3- ~/.tmux.conf | sh -s _battery_status \"$tmux_conf_battery_status_charging\" \"$tmux_conf_battery_status_discharging\")$status_right" # interval=60 # if [ $_tmux_version -ge 320 ]; then -# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done" +# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \$sleep_pid; exit 0' TERM; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval & sleep_pid=\$!; wait \$sleep_pid; sleep_pid=; done" # elif [ $_tmux_version -gt 240 ]; then -# status_right="#(echo; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done)$status_right" +# status_right="#(echo; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\")$status_right" # fi @@ -1260,9 +1260,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # ;; # esac # if [ $_tmux_version -ge 320 ]; then -# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done" +# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \$sleep_pid; exit 0' TERM; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval & sleep_pid=\$!; wait \$sleep_pid; sleep_pid=; done" # elif [ $_tmux_version -gt 240 ]; then -# status_right="#(echo; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done)$status_right" +# status_right="#(echo; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _uptime)$status_right" # fi @@ -1278,9 +1278,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') # interval=$(tmux show -gv status-interval) # if [ $_tmux_version -ge 320 ]; then -# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done" +# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \$sleep_pid; exit 0' TERM; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval & sleep_pid=\$!; wait \$sleep_pid; sleep_pid=; done" # elif [ $_tmux_version -gt 240 ]; then -# status_right="#(echo; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done)$status_right" +# status_right="#(echo; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right" # fi From e8032e3ffb77f6ac59185f797ec8d0df221eeb5e Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Tue, 19 Oct 2021 22:11:18 +0200 Subject: [PATCH 32/52] set default-terminal to tmux-256color when available, fixes #205, fixes #382, closes #386 see https://github.com/tmux/tmux/wiki/FAQ#i-dont-see-italics-or-italics-and-reverse-are-the-wrong-way-round --- .tmux.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 97f6c23..e098c81 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -9,7 +9,9 @@ # -- general ------------------------------------------------------------------- -set -g default-terminal "screen-256color" # colors! +set -g default-terminal "screen-256color" +if 'infocmp -x tmux-256color > /dev/null 2>&1' 'set -g default-terminal "tmux-256color"' + setw -g xterm-keys on set -s escape-time 10 # faster command sequences set -sg repeat-time 600 # increase repeat timeout From 90cdbbc32fb55017077d08f1f5e1597a0be70e73 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Fri, 22 Oct 2021 15:32:19 +0200 Subject: [PATCH 33/52] check connectivity to github.com before installing and/or updating tpm and plugins (2) --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index e098c81..3cda41b 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1342,7 +1342,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux display 'Done uninstalling tpm and plugins...' # fi # else -# if curl -Ikfs -o /dev/null --connect-timeout 2 --max-time 2 https://github.com; then +# if git ls-remote -hq https://github.com/gpakosz/.tmux.git master > /dev/null; then # if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then # install_tpm=true # tmux display 'Installing tpm and plugins...' From 14bd87c7b2b4efd9dee2d54bfe7f2a82041e749c Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Wed, 15 Sep 2021 23:05:01 +0200 Subject: [PATCH 34/52] added word boundaries when replacing uptime_xxx variables --- .tmux.conf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 3cda41b..49236fb 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1242,19 +1242,19 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # case "$status_left $status_right" in # *'#{uptime_'*|*'#{?uptime_'*) # status_left=$(echo "$status_left" | sed -E \ -# -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \ -# -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \ +# -e 's/#\{(\?)?uptime_y\b/#\{\1@uptime_y/g' \ +# -e 's/#\{(\?)?uptime_d\b/#\{\1@uptime_d/g' \ # -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \ # -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \ -# -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \ -# -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g') +# -e 's/#\{(\?)?uptime_m\b/#\{\1@uptime_m/g' \ +# -e 's/#\{(\?)?uptime_s\b/#\{\1@uptime_s/g') # status_right=$(echo "$status_right" | sed -E \ -# -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \ -# -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \ +# -e 's/#\{(\?)?uptime_y\b/#\{\1@uptime_y/g' \ +# -e 's/#\{(\?)?uptime_d\b/#\{\1@uptime_d/g' \ # -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \ -# -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \ -# -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \ -# -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g') +# -e 's/#\{(\?)?uptime_h\b/#\{\1@uptime_h/g' \ +# -e 's/#\{(\?)?uptime_m\b/#\{\1@uptime_m/g' \ +# -e 's/#\{(\?)?uptime_s\b/#\{\1@uptime_s/g') # interval=60 # case "$status_left $status_right" in # *'#{@uptime_s}'*) From 1cd8ed93d33f3ad4384d486bc6092507a0bb7713 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Wed, 15 Sep 2021 23:01:32 +0200 Subject: [PATCH 35/52] added support for arguments to custom variables defined in ~/.tmux.conf.local --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 49236fb..39214b3 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1297,7 +1297,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # -- custom variables --------------------------------------------------- # # if [ -f ~/.tmux.conf.local ] && [ x"$(cut -c3- ~/.tmux.conf.local | sh 2>/dev/null -s printf probe)" = x"probe" ]; then -# replacements=$(perl -n -e 'print if s!^#\s+([^()\s]+)\s*\(\)\s*{\s*\n!s%#\\\{\1\\\}%#(cut -c3- ~/.tmux.conf.local | sh -s \1)%g; !p' < ~/.tmux.conf.local) +# replacements=$(perl -n -e 'print if s!^#\s+([^()\s]+)\s*\(\)\s*{\s*\n!s%#\\\{\1(.*)\\\}%#(cut -c3- ~/.tmux.conf.local | sh -s \1\\1)%g; !p' < ~/.tmux.conf.local) # status_left=$(echo "$status_left" | perl -p -e "$replacements" || echo "$status_left") # status_right=$(echo "$status_right" | perl -p -e "$replacements" || echo "$status_right") # fi From 0da7d5c3db463a048b654bac79321d532a890271 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sun, 31 Oct 2021 18:15:18 +0100 Subject: [PATCH 36/52] reworked pane / tty introspection (2) fixed implementation and calls to _root() --- .tmux.conf | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 39214b3..6c49bba 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -497,10 +497,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _pane_info() { # pane_pid="$1" -# tty="${2##/dev/}" +# pane_tty="${2##/dev/}" # case "$_uname_s" in # *CYGWIN*) -# ps -al | tail -n +2 | awk -v pane_pid="$pane_pid" -v tty="$tty" ' +# ps -al | tail -n +2 | awk -v pane_pid="$pane_pid" -v tty="$pane_tty" ' # ((/ssh/ && !/-W/) || !/ssh/) && $5 == tty { # user[$1] = $6; parent[$1] = $2; child[$2] = $1 # } @@ -518,7 +518,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # ' # ;; # *) -# ps -t "$tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" ' +# ps -t "$pane_tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" ' # NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) { # user[$2] = $1; parent[$2] = $3; child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4) # } @@ -549,10 +549,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _username() { # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} -# tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} +# pane_tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} # ssh_only=$3 # -# pane_info=$(_pane_info "$pane_pid" "$tty") +# pane_info=$(_pane_info "$pane_pid" "$pane_tty") # command=${pane_info#*:} # command=${command#*:} # @@ -574,12 +574,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _hostname() { # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} -# tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} +# pane_tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} # ssh_only=$3 # full=$4 # h_or_H=$5 # -# pane_info=$(_pane_info "$pane_pid" "$tty") +# pane_info=$(_pane_info "$pane_pid" "$pane_tty") # command=${pane_info#*:} # command=${command#*:} # @@ -610,10 +610,11 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _root() { -# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} -# root=$2 +# pane_pid=${1:-$(tmux display -p '#{pane_pid}')} +# pane_tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} +# root=$3 # -# username=$(_username "$tty" false) +# username=$(_username "$pane_id" "$pane_tty" false) # # [ x"$username" = x"root" ] && echo "$root" # } @@ -668,10 +669,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _split_window_ssh() { # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} -# tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} +# pane_tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} # shift # -# pane_info=$(_pane_info "$pane_pid" "$tty") +# pane_info=$(_pane_info "$pane_pid" "$pane_tty") # command=${pane_info#*:} # command=${command#*:} # @@ -1030,7 +1031,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") # else # status_left=$(echo "$status_left" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_pid} #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") # fi # # status_left=$(printf '%s' "$status_left" | awk \ @@ -1113,12 +1114,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g') # -# if [ -n "$(tmux display -p '#{version}')" ]; then +# if [ -z "$(tmux display -p '#{version}')" ]; then # status_right=$(echo "$status_right" | sed \ # -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") # else # status_right=$(echo "$status_right" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_pid} #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") # fi # # status_right=$(printf '%s' "$status_right" | awk \ From 0ad7f141dc10fe4964b963bc215bb5e12972b0c3 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sun, 31 Oct 2021 20:55:41 +0100 Subject: [PATCH 37/52] added word boundaries when replacing uptime_xxx variables (2) use perl instead of sead as on macOS sed doesn't support \b to match word boundaries --- .tmux.conf | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 6c49bba..32b7b78 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1242,20 +1242,20 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _uptime' # case "$status_left $status_right" in # *'#{uptime_'*|*'#{?uptime_'*) -# status_left=$(echo "$status_left" | sed -E \ -# -e 's/#\{(\?)?uptime_y\b/#\{\1@uptime_y/g' \ -# -e 's/#\{(\?)?uptime_d\b/#\{\1@uptime_d/g' \ -# -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \ -# -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \ -# -e 's/#\{(\?)?uptime_m\b/#\{\1@uptime_m/g' \ -# -e 's/#\{(\?)?uptime_s\b/#\{\1@uptime_s/g') -# status_right=$(echo "$status_right" | sed -E \ -# -e 's/#\{(\?)?uptime_y\b/#\{\1@uptime_y/g' \ -# -e 's/#\{(\?)?uptime_d\b/#\{\1@uptime_d/g' \ -# -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \ -# -e 's/#\{(\?)?uptime_h\b/#\{\1@uptime_h/g' \ -# -e 's/#\{(\?)?uptime_m\b/#\{\1@uptime_m/g' \ -# -e 's/#\{(\?)?uptime_s\b/#\{\1@uptime_s/g') +# status_left=$(echo "$status_left" | perl -p -e ' +# ; s/#\{(\?)?uptime_y\b/#\{\1\@uptime_y/g +# ; s/#\{(\?)?uptime_d\b/#\{\1\@uptime_d/g +# ; s/\@uptime_d\b/\@uptime_dy/g if /\@uptime_y\b/ +# ; s/#\{(\?)?uptime_h\b/#\{\1\@uptime_h/g +# ; s/#\{(\?)?uptime_m\b/#\{\1\@uptime_m/g +# ; s/#\{(\?)?uptime_s\b/#\{\1\@uptime_s/g') +# status_right=$(echo "$status_right" | perl -p -e ' +# ; s/#\{(\?)?uptime_y\b/#\{\1\@uptime_y/g +# ; s/#\{(\?)?uptime_d\b/#\{\1\@uptime_d/g +# ; s/\@uptime_d\b/\@uptime_dy/g if /\@uptime_y\b/ +# ; s/#\{(\?)?uptime_h\b/#\{\1\@uptime_h/g +# ; s/#\{(\?)?uptime_m\b/#\{\1\@uptime_m/g +# ; s/#\{(\?)?uptime_s\b/#\{\1\@uptime_s/g') # interval=60 # case "$status_left $status_right" in # *'#{@uptime_s}'*) From ee1547cb6c9a8586e28b31092e28c4d196b6d8ff Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Tue, 9 Nov 2021 19:03:08 +0100 Subject: [PATCH 38/52] reworked pane / tty introspection (3) fixed _pane_info() when running under Cygwin --- .tmux.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 32b7b78..164836b 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -509,7 +509,6 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # while (child[pid]) # pid = child[pid] # -# print pid":"user[pid]":"command[pid] # file = "/proc/" pid "/cmdline"; getline command < file; close(file) # gsub(/\0/, " ", command) # "id -un " user[pid] | getline username From 2751c215a1962f0772464ccc8e05ca1feac12fd0 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Mon, 8 Nov 2021 19:34:28 +0100 Subject: [PATCH 39/52] do not unset @tpm-install, @tpm-update, @tpm-clean and @plugin variables after tpm has launched, fixes #531 --- .tmux.conf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 164836b..67421bc 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1374,11 +1374,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..." # fi # -# [ -z "$(tmux show -gv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I' -# [ -z "$(tmux show -gv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u' -# [ -z "$(tmux show -gv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u' +# [ -z "$(tmux show -gqv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I' +# [ -z "$(tmux show -gqv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u' +# [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u' # [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" -# tmux set -gu '@tpm-install' \; set -gu '@tpm-update' \; set -gu '@tpm-clean' \; set -gu '@plugin' +# if [ $_tmux_version -gt 260 ]; then +# tmux set -gu '@tpm-install' \; set -gu '@tpm-update' \; set -gu '@tpm-clean' \; set -gu '@plugin' +# fi # fi # # if [ -z "$window_active" ] && [ $_tmux_version -lt 240 ]; then From c4220639fffd8d5d346299ece42699236ad48ce1 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Tue, 9 Nov 2021 18:40:44 +0100 Subject: [PATCH 40/52] worked around Falcon.app agent slowing everything down (3) tmux < 2.8 doesn't support regex substitutions so we use basename substitution instead --- .tmux.conf | 88 +++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 67421bc..6c8ed27 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -548,7 +548,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _username() { # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} -# pane_tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} +# pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} # ssh_only=$3 # # pane_info=$(_pane_info "$pane_pid" "$pane_tty") @@ -573,7 +573,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _hostname() { # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} -# pane_tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} +# pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} # ssh_only=$3 # full=$4 # h_or_H=$5 @@ -610,7 +610,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _root() { # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} -# pane_tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} +# pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} # root=$3 # # username=$(_username "$pane_id" "$pane_tty" false) @@ -668,7 +668,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # _split_window_ssh() { # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} -# pane_tty=${2:-$(tmux display -p '#{s,/dev/,,:pane_tty}')} +# pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} # shift # # pane_info=$(_pane_info "$pane_pid" "$pane_tty") @@ -719,9 +719,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # perl -p -i -e " # s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g # ; -# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{s,\/dev\/,,:pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{pane_pid} #{s,\/dev\/,,:pane_tty}\2\5\1/g +# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{b:pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{pane_pid} #{b:pane_tty}\2\5\1/g # ; -# s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{s,\/dev\/,,:pane_tty\}\3)(.*?)\2/split-window\4/g +# s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{b:pane_tty\}\3)(.*?)\2/split-window\4/g # ; # s/\bsplit-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" \ # "$cfg" @@ -736,13 +736,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # fi # # perl -p -i -e " -# s/\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window_ssh #\{pane_pid\} #\{s,\/dev\/,,:pane_tty\}\1'/g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\ +# s/\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window_ssh #\{pane_pid\} #\{b:pane_tty\}\1'/g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\ # "$cfg" # # tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true} # tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false} # if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then -# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{pane_pid\} #\{s,\/dev\/,,:pane_tty\}\1'/g" "$cfg" +# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{pane_pid\} #\{b:pane_tty\}\1'/g" "$cfg" # fi # # if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then @@ -751,9 +751,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # ; # s/\bsplit-window\b/split-window -c '#{pane_current_path}'\1/g # ; -# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{s,\/dev\/,,:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{s,\/dev\/,,:pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\2'/g if /\bdisplay-menu\b/ +# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{b:pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\2'/g if /\bdisplay-menu\b/ # ; -# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{s,\/dev\/,,:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{s,\/dev\/,,:pane_tty\} -c \"#\{pane_current_path\}\"\2'/g" \ +# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{b:pane_tty\} -c \"#\{pane_current_path\}\"\2'/g" \ # "$cfg" # fi # @@ -886,12 +886,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux_conf_theme_terminal_title=$(echo "$tmux_conf_theme_terminal_title" | sed \ # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} true true #H #D)%g') # # tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-$tmux_conf_theme_colour_3} # tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-$tmux_conf_theme_colour_1} @@ -967,21 +967,21 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed \ # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} true true #H #D)%g') # tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed \ # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} true true #H #D)%g') # # # -- indicators # @@ -1027,10 +1027,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # if [ -n "$(tmux display -p '#{version}')" ]; then # status_left=$(echo "$status_left" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") # else # status_left=$(echo "$status_left" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_pid} #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_pid} #{b:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") # fi # # status_left=$(printf '%s' "$status_left" | awk \ @@ -1115,10 +1115,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # if [ -z "$(tmux display -p '#{version}')" ]; then # status_right=$(echo "$status_right" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g") # else # status_right=$(echo "$status_right" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_pid} #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_pid} #{b:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g") # fi # # status_right=$(printf '%s' "$status_right" | awk \ @@ -1222,19 +1222,19 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # case "$status_left $status_right" in # *'#{username}'*|*'#{hostname}'*|*'#{hostname_full}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*|*'#{hostname_full_ssh}'*) # status_left=$(echo "$status_left" | sed \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} true true #H #D)%g') # status_right=$(echo "$status_right" | sed \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} false #D)%g' \ -# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false false #h #D)%g' \ -# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} false true #H #D)%g' \ -# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{s,/dev/,,:pane_tty} true #D)%g' \ -# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true false #h #D)%g' \ -# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{s,/dev/,,:pane_tty} true true #H #D)%g') +# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} false false #h #D)%g' \ +# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} false true #H #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_pid} #{b:pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} true false #h #D)%g' \ +# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_pid} #{b:pane_tty} true true #H #D)%g') # ;; # esac # From 24f1222307f072a7f6d83dfd57572e16f6b82569 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Tue, 9 Nov 2021 19:34:03 +0100 Subject: [PATCH 41/52] made background sleep process exit immediately when exiting tmux (2) tmux < 2.8 doesn't support #{l:...} --- .tmux.conf | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 6c8ed27..7affd11 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1210,8 +1210,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # interval=60 # if [ $_tmux_version -ge 320 ]; then # tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \$sleep_pid; exit 0' TERM; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval & sleep_pid=\$!; wait \$sleep_pid; sleep_pid=; done" -# elif [ $_tmux_version -gt 240 ]; then +# elif [ $_tmux_version -ge 280 ]; then # status_right="#(echo; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done)$status_right" +# elif [ $_tmux_version -gt 240 ]; then +# status_right="#(echo; while :; do nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\"; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _battery_bar \"$tmux_conf_battery_bar_symbol_full\" \"$tmux_conf_battery_bar_symbol_empty\" \"$tmux_conf_battery_bar_length\" \"$tmux_conf_battery_bar_palette\" \"$tmux_conf_battery_hbar_palette\" \"$tmux_conf_battery_vbar_palette\")$status_right" # fi @@ -1263,8 +1265,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # esac # if [ $_tmux_version -ge 320 ]; then # tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \$sleep_pid; exit 0' TERM; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval & sleep_pid=\$!; wait \$sleep_pid; sleep_pid=; done" -# elif [ $_tmux_version -gt 240 ]; then +# elif [ $_tmux_version -gt 280 ]; then # status_right="#(echo; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done)$status_right" +# elif [ $_tmux_version -gt 240 ]; then +# status_right="#(echo; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _uptime)$status_right" # fi @@ -1281,8 +1285,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # interval=$(tmux show -gv status-interval) # if [ $_tmux_version -ge 320 ]; then # tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \$sleep_pid; exit 0' TERM; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval & sleep_pid=\$!; wait \$sleep_pid; sleep_pid=; done" -# elif [ $_tmux_version -gt 240 ]; then +# elif [ $_tmux_version -gt 280 ]; then # status_right="#(echo; while [ x\"\$(tmux -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done)$status_right" +# elif [ $_tmux_version -gt 240 ]; then +# status_right="#(echo; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done)$status_right" # else # status_right="#(nice cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right" # fi From 69f744117ac5c97eb0f8f3481546974180174260 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 11 Nov 2021 18:56:11 +0100 Subject: [PATCH 42/52] updated tpm integration to display a message when one or more plugin(s) fails to run, closes #533 --- .tmux.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 7affd11..3e3bdca 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1362,6 +1362,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # perl -0777 -p -i -e 's/git clone/git clone --depth 1/g # ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh"& # perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh"& +# perl -p -i -e 's,\$tmux_file\s+>/dev/null\s+2>\&1,$& || { tmux display "Plugin \$(basename \${plugin_path}) failed" && false; },' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/source_plugins.sh"& # wait # tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH" # fi @@ -1383,7 +1384,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # [ -z "$(tmux show -gqv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I' # [ -z "$(tmux show -gqv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u' # [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u' -# [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" +# [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" || tmux display "One or more tpm plugin(s) failed" # if [ $_tmux_version -gt 260 ]; then # tmux set -gu '@tpm-install' \; set -gu '@tpm-update' \; set -gu '@tpm-clean' \; set -gu '@plugin' # fi From 1ef9b68d80da43d85b394c64247ce47e88b75e8d Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Wed, 20 Oct 2021 22:37:03 +0200 Subject: [PATCH 43/52] improved _pane_info() accuracy by excluding ssh proxy connections, tee, and only considering the first child of a process ps output is sorted by controlling terminal then pid in case of a cmd1 | cmd2 | cmd3 pipe chain, we only consider the first child of the parent process, which is cmd1 in the majority of cases the rare situation when pids wrap around isn't worth additional work on Linux - we sort ps output by lstart in hope precision is enough to make cmd1 always appear first even when pids wrap around - the more complex solution involves inspecting /proc//fd/0 to filter out processes being piped to finally, while lsof was promising, it won't list processes owned by other users unless run as root --- .tmux.conf | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 3e3bdca..48f0117 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -501,8 +501,8 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # case "$_uname_s" in # *CYGWIN*) # ps -al | tail -n +2 | awk -v pane_pid="$pane_pid" -v tty="$pane_tty" ' -# ((/ssh/ && !/-W/) || !/ssh/) && $5 == tty { -# user[$1] = $6; parent[$1] = $2; child[$2] = $1 +# ((/ssh/ && !/-W/) || !/ssh/) && !/tee/ && $5 == tty { +# user[$1] = $6; if (!child[$2]) child[$2] = $1 # } # END { # pid = pane_pid @@ -516,10 +516,24 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # ' # ;; +# *Linux*) +# ps -t "$pane_tty" --sort=lstart -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" ' +# ((/ssh/ && !/-W/) || !/ssh/) && !/tee/ { +# user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4) +# } +# END { +# pid = pane_pid +# while (child[pid]) +# pid = child[pid] +# +# print pid":"user[pid]":"command[pid] +# } +# ' +# ;; # *) # ps -t "$pane_tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" ' -# NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) { -# user[$2] = $1; parent[$2] = $3; child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4) +# ((/ssh/ && !/-W/) || !/ssh/) && !/tee/ { +# user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4) # } # END { # pid = pane_pid From c6bab99f051c73c5ba3879751f25bb66c4c6be0d Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Tue, 2 Nov 2021 14:21:55 +0100 Subject: [PATCH 44/52] updated _ssh_or_mosh_args() relaxed the regex to accommodate for renamed ssh clients and to ignore the command if supplied --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 48f0117..5a6b808 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -550,7 +550,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # _ssh_or_mosh_args() { # case "$1" in # *ssh*) -# args=$(printf '%s' "$1" | perl -n -e 'print if s/(.*?)\bssh\b\s+(.*)/\2/') +# args=$(printf '%s' "$1" | perl -n -e 'print if s/.*?\bssh[\w]*\s*((?:\s+-\w+)*)(\s+\w+)(\s\w+)?/\1\2/') # ;; # *mosh-client*) # args=$(printf '%s' "$1" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g') From d471ccc068d83670b5b21be27eb2d33cc9f4f417 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Wed, 10 Nov 2021 19:37:03 +0100 Subject: [PATCH 45/52] updated _username() in when the ssh client doesn't support %r in ProxyCommand in such a case, we use -o IdentityFile='%%username%%/%r' and parse the output of ssh -v --- .tmux.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 5a6b808..62447e5 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -574,7 +574,8 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # shellcheck disable=SC2086 # username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^user / { print $2; exit }') # # shellcheck disable=SC2086 -# [ -z "$username" ] && username=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%username% / { print $2; exit }') +# [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" 2>&1 | awk '/^%username% / { print $2; exit }') +# [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -v -T -o ControlPath=none -o ProxyCommand=false -o IdentityFile='%%username%%/%r' 2>&1 | awk '/%username%/ { print substr($4,12); exit }') # else # if ! _is_enabled "$ssh_only"; then # username=${pane_info#*:} From 0fe760fa6decf6e743e2f9b38a97ae2e2df998a3 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Fri, 19 Nov 2021 12:06:17 +0100 Subject: [PATCH 46/52] reworked pane / tty introspection (4), fixes #535 fixed _split_window_ssh() --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 62447e5..691efd5 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -684,7 +684,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # _split_window_ssh() { # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} # pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} -# shift +# shift 2 # # pane_info=$(_pane_info "$pane_pid" "$pane_tty") # command=${pane_info#*:} From a453b7fe60c289afe9e4aeaa37dc810add4b6643 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Mon, 29 Nov 2021 22:24:48 +0100 Subject: [PATCH 47/52] use send-keys -R to clear terminal and remove the sleep call --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 691efd5..4c7866d 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -48,7 +48,7 @@ set -g display-time 1000 # slightly longer status messages display time set -g status-interval 10 # redraw status line every 10 seconds # clear both screen and history -bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history +bind -n C-l send-keys -R \; clear-history # activity set -g monitor-activity on From 985d64c82ef86266513acbe9ebea2bb7614bfc0b Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Tue, 30 Nov 2021 07:27:23 +0100 Subject: [PATCH 48/52] Revert "use send-keys -R to clear terminal and remove the sleep call", fixes #538 Instead, increase the sleep delay --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 4c7866d..e2e4d76 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -48,7 +48,7 @@ set -g display-time 1000 # slightly longer status messages display time set -g status-interval 10 # redraw status line every 10 seconds # clear both screen and history -bind -n C-l send-keys -R \; clear-history +bind -n C-l send-keys C-l \; run 'sleep 0.2' \; clear-history # activity set -g monitor-activity on From 96d085eaa702a5c2b003961e46aa5378d7e6d93e Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 9 Dec 2021 22:37:22 +0100 Subject: [PATCH 49/52] made _apply_bindings() work with tmux 3.4 stock bindings, fixes #541 --- .tmux.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index e2e4d76..cc8ecd0 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -744,7 +744,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false} # if _is_enabled "$tmux_conf_new_window_retain_current_path"; then # perl -p -i -e " -# s/\bnew-window\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/ +# s/\bnew-window\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/ # ; # s/\bnew-window\b/new-window -c '#\{pane_current_path\}'/g" \ # "$cfg" @@ -762,7 +762,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then # perl -p -i -e " -# s/\bsplit-window\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/ +# s/\bsplit-window\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/ # ; # s/\bsplit-window\b/split-window -c '#{pane_current_path}'\1/g # ; @@ -775,7 +775,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false} # if _is_enabled "$tmux_conf_new_session_prompt"; then # perl -p -i \ -# -e "s/(? Date: Sun, 12 Dec 2021 11:15:19 +0100 Subject: [PATCH 50/52] made tpm integration and patching more robust, fixes #540 --- .tmux.conf | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index cc8ecd0..a9b1be8 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1371,26 +1371,31 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # elif { [ -z "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_enabled "$tmux_conf_update_plugins_on_reload"; }; then # update_tpm=true # tmux display 'Updating tpm and plugins...' -# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git checkout -q master && git reset -q --hard HEAD && git pull -q origin master) +# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git fetch -q -p && git checkout -q master && git reset -q --hard origin/master) # fi # if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then -# perl -0777 -p -i -e 's/git clone/git clone --depth 1/g -# ;s/(install_plugin "\$plugin")\n(\s+)done/\1&\n\2done\n\2wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh"& -# perl -p -i -e 's/git submodule update --init --recursive/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh"& -# perl -p -i -e 's,\$tmux_file\s+>/dev/null\s+2>\&1,$& || { tmux display "Plugin \$(basename \${plugin_path}) failed" && false; },' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/source_plugins.sh"& -# wait +# perl -0777 -p -i -e 's/git clone(?!\s+--depth\s+1)/git clone --depth 1/g +# ;s/(install_plugin(.(?!&))*)\n(\s+)done/\1&\n\3done\n\3wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh" +# perl -p -i -e 's/git submodule update --init --recursive(?!\s+--depth\s+1)/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh" +# perl -p -i -e 's,\$tmux_file\s+>/dev/null\s+2>\&1,$& || { tmux display "Plugin \$(basename \${plugin_path}) failed" && false; },' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/source_plugins.sh" # tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH" # fi # if [ x"$update_tpm" = x"true" ]; then # { -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\ +# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \ +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\ +# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins all ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \ # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\ +# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins all ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \ # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\ # tmux display 'Done updating tpm and plugins...' # } || tmux display 'Failed updating tpm and plugins...' # elif [ x"$install_tpm" = x"true" ]; then -# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 -# tmux display 'Done installing tpm and plugins...' +# { +# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \ +# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 +# tmux display 'Done installing tpm and plugins...' +# } || tmux display 'Failed installing tpm and plugins...' # fi # else # tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..." From b3915221f8590914e681e2da0d7ecd6e8ceb97b0 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Tue, 11 Jan 2022 18:21:48 +0100 Subject: [PATCH 51/52] added the ' + Shift + Tab' binding to move to the last session --- .tmux.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.tmux.conf b/.tmux.conf index a9b1be8..15d70bf 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -63,6 +63,9 @@ bind C-c new-session # find session bind C-f command-prompt -p find-session 'switch-client -t %%' +# session navigation +bind BTab switch-client -l # move to last session + # split current window horizontally bind - split-window -v # split current window vertically From 9a2387c0c7aa8d12cff06d6be17251e8ebdfd034 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Fri, 14 Jan 2022 07:45:06 +0100 Subject: [PATCH 52/52] added support for arguments to custom variables defined in ~/.tmux.conf.local (2), fixes #547 --- .tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tmux.conf b/.tmux.conf index 15d70bf..3b65e46 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1321,7 +1321,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # -- custom variables --------------------------------------------------- # # if [ -f ~/.tmux.conf.local ] && [ x"$(cut -c3- ~/.tmux.conf.local | sh 2>/dev/null -s printf probe)" = x"probe" ]; then -# replacements=$(perl -n -e 'print if s!^#\s+([^()\s]+)\s*\(\)\s*{\s*\n!s%#\\\{\1(.*)\\\}%#(cut -c3- ~/.tmux.conf.local | sh -s \1\\1)%g; !p' < ~/.tmux.conf.local) +# replacements=$(perl -n -e 'print if s!^#\s+([^_][^()\s]+)\s*\(\)\s*{\s*\n!s%#\\\{\1((?:\\s+(?:[^\{\}]+?|#\\{(?:[^\{\}]+?)\}))*)\\\}%#(cut -c3- ~/.tmux.conf.local | sh -s \1\\1)%g; !p' < ~/.tmux.conf.local) # status_left=$(echo "$status_left" | perl -p -e "$replacements" || echo "$status_left") # status_right=$(echo "$status_right" | perl -p -e "$replacements" || echo "$status_right") # fi