reworked pane / tty introspection (2)
fixed implementation and calls to _root()
This commit is contained in:
parent
1cd8ed93d3
commit
0da7d5c3db
1 changed files with 16 additions and 15 deletions
31
.tmux.conf
31
.tmux.conf
|
@ -497,10 +497,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
#
|
#
|
||||||
# _pane_info() {
|
# _pane_info() {
|
||||||
# pane_pid="$1"
|
# pane_pid="$1"
|
||||||
# tty="${2##/dev/}"
|
# pane_tty="${2##/dev/}"
|
||||||
# case "$_uname_s" in
|
# case "$_uname_s" in
|
||||||
# *CYGWIN*)
|
# *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 {
|
# ((/ssh/ && !/-W/) || !/ssh/) && $5 == tty {
|
||||||
# user[$1] = $6; parent[$1] = $2; child[$2] = $1
|
# 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/) {
|
# NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) {
|
||||||
# user[$2] = $1; parent[$2] = $3; child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4)
|
# 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() {
|
# _username() {
|
||||||
# pane_pid=${1:-$(tmux display -p '#{pane_pid}')}
|
# 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
|
# ssh_only=$3
|
||||||
#
|
#
|
||||||
# pane_info=$(_pane_info "$pane_pid" "$tty")
|
# pane_info=$(_pane_info "$pane_pid" "$pane_tty")
|
||||||
# command=${pane_info#*:}
|
# command=${pane_info#*:}
|
||||||
# command=${command#*:}
|
# command=${command#*:}
|
||||||
#
|
#
|
||||||
|
@ -574,12 +574,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
#
|
#
|
||||||
# _hostname() {
|
# _hostname() {
|
||||||
# pane_pid=${1:-$(tmux display -p '#{pane_pid}')}
|
# 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
|
# ssh_only=$3
|
||||||
# full=$4
|
# full=$4
|
||||||
# h_or_H=$5
|
# h_or_H=$5
|
||||||
#
|
#
|
||||||
# pane_info=$(_pane_info "$pane_pid" "$tty")
|
# pane_info=$(_pane_info "$pane_pid" "$pane_tty")
|
||||||
# command=${pane_info#*:}
|
# command=${pane_info#*:}
|
||||||
# command=${command#*:}
|
# command=${command#*:}
|
||||||
#
|
#
|
||||||
|
@ -610,10 +610,11 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# _root() {
|
# _root() {
|
||||||
# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')}
|
# pane_pid=${1:-$(tmux display -p '#{pane_pid}')}
|
||||||
# root=$2
|
# 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"
|
# [ x"$username" = x"root" ] && echo "$root"
|
||||||
# }
|
# }
|
||||||
|
@ -668,10 +669,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
|
||||||
#
|
#
|
||||||
# _split_window_ssh() {
|
# _split_window_ssh() {
|
||||||
# pane_pid=${1:-$(tmux display -p '#{pane_pid}')}
|
# 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
|
# shift
|
||||||
#
|
#
|
||||||
# pane_info=$(_pane_info "$pane_pid" "$tty")
|
# pane_info=$(_pane_info "$pane_pid" "$pane_tty")
|
||||||
# command=${pane_info#*:}
|
# command=${pane_info#*:}
|
||||||
# command=${command#*:}
|
# 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")
|
# -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
|
# else
|
||||||
# status_left=$(echo "$status_left" | sed \
|
# 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
|
# fi
|
||||||
#
|
#
|
||||||
# status_left=$(printf '%s' "$status_left" | awk \
|
# 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%#{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')
|
# -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 \
|
# 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} #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g")
|
||||||
# else
|
# else
|
||||||
# status_right=$(echo "$status_right" | sed \
|
# 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
|
# fi
|
||||||
#
|
#
|
||||||
# status_right=$(printf '%s' "$status_right" | awk \
|
# status_right=$(printf '%s' "$status_right" | awk \
|
||||||
|
|
Loading…
Reference in a new issue