diff --git a/.tmux.conf b/.tmux.conf index eb78830..ee07a8a 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,4 +1,4 @@ -# cat << EOF > /dev/null +# : << EOF # https://github.com/gpakosz/.tmux # (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, # without any warranty. @@ -188,11 +188,10 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # fi # fi # -# __newline=' -# ' +# _uname_s=$(uname -s) # # _is_enabled() { -# ( ([ x"$1" = x"enabled" ] || [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"1" ]) && return 0 ) || return 1 +# [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"enabled" ] || [ x"$1" = x"1" ] # } # # _circled() { @@ -210,6 +209,33 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # printf '%s' "$*" | perl -CS -pe 's/(\\u([0-9A-Fa-f]{1,4})|\\U([0-9A-Fa-f]{1,8}))/chr(hex($2.$3))/eg' 2>/dev/null # } # +# if command -v pkill > /dev/null 2>&1; then +# _pkillf() { +# pkill -f "$@" || true +# } +# else +# case "$_uname_s" in +# *CYGWIN*) +# _pkillf() { +# while IFS= read -r pid; do +# kill "$pid" || true +# done << EOF +# $(grep -Eao "$@" /proc/*/cmdline | xargs -0 | sed -E -n 's,/proc/([0-9]+)/.+$,\1,pg') +# EOF +# } +# ;; +# *) +# _pkillf() { +# while IFS= read -r pid; do +# kill "$pid" || true +# done << EOF +# $(ps -x -o pid= -o command= | grep -E "$@" | cut -d' ' -f1) +# EOF +# } +# ;; +# esac +# fi +# # _maximize_pane() { # current_session=${1:-$(tmux display -p '#{session_name}')} # current_pane=${2:-$(tmux display -p '#{pane_id}')} @@ -252,16 +278,14 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # display "mouse: $new" # } # -# _battery() { +# _battery_info() { # count=0 # charge=0 -# uname_s=$(uname -s) -# case "$uname_s" in +# case "$_uname_s" in # *Darwin*) # while IFS= read -r line; do -# if [ x"$discharging" != x"true" ]; then -# discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false") -# fi +# [ -z "$line" ] && continue +# discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false") # percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%') # charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }') # count=$((count + 1)) @@ -271,11 +295,10 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # ;; # *Linux*) # while IFS= read -r batpath; do +# [ -z "$batpath" ] && continue # grep -i -q device "$batpath/scope" 2> /dev/null && continue # -# if [ x"$discharging" != x"true" ]; then -# discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false") -# fi +# 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 }') @@ -294,21 +317,17 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # *CYGWIN*|*MSYS*|*MINGW*) # while IFS= read -r line; do # [ -z "$line" ] && continue -# if [ x"$discharging" != x"true" ]; then -# discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }') -# fi +# discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }') # charge=$(printf '%s' "$line" | awk -v charge="$charge" '{ print charge + $2 / 100 }') # count=$((count + 1)) # done << EOF -# $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining | tr -d '\r' | tail -n +2) +# $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining 2> /dev/null | tr -d '\r' | tail -n +2 || true) # EOF # ;; # *OpenBSD*) # for batid in 0 1 2; do # sysctl -n "hw.sensors.acpibat$batid.raw0" 2>&1 | grep -q 'not found' && continue -# if [ x"$discharging" != x"true" ]; then -# discharging=$(sysctl -n "hw.sensors.acpibat$batid.raw0" | grep -q 1 && echo "true" || echo "false") -# fi +# discharging=$(sysctl -n "hw.sensors.acpibat$batid.raw0" | grep -q 1 && echo "true" || echo "false") # if sysctl -n "hw.sensors.acpibat$batid" | grep -q amphour; then # charge=$(awk -v charge="$charge" -v remaining="$(sysctl -n hw.sensors.acpibat$batid.amphour3 | cut -d' ' -f1)" -v full="$(sysctl -n hw.sensors.acpibat$batid.amphour0 | cut -d' ' -f1)" 'BEGIN { print charge + remaining / full }') # else @@ -318,35 +337,43 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # done # ;; # esac -# [ "$count" -ne 0 ] && charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }') -# if [ "$charge" -eq 0 ]; then -# tmux set -ug '@battery_status' \;\ -# set -ug '@battery_bar' \;\ +# [ "$count" -ne 0 ] && charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }') || true +# } +# +# _battery_status() { +# _battery_info +# if [ "$charge" = 0 ]; then +# tmux set -ug '@battery_status' +# return +# fi +# +# battery_status_charging=$1 +# battery_status_discharging=$2 +# if [ x"$discharging" = x"true" ]; then +# battery_status="$battery_status_discharging" +# else +# battery_status="$battery_status_charging" +# fi +# +# tmux set -g '@battery_status' "$battery_status" +# } +# +# _battery_bar() { +# _battery_info +# if [ "$charge" = 0 ]; then +# tmux set -ug '@battery_bar' \;\ # set -ug '@battery_hbar' \;\ # set -ug '@battery_vbar' \;\ # set -ug '@battery_percentage' # return # fi # -# variables=$(tmux show -gqv '@battery_bar_symbol_full' \;\ -# show -gqv '@battery_bar_symbol_empty' \;\ -# show -gqv '@battery_bar_length' \;\ -# show -gqv '@battery_bar_palette' \;\ -# show -gqv '@battery_hbar_palette' \;\ -# show -gqv '@battery_vbar_palette' \;\ -# show -gqv '@battery_status_charging' \;\ -# show -gqv '@battery_status_discharging') -# # shellcheck disable=SC2086 -# { set -f; IFS="$__newline"; set -- $variables; unset IFS; set +f; } -# # battery_bar_symbol_full=$1 # battery_bar_symbol_empty=$2 # battery_bar_length=$3 # battery_bar_palette=$4 # battery_hbar_palette=$5 # battery_vbar_palette=$6 -# battery_status_charging=$7 -# battery_status_discharging=$8 # # if [ x"$battery_bar_length" = x"auto" ]; then # columns=$(tmux -q display -p '#{client_width}' 2> /dev/null || echo 80) @@ -357,12 +384,6 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # fi # fi # -# if [ x"$discharging" = x"true" ]; then -# battery_status="$battery_status_discharging" -# else -# battery_status="$battery_status_charging" -# fi -# # if echo "$battery_bar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then # # shellcheck disable=SC2086 # { set -f; IFS=,; set -- $battery_bar_palette; unset IFS; set +f; } @@ -472,58 +493,64 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # # _tty_info() { # tty="${1##/dev/}" -# uname -s | grep -q "CYGWIN" && cygwin=true -# -# if [ x"$cygwin" = x"true" ]; then -# ps -af | tail -n +2 | awk -v tty="$tty" ' -# ((/ssh/ && !/-W/) || !/ssh/) && $4 == tty { -# user[$2] = $1; parent[$2] = $3; child[$3] = $2 -# } -# END { -# for (i in parent) -# { -# j = i -# while (parent[j]) -# j = parent[j] -# -# if (!(i in child) && j != 1) +# case "$_uname_s" in +# *CYGWIN*) +# ps -al | tail -n +2 | awk -v tty="$tty" ' +# ((/ssh/ && !/-W/) || !/ssh/) && $5 == tty { +# user[$1] = $6; parent[$1] = $2; child[$2] = $1 +# } +# END { +# for (i in parent) # { -# file = "/proc/" i "/cmdline"; getline command < file; close(file) -# gsub(/\0/, " ", command) -# print i, user[i], command -# exit +# j = i +# while (parent[j]) +# j = parent[j] +# +# 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 +# } # } # } -# } -# ' -# else -# ps -t "$tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk ' -# NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) { -# user[$2] = $1; parent[$2] = $3; child[$3] = $2; for (i = 4 ; i <= NF; ++i) command[$2] = i > 4 ? command[$2] FS $i : $i -# } -# END { -# for (i in parent) -# { -# j = i -# while (parent[j]) -# j = parent[j] -# -# if (!(i in child) && j != 1) +# ' +# ;; +# *) +# ps -t "$tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk ' +# 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) # { -# print i, user[i], command[i] -# exit +# j = i +# while (parent[j]) +# j = parent[j] +# +# if (!(i in child) && j != 1) +# { +# print i":"user[i]":"command[i] +# exit +# } # } # } -# } -# ' -# fi +# ' +# ;; +# esac # } # # _ssh_or_mosh_args() { -# args=$(printf '%s' "$1" | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }') -# if [ -z "$args" ]; then -# args=$(printf '%s' "$1" | grep 'mosh-client' | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g') -# fi +# case "$1" in +# *ssh*) +# args=$(printf '%s' "$1" | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1 = ""; print $0; exit }') +# ;; +# *mosh-client*) +# args=$(printf '%s' "$1" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g') +# ;; +# esac # # printf '%s' "$args" # } @@ -533,21 +560,23 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # ssh_only=$2 # # tty_info=$(_tty_info "$tty") -# command=$(printf '%s' "$tty_info" | cut -d' ' -f3-) +# command=${tty_info#*:} +# command=${command#*:} # # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command") # 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 # -# printf '%s' "$username" +# printf '%s\n' "$username" # } # # _hostname() { @@ -555,44 +584,44 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # ssh_only=$2 # # tty_info=$(_tty_info "$tty") -# command=$(printf '%s' "$tty_info" | cut -d' ' -f3-) +# command=${tty_info#*:} +# command=${command#*:} # # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command") # 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 # -# printf '%s' "$hostname" +# printf '%s\n' "$hostname" # } # # _root() { # tty=${1:-$(tmux display -p '#{pane_tty}')} +# root=$2 +# # username=$(_username "$tty" false) # -# if [ x"$username" = x"root" ]; then -# tmux show -gqv '@root' -# else -# echo "" -# fi +# [ x"$username" = x"root" ] && echo "$root" # } # # _uptime() { -# case $(uname -s) in +# case "$_uname_s" in # *Darwin*) # boot=$(sysctl -q -n kern.boottime | awk -F'[ ,:]+' '{ print $4 }') # now=$(date +%s) @@ -626,11 +655,11 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # } # # _loadavg() { -# case $(uname -s) in +# case "$_uname_s" in # *Darwin*) # tmux set -g @loadavg "$(sysctl -q -n vm.loadavg | cut -d' ' -f2)" # ;; -# *Linux*) +# *Linux*|*CYGWIN*) # tmux set -g @loadavg "$(cut -d' ' -f1 < /proc/loadavg)" # ;; # *OpenBSD*) @@ -644,7 +673,8 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # shift # # tty_info=$(_tty_info "$tty") -# command=$(printf '%s' "$tty_info" | cut -d' ' -f3-) +# command=${tty_info#*:} +# command=${command#*:} # # case "$command" in # *mosh-client*) @@ -676,51 +706,47 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # _apply_bindings() { # cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT # -# tmux list-keys | grep -vF 'tmux.conf.local' | grep -E '(new-window|split(-|_)window|new-session|copy-selection|copy-pipe)' > "$cfg" +# tmux list-keys | grep -vF 'tmux.conf.local' | grep -E 'new-window|split(-|_)window|new-session|copy-selection|copy-pipe' > "$cfg" # # # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the # # output of list-keys can be truncated # perl -p -i -e "s/'#\{\?window_zoomed_flag,Unzoom,Zoom\}' 'z' \{resize-pane -$/'#{?window_zoomed_flag,Unzoom,Zoom}' 'z' {resize-pane -Z}\"/g" "$cfg" # +# 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\}\3)(.*?)\2/split-window\4/g +# ; +# s/\bsplit-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" \ +# "$cfg" +# # 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/\b(new-window)\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/" \ -# -e ';' \ -# -e "s/\bnew-window\b(?!([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2))/new-window -c '#{pane_current_path}'/g" \ +# perl -p -i -e " +# s/\bnew-window\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/ +# ; +# s/\bnew-window\b/new-window -c '#\{pane_current_path\}'/g" \ # "$cfg" -# else -# perl -p -i -e "s/\bnew-window\b([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2)/new-window\1/g" "$cfg" # fi # # tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true} -# if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then -# perl -p -i -e "s/\bsplit-window\b(?!([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2))/split-window -c '#{pane_current_path}'/g" "$cfg" -# else -# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" "$cfg" -# fi -# # tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false} # if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then -# if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then -# perl -p -i \ -# -e "s/\bsplit-window\b([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2)([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1\3 -c #\{pane_current_path\}'/g" \ -# -e ';' \ -# -e "s/\b_split_window\b\s+#\{pane_tty\}(.*?)\s+-c\s+\\\\\"#\{pane_current_path\}\\\\\"\"/_split_window #{pane_tty}\1 -c \\\\\"#{pane_current_path}\\\\\"\"/g" \ -# "$cfg" -# else -# perl -p -i \ -# -e "s/\bsplit-window\b([^;}\n]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1'/g" \ -# -e ';' \ -# -e "s/\b_split_window\b\s+#\{pane_tty\}(.*?)\s+-c\s+\\\\\"#\{pane_current_path\}\\\\\"\"/_split_window #{pane_tty}\1\"/g" \ -# "$cfg" -# fi -# else -# if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then -# perl -p -i -e "s/\brun-shell\b(\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\})(.*?)\s+-c\s+#\{pane_current_path\}\2/split-window\3 -c '#{pane_current_path}'/g" "$cfg" -# else -# perl -p -i -e "s/\brun-shell\b(\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\})(.*)\2/split-window\3/g" "$cfg" -# fi +# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{pane_tty\}\1'/g" "$cfg" +# fi +# +# 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/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\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window #\{pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\1'/g if /\bdisplay-menu\b/ +# ; +# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window #\{pane_tty\} -c \"#\{pane_current_path\}\"\1'/g" \ +# "$cfg" # fi # # tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false} @@ -771,23 +797,19 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # tmux_conf_theme_window_fg=${tmux_conf_theme_window_fg:-default} # tmux_conf_theme_window_bg=${tmux_conf_theme_window_bg:-default} # tmux_conf_theme_highlight_focused_pane=${tmux_conf_theme_highlight_focused_pane:-false} -# tmux_conf_theme_focused_pane_fg=${tmux_conf_theme_focused_pane_fg:-'default'} # default -# tmux_conf_theme_focused_pane_bg=${tmux_conf_theme_focused_pane_bg:-'#0087d7'} # light blue +# tmux_conf_theme_focused_pane_fg=${tmux_conf_theme_focused_pane_fg:-default} # default +# tmux_conf_theme_focused_pane_bg=${tmux_conf_theme_focused_pane_bg:-#0087d7} # light blue # -# # tmux 1.9 doesn't really like set -q -# if tmux show -g -w | grep -q window-style; then -# tmux setw -g window-style "fg=$tmux_conf_theme_window_fg,bg=$tmux_conf_theme_window_bg" -# -# if _is_enabled "$tmux_conf_theme_highlight_focused_pane"; then -# tmux setw -g window-active-style "fg=$tmux_conf_theme_focused_pane_fg,bg=$tmux_conf_theme_focused_pane_bg" -# else -# tmux setw -g window-active-style default -# fi +# window_style="fg=$tmux_conf_theme_window_fg,bg=$tmux_conf_theme_window_bg" +# if _is_enabled "$tmux_conf_theme_highlight_focused_pane"; then +# window_active_style="fg=$tmux_conf_theme_focused_pane_fg,bg=$tmux_conf_theme_focused_pane_bg" +# else +# window_active_style="default" # fi # # tmux_conf_theme_pane_border_style=${tmux_conf_theme_pane_border_style:-thin} -# tmux_conf_theme_pane_border=${tmux_conf_theme_pane_border:-'#444444'} # light gray -# tmux_conf_theme_pane_active_border=${tmux_conf_theme_pane_active_border:-'#00afff'} # light blue +# tmux_conf_theme_pane_border=${tmux_conf_theme_pane_border:-#444444} # light gray +# tmux_conf_theme_pane_active_border=${tmux_conf_theme_pane_active_border:-#00afff} # light blue # tmux_conf_theme_pane_border_fg=${tmux_conf_theme_pane_border_fg:-$tmux_conf_theme_pane_border} # tmux_conf_theme_pane_active_border_fg=${tmux_conf_theme_pane_active_border_fg:-$tmux_conf_theme_pane_active_border} # case "$tmux_conf_theme_pane_border_style" in @@ -796,16 +818,13 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-$tmux_conf_theme_pane_active_border_fg} # ;; # thin|*) -# tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-'default'} -# tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-'default'} +# tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-default} +# tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-default} # ;; # esac -# tmux setw -g pane-border-style "fg=$tmux_conf_theme_pane_border_fg,bg=$tmux_conf_theme_pane_border_bg" \; set -g pane-active-border-style "fg=$tmux_conf_theme_pane_active_border_fg,bg=$tmux_conf_theme_pane_active_border_bg" # -# tmux_conf_theme_pane_indicator=${tmux_conf_theme_pane_indicator:-'#00afff'} # light blue -# tmux_conf_theme_pane_active_indicator=${tmux_conf_theme_pane_active_indicator:-'#00afff'} # light blue -# -# tmux set -g display-panes-colour "$tmux_conf_theme_pane_indicator" \; set -g display-panes-active-colour "$tmux_conf_theme_pane_active_indicator" +# tmux_conf_theme_pane_indicator=${tmux_conf_theme_pane_indicator:-#00afff} # light blue +# tmux_conf_theme_pane_active_indicator=${tmux_conf_theme_pane_active_indicator:-#00afff} # light blue # # # -- status line ------------------------------------------------------- # @@ -814,48 +833,41 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # tmux_conf_theme_right_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_main-}") # tmux_conf_theme_right_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_sub-|}") # -# tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-'#000000'} # black -# tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-'#ffff00'} # yellow -# tmux_conf_theme_message_attr=${tmux_conf_theme_message_attr:-'bold'} -# tmux set -g message-style "fg=$tmux_conf_theme_message_fg,bg=$tmux_conf_theme_message_bg,$tmux_conf_theme_message_attr" +# tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-#000000} # black +# tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-#ffff00} # yellow +# tmux_conf_theme_message_attr=${tmux_conf_theme_message_attr:-bold} # -# tmux_conf_theme_message_command_fg=${tmux_conf_theme_message_command_fg:-'#ffff00'} # yellow -# tmux_conf_theme_message_command_bg=${tmux_conf_theme_message_command_bg:-'#000000'} # black -# tmux_conf_theme_message_command_attr=${tmux_conf_theme_message_command_attr:-'bold'} -# tmux set -g message-command-style "fg=$tmux_conf_theme_message_command_fg,bg=$tmux_conf_theme_message_command_bg,$tmux_conf_theme_message_command_attr" +# tmux_conf_theme_message_command_fg=${tmux_conf_theme_message_command_fg:-#ffff00} # yellow +# tmux_conf_theme_message_command_bg=${tmux_conf_theme_message_command_bg:-#000000} # black +# tmux_conf_theme_message_command_attr=${tmux_conf_theme_message_command_attr:-bold} # -# tmux_conf_theme_mode_fg=${tmux_conf_theme_mode_fg:-'#000000'} # black -# tmux_conf_theme_mode_bg=${tmux_conf_theme_mode_bg:-'#ffff00'} # yellow -# tmux_conf_theme_mode_attr=${tmux_conf_theme_mode_attr:-'bold'} -# tmux setw -g mode-style "fg=$tmux_conf_theme_mode_fg,bg=$tmux_conf_theme_mode_bg,$tmux_conf_theme_mode_attr" +# tmux_conf_theme_mode_fg=${tmux_conf_theme_mode_fg:-#000000} # black +# tmux_conf_theme_mode_bg=${tmux_conf_theme_mode_bg:-#ffff00} # yellow +# tmux_conf_theme_mode_attr=${tmux_conf_theme_mode_attr:-bold} # -# tmux_conf_theme_status_fg=${tmux_conf_theme_status_fg:-'#8a8a8a'} # white -# tmux_conf_theme_status_bg=${tmux_conf_theme_status_bg:-'#080808'} # dark gray -# tmux_conf_theme_status_attr=${tmux_conf_theme_status_attr:-'none'} -# tmux set -g status-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ -# set -g status-left-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ -# set -g status-right-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" +# tmux_conf_theme_status_fg=${tmux_conf_theme_status_fg:-#8a8a8a} # white +# tmux_conf_theme_status_bg=${tmux_conf_theme_status_bg:-#080808} # dark gray +# tmux_conf_theme_status_attr=${tmux_conf_theme_status_attr:-none} # -# tmux_conf_theme_terminal_title=${tmux_conf_theme_terminal_title:-'#h ❐ #S ● #I #W'} +# tmux_conf_theme_terminal_title=${tmux_conf_theme_terminal_title:-#h ❐ #S ● #I #W} # # 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 #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') -# tmux set -g set-titles-string "$(_decode_unicode_escapes "$tmux_conf_theme_terminal_title")" +# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g') # -# tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-'#8a8a8a'} # white -# tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-'#080808'} # dark gray -# tmux_conf_theme_window_status_attr=${tmux_conf_theme_window_status_attr:-'none'} -# tmux_conf_theme_window_status_format=${tmux_conf_theme_window_status_format:-'#I #W'} +# tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-#8a8a8a} # white +# tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-#080808} # dark gray +# tmux_conf_theme_window_status_attr=${tmux_conf_theme_window_status_attr:-none} +# tmux_conf_theme_window_status_format=${tmux_conf_theme_window_status_format:-#I #W} # -# tmux_conf_theme_window_status_current_fg=${tmux_conf_theme_window_status_current_fg:-'#000000'} # black -# tmux_conf_theme_window_status_current_bg=${tmux_conf_theme_window_status_current_bg:-'#00afff'} # light blue -# tmux_conf_theme_window_status_current_attr=${tmux_conf_theme_window_status_current_attr:-'bold'} -# tmux_conf_theme_window_status_current_format=${tmux_conf_theme_window_status_current_format:-'#I #W'} +# tmux_conf_theme_window_status_current_fg=${tmux_conf_theme_window_status_current_fg:-#000000} # black +# tmux_conf_theme_window_status_current_bg=${tmux_conf_theme_window_status_current_bg:-#00afff} # light blue +# tmux_conf_theme_window_status_current_attr=${tmux_conf_theme_window_status_current_attr:-bold} +# tmux_conf_theme_window_status_current_format=${tmux_conf_theme_window_status_current_format:-#I #W} # if [ x"$(tmux show -g -v status-justify)" = x"right" ]; then # tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_window_status_bg]$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] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_right_separator_main" # else @@ -866,86 +878,66 @@ 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")" \;\ -# setw -g window-status-current-style "fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr" \;\ -# setw -g window-status-current-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_current_format")" +# tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-default} +# tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-default} +# tmux_conf_theme_window_status_activity_attr=${tmux_conf_theme_window_status_activity_attr:-underscore} # -# tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-'default'} -# tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-'default'} -# tmux_conf_theme_window_status_activity_attr=${tmux_conf_theme_window_status_activity_attr:-'underscore'} -# tmux setw -g window-status-activity-style "fg=$tmux_conf_theme_window_status_activity_fg,bg=$tmux_conf_theme_window_status_activity_bg,$tmux_conf_theme_window_status_activity_attr" +# tmux_conf_theme_window_status_bell_fg=${tmux_conf_theme_window_status_bell_fg:-#ffff00} # yellow +# tmux_conf_theme_window_status_bell_bg=${tmux_conf_theme_window_status_bell_bg:-default} +# tmux_conf_theme_window_status_bell_attr=${tmux_conf_theme_window_status_bell_attr:-blink,bold} # -# tmux_conf_theme_window_status_bell_fg=${tmux_conf_theme_window_status_bell_fg:-'#ffff00'} # yellow -# tmux_conf_theme_window_status_bell_bg=${tmux_conf_theme_window_status_bell_bg:-'default'} -# tmux_conf_theme_window_status_bell_attr=${tmux_conf_theme_window_status_bell_attr:-'blink,bold'} -# tmux setw -g window-status-bell-style "fg=$tmux_conf_theme_window_status_bell_fg,bg=$tmux_conf_theme_window_status_bell_bg,$tmux_conf_theme_window_status_bell_attr" -# -# tmux_conf_theme_window_status_last_fg=${tmux_conf_theme_window_status_last_fg:-'#00afff'} # light blue -# 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'} -# tmux setw -g window-status-last-style "fg=$tmux_conf_theme_window_status_last_fg,bg=$tmux_conf_theme_window_status_last_bg,$tmux_conf_theme_window_status_last_attr" +# tmux_conf_theme_window_status_last_fg=${tmux_conf_theme_window_status_last_fg:-#00afff} # light blue +# 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} # # # -- indicators # -# tmux_conf_theme_pairing=${tmux_conf_theme_pairing:-'👓'} # U+1F453 -# tmux_conf_theme_pairing_fg=${tmux_conf_theme_pairing_fg:-'#e4e4e4'} # white -# tmux_conf_theme_pairing_bg=${tmux_conf_theme_pairing_bg:-'none'} -# tmux_conf_theme_pairing_attr=${tmux_conf_theme_pairing_attr:-'none'} +# tmux_conf_theme_pairing=${tmux_conf_theme_pairing:-👓 } # U+1F453 +# tmux_conf_theme_pairing_fg=${tmux_conf_theme_pairing_fg:-#e4e4e4} # white +# tmux_conf_theme_pairing_bg=${tmux_conf_theme_pairing_bg:-none} +# tmux_conf_theme_pairing_attr=${tmux_conf_theme_pairing_attr:-none} # -# tmux_conf_theme_prefix=${tmux_conf_theme_prefix:-'⌨'} # U+2328 -# tmux_conf_theme_prefix_fg=${tmux_conf_theme_prefix_fg:-'#e4e4e4'} # white -# 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_prefix=${tmux_conf_theme_prefix:-⌨ } # U+2328 +# tmux_conf_theme_prefix_fg=${tmux_conf_theme_prefix_fg:-#e4e4e4} # white +# 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_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'} -# tmux_conf_theme_root_attr=${tmux_conf_theme_root_attr:-'bold,blink'} +# 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} +# tmux_conf_theme_root_attr=${tmux_conf_theme_root_attr:-bold,blink} # -# tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-'🔒'} # U+1F512 -# tmux_conf_theme_synchronized_fg=${tmux_conf_theme_synchronized_fg:-'none'} -# tmux_conf_theme_synchronized_bg=${tmux_conf_theme_synchronized_bg:-'none'} -# tmux_conf_theme_synchronized_attr=${tmux_conf_theme_synchronized_attr:-'none'} +# tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-🔒} # U+1F512 +# tmux_conf_theme_synchronized_fg=${tmux_conf_theme_synchronized_fg:-none} +# tmux_conf_theme_synchronized_bg=${tmux_conf_theme_synchronized_bg:-none} +# tmux_conf_theme_synchronized_attr=${tmux_conf_theme_synchronized_attr:-none} # # # -- status left style # -# tmux_conf_theme_status_left=${tmux_conf_theme_status_left-' ❐ #S '} -# tmux_conf_theme_status_left_fg=${tmux_conf_theme_status_left_fg:-'#000000,#e4e4e4,#e4e4e4'} # black, white , white -# tmux_conf_theme_status_left_bg=${tmux_conf_theme_status_left_bg:-'#ffff00,#ff00af,#00afff'} # yellow, pink, white blue -# tmux_conf_theme_status_left_attr=${tmux_conf_theme_status_left_attr:-'bold,none,none'} -# -# tmux_conf_theme_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") -# -# tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \ -# -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,}/g") -# -# tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_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} #D)#[inherit]%g") -# -# tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \ -# -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") +# tmux_conf_theme_status_left=${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_left_fg=${tmux_conf_theme_status_left_fg:-#000000,#e4e4e4,#e4e4e4} # black, white , white +# tmux_conf_theme_status_left_bg=${tmux_conf_theme_status_left_bg:-#ffff00,#ff00af,#00afff} # yellow, pink, white blue +# tmux_conf_theme_status_left_attr=${tmux_conf_theme_status_left_attr:-bold,none,none} # # if [ -n "$tmux_conf_theme_status_left" ]; then -# status_left=$(awk \ +# status_left=$(printf '%s' "$tmux_conf_theme_status_left" | awk \ # -v fg_="$tmux_conf_theme_status_left_fg" \ # -v bg_="$tmux_conf_theme_status_left_bg" \ # -v attr_="$tmux_conf_theme_status_left_attr" \ # -v mainsep="$tmux_conf_theme_left_separator_main" \ # -v subsep="$tmux_conf_theme_left_separator_sub" ' -# function subsplit(s, l, i, a, r) +# function subsplit(s, l, i, a, r) # { # l = split(s, a, ",") # for (i = 1; i <= l; ++i) @@ -998,10 +990,21 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # } # } # printf "#[fg=%s,bg=%s,none]%s", bg[j_], "default", mainsep -# }' << EOF -# $tmux_conf_theme_status_left -# EOF -# ) +# }') +# fi +# +# status_left=$(echo "$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,}/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') +# +# 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") +# 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") # fi # # status_left="$status_left " @@ -1009,30 +1012,19 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # # -- status right style # # tmux_conf_theme_status_right=${tmux_conf_theme_status_right-'#{pairing}#{prefix} #{battery_status} #{battery_bar} #{battery_percentage} , %R , %d %b | #{username} | #{hostname} '} -# tmux_conf_theme_status_right_fg=${tmux_conf_theme_status_right_fg:-'#8a8a8a,#e4e4e4,#000000'} # light gray, white, black -# tmux_conf_theme_status_right_bg=${tmux_conf_theme_status_right_bg:-'#080808,#d70000,#e4e4e4'} # dark gray, red, white -# tmux_conf_theme_status_right_attr=${tmux_conf_theme_status_right_attr:-'none,none,bold'} -# -# tmux_conf_theme_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") -# -# tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \ -# -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,}/g") -# -# tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_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} #D)#[inherit]%g") -# -# tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \ -# -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") +# 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_fg=${tmux_conf_theme_status_right_fg:-#8a8a8a,#e4e4e4,#000000} # light gray, white, black +# tmux_conf_theme_status_right_bg=${tmux_conf_theme_status_right_bg:-#080808,#d70000,#e4e4e4} # dark gray, red, white +# tmux_conf_theme_status_right_attr=${tmux_conf_theme_status_right_attr:-none,none,bold} # # if [ -n "$tmux_conf_theme_status_right" ]; then -# status_right=$(awk \ +# status_right=$(printf '%s' "$tmux_conf_theme_status_right" | awk \ # -v fg_="$tmux_conf_theme_status_right_fg" \ # -v bg_="$tmux_conf_theme_status_right_bg" \ # -v attr_="$tmux_conf_theme_status_right_attr" \ # -v mainsep="$tmux_conf_theme_right_separator_main" \ # -v subsep="$tmux_conf_theme_right_separator_sub" ' -# function subsplit(s, l, i, a, r) +# function subsplit(s, l, i, a, r) # { # l = split(s, a, ",") # for (i = 1; i <= l; ++i) @@ -1079,67 +1071,74 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # j = j % l + 1 # } # } -# }' << EOF -# $tmux_conf_theme_status_right -# EOF -# ) +# }') +# fi +# +# status_right=$(echo "$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,}/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') +# +# 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") +# 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") # fi # # # -- variables # -# tmux set -g '@root' "$tmux_conf_theme_root" +# tmux_conf_battery_bar_symbol_full=$(_decode_unicode_escapes "${tmux_conf_battery_bar_symbol_full:-◼}") +# tmux_conf_battery_bar_symbol_empty=$(_decode_unicode_escapes "${tmux_conf_battery_bar_symbol_empty:-◻}") +# tmux_conf_battery_bar_length=${tmux_conf_battery_bar_length:-auto} +# tmux_conf_battery_bar_palette=${tmux_conf_battery_bar_palette:-gradient} +# tmux_conf_battery_hbar_palette=${tmux_conf_battery_hbar_palette:-gradient} # red, orange, green +# tmux_conf_battery_vbar_palette=${tmux_conf_battery_vbar_palette:-gradient} # red, orange, green +# tmux_conf_battery_status_charging=$(_decode_unicode_escapes "${tmux_conf_battery_status_charging:-↑}") # U+2191 +# tmux_conf_battery_status_discharging=$(_decode_unicode_escapes "${tmux_conf_battery_status_discharging:-↓}") # U+2193 # -# tmux_conf_battery_bar_symbol_full=${tmux_conf_battery_bar_symbol_full:-'◼'} -# tmux_conf_battery_bar_symbol_empty=${tmux_conf_battery_bar_symbol_empty:-'◻'} -# tmux_conf_battery_bar_length=${tmux_conf_battery_bar_length:-'auto'} -# tmux_conf_battery_bar_palette=${tmux_conf_battery_bar_palette:-'gradient'} -# tmux_conf_battery_hbar_palette=${tmux_conf_battery_hbar_palette:-'gradient'} # red, orange, green -# tmux_conf_battery_vbar_palette=${tmux_conf_battery_vbar_palette:-'gradient'} # red, orange, green -# tmux_conf_battery_status_charging=${tmux_conf_battery_status_charging:-'↑'} # U+2191 -# tmux_conf_battery_status_discharging=${tmux_conf_battery_status_discharging:-'↓'} # U+2193 -# -# case "$status_left $status_right" in -# *'#{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' \ -# -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=$(echo "$status_right" | sed -E \ -# -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \ -# -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \ -# -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \ -# -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \ -# -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g') -# -# tmux set -g '@battery_bar_symbol_full' "$(_decode_unicode_escapes "$tmux_conf_battery_bar_symbol_full")" \;\ -# set -g '@battery_bar_symbol_empty' "$(_decode_unicode_escapes "$tmux_conf_battery_bar_symbol_empty")" \;\ -# set -g '@battery_bar_length' "$tmux_conf_battery_bar_length" \;\ -# set -g '@battery_bar_palette' "$tmux_conf_battery_bar_palette" \;\ -# set -g '@battery_hbar_palette' "$tmux_conf_battery_hbar_palette" \;\ -# set -g '@battery_vbar_palette' "$tmux_conf_battery_vbar_palette" \;\ -# set -g '@battery_status_charging' "$(_decode_unicode_escapes "$tmux_conf_battery_status_charging")" \;\ -# set -g '@battery_status_discharging' "$(_decode_unicode_escapes "$tmux_conf_battery_status_discharging")" -# status_right="#(cut -c3- ~/.tmux.conf | sh -s _battery)$status_right" -# ;; -# esac +# _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _battery_bar' +# _battery_info +# if [ "$charge" != 0 ]; then +# case "$status_left $status_right" in +# *'#{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' \ +# -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=$(echo "$status_right" | sed -E \ +# -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \ +# -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \ +# -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \ +# -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \ +# -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g') +# interval=60 +# 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" +# 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" +# ;; +# esac +# fi # # case "$status_left $status_right" in # *'#{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 # +# _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _uptime' # case "$status_left $status_right" in # *'#{uptime_d}'*|*'#{uptime_h}'*|*'#{uptime_m}'*|*'#{uptime_s}'*) # status_left=$(echo "$status_left" | sed -E \ @@ -1156,32 +1155,54 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \ # -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \ # -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g') -# status_right="#(cut -c3- ~/.tmux.conf | sh -s _uptime)$status_right" +# interval=60 +# case "$status_left $status_right" in +# *'#{@uptime_s}'*) +# interval=$(tmux show -gv status-interval) +# ;; +# esac +# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done" # ;; # esac # +# _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _loadavg' # case "$status_left $status_right" in # *'#{loadavg}'*) # status_left=$(echo "$status_left" | sed -E \ # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') # status_right=$(echo "$status_right" | sed -E \ # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') -# status_right="#(cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right" +# interval=$(tmux show -gv status-interval) +# tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done" # ;; # esac # -# status_left=$(echo "$status_left" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g') -# status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g') -# -# tmux set -g status-left-length 1000 \; set -g status-left "$(_decode_unicode_escapes "$status_left")" \;\ -# set -g status-right-length 1000 \; set -g status-right "$(_decode_unicode_escapes "$status_right")" -# # # -- clock ------------------------------------------------------------- # -# tmux_conf_theme_clock_colour=${tmux_conf_theme_clock_colour:-'#00afff'} # light blue -# tmux_conf_theme_clock_style=${tmux_conf_theme_clock_style:-'24'} -# tmux setw -g clock-mode-colour "$tmux_conf_theme_clock_colour" \;\ -# setw -g clock-mode-style "$tmux_conf_theme_clock_style" +# tmux_conf_theme_clock_colour=${tmux_conf_theme_clock_colour:-#00afff} # light blue +# tmux_conf_theme_clock_style=${tmux_conf_theme_clock_style:-24} +# +# tmux setw -g window-style "$window_style" \; setw -g window-active-style "$window_active_style" \;\ +# setw -g pane-border-style "fg=$tmux_conf_theme_pane_border_fg,bg=$tmux_conf_theme_pane_border_bg" \; set -g pane-active-border-style "fg=$tmux_conf_theme_pane_active_border_fg,bg=$tmux_conf_theme_pane_active_border_bg" \;\ +# set -g display-panes-colour "$tmux_conf_theme_pane_indicator" \; set -g display-panes-active-colour "$tmux_conf_theme_pane_active_indicator" \;\ +# set -g message-style "fg=$tmux_conf_theme_message_fg,bg=$tmux_conf_theme_message_bg,$tmux_conf_theme_message_attr" \;\ +# set -g message-command-style "fg=$tmux_conf_theme_message_command_fg,bg=$tmux_conf_theme_message_command_bg,$tmux_conf_theme_message_command_attr" \;\ +# setw -g mode-style "fg=$tmux_conf_theme_mode_fg,bg=$tmux_conf_theme_mode_bg,$tmux_conf_theme_mode_attr" \;\ +# set -g status-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ +# set -g status-left-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ +# set -g status-right-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ +# set -g set-titles-string "$(_decode_unicode_escapes "$tmux_conf_theme_terminal_title")" \;\ +# 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")" \;\ +# setw -g window-status-current-style "fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr" \;\ +# setw -g window-status-current-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_current_format")" \;\ +# setw -g window-status-activity-style "fg=$tmux_conf_theme_window_status_activity_fg,bg=$tmux_conf_theme_window_status_activity_bg,$tmux_conf_theme_window_status_activity_attr" \;\ +# setw -g window-status-bell-style "fg=$tmux_conf_theme_window_status_bell_fg,bg=$tmux_conf_theme_window_status_bell_bg,$tmux_conf_theme_window_status_bell_attr" \;\ +# setw -g window-status-last-style "fg=$tmux_conf_theme_window_status_last_fg,bg=$tmux_conf_theme_window_status_last_bg,$tmux_conf_theme_window_status_last_attr" \;\ +# set -g status-left-length 1000 \; set -g status-left "$(_decode_unicode_escapes "$status_left")" \;\ +# set -g status-right-length 1000 \; set -g status-right "$(_decode_unicode_escapes "$status_right")" \;\ +# setw -g clock-mode-colour "$tmux_conf_theme_clock_colour" \;\ +# setw -g clock-mode-style "$tmux_conf_theme_clock_style" # } # # _apply_configuration() { @@ -1212,10 +1233,19 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # esac # fi # +# case "$_uname_s" in +# *CYGWIN*|*MSYS*) +# # prevent Cygwin and MSYS2 from cd-ing into home directory when evaluating /etc/profile +# tmux setenv -g CHERE_INVOKING 1 +# ;; +# esac +# # _apply_overrides -# _apply_bindings -# _apply_theme -# for name in $(printenv | grep -E -o '^tmux_conf_[^=]+'); do tmux setenv -gu "$name"; done; +# _apply_theme& +# _apply_bindings& +# # shellcheck disable=SC2046 +# tmux setenv -gu tmux_conf_dummy $(printenv | grep -E -o '^tmux_conf_[^=]+' | awk '{printf "; setenv -gu %s", $0}') +# wait # } # # _urlview() { diff --git a/.tmux.conf.local b/.tmux.conf.local index 53b94c7..069d81b 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -251,9 +251,8 @@ tmux_conf_battery_vbar_palette='gradient' # symbols used to indicate whether battery is charging or discharging tmux_conf_battery_status_charging='↑' # U+2191 tmux_conf_battery_status_discharging='↓' # U+2193 -#tmux_conf_battery_status_charging='⚡ ' # U+26A1 -#tmux_conf_battery_status_charging='🔌 ' # U+1F50C -#tmux_conf_battery_status_discharging='🔋 ' # U+1F50B +#tmux_conf_battery_status_charging='🔌' # U+1F50C +#tmux_conf_battery_status_discharging='🔋' # U+1F50B # clock style (when you hit + t) # you may want to use %I:%M %p in place of %R in tmux_conf_theme_status_right