diff --git a/.tmux.conf b/.tmux.conf index e89d9e8..4b9d855 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -563,12 +563,13 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # ssh_or_mosh_args=$(_ssh_or_mosh_args "$tty_info") # if [ -n "$ssh_or_mosh_args" ]; then # # shellcheck disable=SC2086 -# username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk 'NR > 2 { exit } ; /^user / { print $2 }') +# 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 }') # else # if ! _is_enabled "$ssh_only"; then -# username=$(printf '%s' "$tty_info" | cut -d' ' -f2) +# username="${tty_info#* }" +# username="${username%% *}" # fi # fi # @@ -584,20 +585,21 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # ssh_or_mosh_args=$(_ssh_or_mosh_args "$tty_info") # if [ -n "$ssh_or_mosh_args" ]; then # # shellcheck disable=SC2086 -# hostname=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk 'NR > 2 { exit } ; /^hostname / { print $2 }') +# hostname=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^hostname / { print $2; exit }') # # 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 }') -# #shellcheck disable=SC1004 -# hostname=$(echo "$hostname" | awk '\ -# { \ -# if ($1~/^[0-9.:]+$/) \ -# print $1; \ -# else \ -# split($1, a, ".") ; print a[1] \ -# }') +# +# case "$hostname" in +# *[a-z-].*) +# hostname=${hostname%%.*} +# ;; +# 127.0.0.1) +# hostname="localhost" +# ;; +# esac # else # if ! _is_enabled "$ssh_only"; then -# hostname=$(command hostname -s) +# hostname=$3 # fi # fi # @@ -864,9 +866,9 @@ 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 #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #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 #D)%g') +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g') # tmux set -g set-titles-string "$(_decode_unicode_escapes "$tmux_conf_theme_terminal_title")" # # tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-#8a8a8a} # white @@ -888,16 +890,16 @@ 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 #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #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 #D)%g') +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} 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 #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #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 #D)%g') +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g') # # tmux setw -g window-status-style "fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr" \;\ # setw -g window-status-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_format")" \;\ @@ -1162,14 +1164,14 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # *'#{username}'*|*'#{hostname}'*|*'#{username_ssh}'*|*'#{hostname_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 #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #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 #D)%g') +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} 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 #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #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 #D)%g') +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g') # ;; # esac #