Guest User

Untitled

a guest
Sep 26th, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 58.05 KB | None | 0 0
  1. # : << EOF
  2. # https://github.com/gpakosz/.tmux
  3. # (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
  4. # without any warranty.
  5. # Copyright 2012— Gregory Pakosz (@gpakosz).
  6. # /!\ do not edit this file
  7. # instead, override settings in ~/.tmux.conf.local, see README.md
  8.  
  9.  
  10. # -- general -------------------------------------------------------------------
  11.  
  12. set -g default-terminal "screen-256color" # colors!
  13. setw -g xterm-keys on
  14. set -s escape-time 10 # faster command sequences
  15. set -sg repeat-time 600 # increase repeat timeout
  16. set -s focus-events on
  17.  
  18. set -g prefix2 C-a # GNU-Screen compatible prefix
  19. bind C-a send-prefix -2
  20.  
  21. set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
  22. setw -q -g utf8 on
  23.  
  24. set -g history-limit 5000 # boost history
  25.  
  26. # edit configuration
  27. bind e new-window -n "~/.tmux.conf.local" "sh -c '\${EDITOR:-vim} ~/.tmux.conf.local && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'"
  28.  
  29. # reload configuration
  30. bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
  31.  
  32.  
  33. # -- display -------------------------------------------------------------------
  34.  
  35. set -g base-index 1 # start windows numbering at 1
  36. setw -g pane-base-index 1 # make pane numbering consistent with windows
  37.  
  38. setw -g automatic-rename on # rename window to reflect current program
  39. set -g renumber-windows on # renumber windows when a window is closed
  40.  
  41. set -g set-titles on # set terminal title
  42.  
  43. set -g display-panes-time 800 # slightly longer pane indicators display time
  44. set -g display-time 1000 # slightly longer status messages display time
  45.  
  46. set -g status-interval 10 # redraw status line every 10 seconds
  47.  
  48. # clear both screen and history
  49. bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history
  50.  
  51. # activity
  52. set -g monitor-activity on
  53. set -g visual-activity off
  54.  
  55.  
  56. # -- navigation ----------------------------------------------------------------
  57.  
  58. # create session
  59. bind C-c new-session
  60.  
  61. # find session
  62. bind C-f command-prompt -p find-session 'switch-client -t %%'
  63.  
  64. # split current window horizontally
  65. bind - split-window -v
  66. # split current window vertically
  67. bind _ split-window -h
  68.  
  69. # pane navigation
  70. bind -r h select-pane -L # move left
  71. bind -r j select-pane -D # move down
  72. bind -r k select-pane -U # move up
  73. bind -r l select-pane -R # move right
  74. bind > swap-pane -D # swap current pane with the next one
  75. bind < swap-pane -U # swap current pane with the previous one
  76.  
  77. # maximize current pane
  78. bind + run 'cut -c3- ~/.tmux.conf | sh -s _maximize_pane "#{session_name}" #D'
  79.  
  80. # pane resizing
  81. bind -r H resize-pane -L 2
  82. bind -r J resize-pane -D 2
  83. bind -r K resize-pane -U 2
  84. bind -r L resize-pane -R 2
  85.  
  86. # window navigation
  87. unbind n
  88. unbind p
  89. bind -r C-h previous-window # select previous window
  90. bind -r C-l next-window # select next window
  91. bind Tab last-window # move to last active window
  92.  
  93. # toggle mouse
  94. bind m run "cut -c3- ~/.tmux.conf | sh -s _toggle_mouse"
  95.  
  96.  
  97. # -- urlview -------------------------------------------------------------------
  98.  
  99. bind U run "cut -c3- ~/.tmux.conf | sh -s _urlview #{pane_id}"
  100.  
  101.  
  102. # -- facebook pathpicker -------------------------------------------------------
  103.  
  104. bind F run "cut -c3- ~/.tmux.conf | sh -s _fpp #{pane_id}"
  105.  
  106.  
  107. # -- list choice (tmux < 2.4) --------------------------------------------------
  108.  
  109. # vi-choice is gone in tmux >= 2.4
  110. run -b 'tmux bind -t vi-choice h tree-collapse 2> /dev/null || true'
  111. run -b 'tmux bind -t vi-choice l tree-expand 2> /dev/null || true'
  112. run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null || true'
  113. run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null || true'
  114. run -b 'tmux bind -t vi-choice H tree-collapse-all 2> /dev/null || true'
  115. run -b 'tmux bind -t vi-choice L tree-expand-all 2> /dev/null || true'
  116. run -b 'tmux bind -t vi-choice Escape cancel 2> /dev/null || true'
  117.  
  118.  
  119. # -- edit mode (tmux < 2.4) ----------------------------------------------------
  120.  
  121. # vi-edit is gone in tmux >= 2.4
  122. run -b 'tmux bind -ct vi-edit H start-of-line 2> /dev/null || true'
  123. run -b 'tmux bind -ct vi-edit L end-of-line 2> /dev/null || true'
  124. run -b 'tmux bind -ct vi-edit q cancel 2> /dev/null || true'
  125. run -b 'tmux bind -ct vi-edit Escape cancel 2> /dev/null || true'
  126.  
  127.  
  128. # -- copy mode -----------------------------------------------------------------
  129.  
  130. bind Enter copy-mode # enter copy mode
  131.  
  132. run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true'
  133. run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
  134. run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
  135. run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
  136. run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true'
  137. run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
  138. run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
  139. run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
  140. run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
  141. run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
  142. run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
  143. run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'
  144.  
  145. # copy to macOS clipboard
  146. if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"'
  147. if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
  148. # copy to X11 clipboard
  149. if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"'
  150. 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"'
  151. # copy to Windows clipboard
  152. if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"'
  153. if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"'
  154.  
  155.  
  156. # -- buffers -------------------------------------------------------------------
  157.  
  158. bind b list-buffers # list paste buffers
  159. bind p paste-buffer # paste from the top paste buffer
  160. bind P choose-buffer # choose which buffer to paste from
  161.  
  162.  
  163. # -- user defined overrides ----------------------------------------------------
  164.  
  165. if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'
  166.  
  167.  
  168. # -- 8< ------------------------------------------------------------------------
  169.  
  170. run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
  171. 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'
  172.  
  173.  
  174. # EOF
  175. #
  176. # # exit the script if any statement returns a non-true return value
  177. # set -e
  178. #
  179. # unset GREP_OPTIONS
  180. # export LC_NUMERIC=C
  181. #
  182. # if ! printf '' | sed -E 's///' 2>/dev/null; then
  183. # if printf '' | sed -r 's///' 2>/dev/null; then
  184. # sed () {
  185. # n=$#; while [ "$n" -gt 0 ]; do arg=$1; shift; case $arg in -E*) arg=-r${arg#-E};; esac; set -- "$@" "$arg"; n=$(( n - 1 )); done
  186. # command sed "$@"
  187. # }
  188. # fi
  189. # fi
  190. #
  191. # _uname_s=$(uname -s)
  192. #
  193. # _is_enabled() {
  194. # [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"enabled" ] || [ x"$1" = x"1" ]
  195. # }
  196. #
  197. # _circled() {
  198. # circled_digits='⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳'
  199. # if [ "$1" -le 20 ] 2>/dev/null; then
  200. # i=$(( $1 + 1 ))
  201. # eval set -- "$circled_digits"
  202. # eval echo "\${$i}"
  203. # else
  204. # echo "$1"
  205. # fi
  206. # }
  207. #
  208. # _decode_unicode_escapes() {
  209. # 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
  210. # }
  211. #
  212. # if command -v pkill > /dev/null 2>&1; then
  213. # _pkillf() {
  214. # pkill -f "$@" || true
  215. # }
  216. # else
  217. # case "$_uname_s" in
  218. # *CYGWIN*)
  219. # _pkillf() {
  220. # while IFS= read -r pid; do
  221. # kill "$pid" || true
  222. # done << EOF
  223. # $(grep -Eao "$@" /proc/*/cmdline | xargs -0 | sed -E -n 's,/proc/([0-9]+)/.+$,\1,pg')
  224. # EOF
  225. # }
  226. # ;;
  227. # *)
  228. # _pkillf() {
  229. # while IFS= read -r pid; do
  230. # kill "$pid" || true
  231. # done << EOF
  232. # $(ps -x -o pid= -o command= | grep -E "$@" | cut -d' ' -f1)
  233. # EOF
  234. # }
  235. # ;;
  236. # esac
  237. # fi
  238. #
  239. # _maximize_pane() {
  240. # current_session=${1:-$(tmux display -p '#{session_name}')}
  241. # current_pane=${2:-$(tmux display -p '#{pane_id}')}
  242. #
  243. # dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -E -o '^1 %.+maximized.+$' || true)
  244. # restore=$(echo "$dead_panes" | sed -n -E -e "s/^1 $current_pane .+maximized.+'(%[0-9]+)'$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t $current_pane/p" -e "s/^1 (%[0-9]+) .+maximized.+'$current_pane'$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t \1/p" )
  245. #
  246. # if [ -z "$restore" ]; then
  247. # [ "$(tmux list-panes -t "$current_session:" | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return
  248. # window=$(tmux new-window -t "$current_session:" -P "exec maximized... 2> /dev/null & tmux setw -t \"$current_session:\" remain-on-exit on; printf \"Pane has been maximized, press <prefix>+ to restore. %s\" '$current_pane'")
  249. # window=${window%.*}
  250. #
  251. # retry=1000
  252. # while [ x"$(tmux list-panes -t "$window" -F '#{session_name}:#{window_index} #{pane_dead}' 2>/dev/null)" != x"$window 1" ] && [ "$retry" -ne 0 ]; do
  253. # sleep 0.1
  254. # retry=$((retry - 1))
  255. # done
  256. # if [ "$retry" -eq 0 ]; then
  257. # tmux display 'Unable to maximize pane'
  258. # fi
  259. #
  260. # new_pane=$(tmux display -t "$window" -p '#{pane_id}')
  261. # tmux setw -t "$window" remain-on-exit off \; swap-pane -s "$current_pane" -t "$new_pane"
  262. # else
  263. # $restore || tmux kill-pane
  264. # fi
  265. # }
  266. #
  267. # _toggle_mouse() {
  268. # old=$(tmux show -gv mouse)
  269. # new=""
  270. #
  271. # if [ "$old" = "on" ]; then
  272. # new="off"
  273. # else
  274. # new="on"
  275. # fi
  276. #
  277. # tmux set -g mouse $new \;\
  278. # display "mouse: $new"
  279. # }
  280. #
  281. # _battery_info() {
  282. # count=0
  283. # charge=0
  284. # case "$_uname_s" in
  285. # *Darwin*)
  286. # while IFS= read -r line; do
  287. # [ -z "$line" ] && continue
  288. # discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false")
  289. # percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%')
  290. # charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }')
  291. # count=$((count + 1))
  292. # done << EOF
  293. # $(pmset -g batt | grep 'InternalBattery')
  294. # EOF
  295. # ;;
  296. # *Linux*)
  297. # while IFS= read -r batpath; do
  298. # [ -z "$batpath" ] && continue
  299. # grep -i -q device "$batpath/scope" 2> /dev/null && continue
  300. #
  301. # discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false")
  302. # bat_capacity="$batpath/capacity"
  303. # if [ -r "$bat_capacity" ]; then
  304. # charge=$(awk -v charge="$charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + capacity / 100 }')
  305. # else
  306. # bat_energy_full="$batpath/energy_full"
  307. # bat_energy_now="$batpath/energy_now"
  308. # if [ -r "$bat_energy_full" ] && [ -r "$bat_energy_now" ]; then
  309. # charge=$(awk -v charge="$charge" -v energy_now="$(cat "$bat_energy_now")" -v energy_full="$(cat "$bat_energy_full")" 'BEGIN { print charge + energy_now / energy_full }')
  310. # fi
  311. # fi
  312. # count=$((count + 1))
  313. # done << EOF
  314. # $(find /sys/class/power_supply -maxdepth 1 -iname '*bat*')
  315. # EOF
  316. # ;;
  317. # *CYGWIN*|*MSYS*|*MINGW*)
  318. # while IFS= read -r line; do
  319. # [ -z "$line" ] && continue
  320. # discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }')
  321. # charge=$(printf '%s' "$line" | awk -v charge="$charge" '{ print charge + $2 / 100 }')
  322. # count=$((count + 1))
  323. # done << EOF
  324. # $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining 2> /dev/null | tr -d '\r' | tail -n +2 || true)
  325. # EOF
  326. # ;;
  327. # *OpenBSD*)
  328. # for batid in 0 1 2; do
  329. # sysctl -n "hw.sensors.acpibat$batid.raw0" 2>&1 | grep -q 'not found' && continue
  330. # discharging=$(sysctl -n "hw.sensors.acpibat$batid.raw0" | grep -q 1 && echo "true" || echo "false")
  331. # if sysctl -n "hw.sensors.acpibat$batid" | grep -q amphour; then
  332. # 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 }')
  333. # else
  334. # charge=$(awk -v charge="$charge" -v remaining="$(sysctl -n hw.sensors.acpibat$batid.watthour3 | cut -d' ' -f1)" -v full="$(sysctl -n hw.sensors.acpibat$batid.watthour0 | cut -d' ' -f1)" 'BEGIN { print charge + remaining / full }')
  335. # fi
  336. # count=$((count + 1))
  337. # done
  338. # ;;
  339. # esac
  340. # [ "$count" -ne 0 ] && charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }') || true
  341. # }
  342. #
  343. # _battery_status() {
  344. # _battery_info
  345. # if [ "$charge" = 0 ]; then
  346. # tmux set -ug '@battery_status'
  347. # return
  348. # fi
  349. #
  350. # battery_status_charging=$1
  351. # battery_status_discharging=$2
  352. # if [ x"$discharging" = x"true" ]; then
  353. # battery_status="$battery_status_discharging"
  354. # else
  355. # battery_status="$battery_status_charging"
  356. # fi
  357. #
  358. # tmux set -g '@battery_status' "$battery_status"
  359. # }
  360. #
  361. # _battery_bar() {
  362. # _battery_info
  363. # if [ "$charge" = 0 ]; then
  364. # tmux set -ug '@battery_bar' \;\
  365. # set -ug '@battery_hbar' \;\
  366. # set -ug '@battery_vbar' \;\
  367. # set -ug '@battery_percentage'
  368. # return
  369. # fi
  370. #
  371. # battery_bar_symbol_full=$1
  372. # battery_bar_symbol_empty=$2
  373. # battery_bar_length=$3
  374. # battery_bar_palette=$4
  375. # battery_hbar_palette=$5
  376. # battery_vbar_palette=$6
  377. #
  378. # if [ x"$battery_bar_length" = x"auto" ]; then
  379. # columns=$(tmux -q display -p '#{client_width}' 2> /dev/null || echo 80)
  380. # if [ "$columns" -ge 80 ]; then
  381. # battery_bar_length=10
  382. # else
  383. # battery_bar_length=5
  384. # fi
  385. # fi
  386. #
  387. # if echo "$battery_bar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then
  388. # # shellcheck disable=SC2086
  389. # { set -f; IFS=,; set -- $battery_bar_palette; unset IFS; set +f; }
  390. # palette_style=$1
  391. # battery_bg=${2:-none}
  392. # [ x"$palette_style" = x"gradient" ] && \
  393. # palette="196 202 208 214 220 226 190 154 118 82 46"
  394. # [ x"$palette_style" = x"heat" ] && \
  395. # palette="243 245 247 144 143 142 184 214 208 202 196"
  396. #
  397. # palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }')
  398. # eval set -- "$palette"
  399. #
  400. # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }")
  401. # battery_bar="#[bg=$battery_bg]"
  402. # # shellcheck disable=SC2046
  403. # [ "$full" -gt 0 ] && \
  404. # battery_bar="$battery_bar$(printf "#[fg=colour%s]$battery_bar_symbol_full" $(echo "$palette" | cut -d' ' -f1-"$full"))"
  405. # # shellcheck disable=SC2046
  406. # empty=$((battery_bar_length - full))
  407. # # shellcheck disable=SC2046
  408. # [ "$empty" -gt 0 ] && \
  409. # battery_bar="$battery_bar$(printf "#[fg=colour%s]$battery_bar_symbol_empty" $(echo "$palette" | cut -d' ' -f$((full + 1))-$((full + empty))))"
  410. # eval battery_bar="$battery_bar#[fg=colour\${$((full == 0 ? 1 : full))}]"
  411. # elif echo "$battery_bar_palette" | grep -q -E '^(([#a-z0-9]{7,9}|none),?){3}$'; then
  412. # # shellcheck disable=SC2086
  413. # { set -f; IFS=,; set -- $battery_bar_palette; unset IFS; set +f; }
  414. # battery_full_fg=$1
  415. # battery_empty_fg=$2
  416. # battery_bg=$3
  417. #
  418. # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }")
  419. # [ x"$battery_bg" != x"none" ] && \
  420. # battery_bar="#[bg=$battery_bg]"
  421. # #shellcheck disable=SC2046
  422. # [ "$full" -gt 0 ] && \
  423. # battery_bar="$battery_bar#[fg=$battery_full_fg]$(printf "%0.s$battery_bar_symbol_full" $(seq 1 "$full"))"
  424. # empty=$((battery_bar_length - full))
  425. # #shellcheck disable=SC2046
  426. # [ "$empty" -gt 0 ] && \
  427. # battery_bar="$battery_bar#[fg=$battery_empty_fg]$(printf "%0.s$battery_bar_symbol_empty" $(seq 1 "$empty"))" && \
  428. # battery_bar="$battery_bar#[fg=$battery_empty_fg]"
  429. # fi
  430. #
  431. # if echo "$battery_hbar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then
  432. # # shellcheck disable=SC2086
  433. # { set -f; IFS=,; set -- $battery_hbar_palette; unset IFS; set +f; }
  434. # palette_style=$1
  435. # [ x"$palette_style" = x"gradient" ] && \
  436. # palette="196 202 208 214 220 226 190 154 118 82 46"
  437. # [ x"$palette_style" = x"heat" ] && \
  438. # palette="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196"
  439. #
  440. # palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }')
  441. # eval set -- "$palette"
  442. #
  443. # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }")
  444. # eval battery_hbar_fg="colour\${$((full == 0 ? 1 : full))}"
  445. # elif echo "$battery_hbar_palette" | grep -q -E '^([#a-z0-9]{7,9},?){3}$'; then
  446. # # shellcheck disable=SC2086
  447. # { set -f; IFS=,; set -- $battery_hbar_palette; unset IFS; set +f; }
  448. #
  449. # # shellcheck disable=SC2046
  450. # eval $(awk "BEGIN { printf \"battery_hbar_fg=$%d\", (($charge) - 0.001) * $# + 1 }")
  451. # fi
  452. #
  453. # eval set -- "▏ ▎ ▍ ▌ ▋ ▊ ▉ █"
  454. # # shellcheck disable=SC2046
  455. # eval $(awk "BEGIN { printf \"battery_hbar_symbol=$%d\", ($charge) * ($# - 1) + 1 }")
  456. # battery_hbar="#[fg=${battery_hbar_fg?}]${battery_hbar_symbol?}"
  457. #
  458. # if echo "$battery_vbar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then
  459. # # shellcheck disable=SC2086
  460. # { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; }
  461. # palette_style=$1
  462. # [ x"$palette_style" = x"gradient" ] && \
  463. # palette="196 202 208 214 220 226 190 154 118 82 46"
  464. # [ x"$palette_style" = x"heat" ] && \
  465. # palette="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196"
  466. #
  467. # palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }')
  468. # eval set -- "$palette"
  469. #
  470. # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }")
  471. # eval battery_vbar_fg="colour\${$((full == 0 ? 1 : full))}"
  472. # elif echo "$battery_vbar_palette" | grep -q -E '^([#a-z0-9]{7,9},?){3}$'; then
  473. # # shellcheck disable=SC2086
  474. # { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; }
  475. #
  476. # # shellcheck disable=SC2046
  477. # eval $(awk "BEGIN { printf \"battery_vbar_fg=$%d\", (($charge) - 0.001) * $# + 1 }")
  478. # fi
  479. #
  480. # eval set -- "▁ ▂ ▃ ▄ ▅ ▆ ▇ █"
  481. # # shellcheck disable=SC2046
  482. # eval $(awk "BEGIN { printf \"battery_vbar_symbol=$%d\", ($charge) * ($# - 1) + 1 }")
  483. # battery_vbar="#[fg=${battery_vbar_fg?}]${battery_vbar_symbol?}"
  484. #
  485. # battery_percentage="$(awk "BEGIN { printf \"%.0f%%\", ($charge) * 100 }")"
  486. #
  487. # tmux set -g '@battery_status' "$battery_status" \;\
  488. # set -g '@battery_bar' "$battery_bar" \;\
  489. # set -g '@battery_hbar' "$battery_hbar" \;\
  490. # set -g '@battery_vbar' "$battery_vbar" \;\
  491. # set -g '@battery_percentage' "$battery_percentage"
  492. # }
  493. #
  494. # _tty_info() {
  495. # tty="${1##/dev/}"
  496. # case "$_uname_s" in
  497. # *CYGWIN*)
  498. # ps -al | tail -n +2 | awk -v tty="$tty" '
  499. # ((/ssh/ && !/-W/) || !/ssh/) && $5 == tty {
  500. # user[$1] = $6; parent[$1] = $2; child[$2] = $1
  501. # }
  502. # END {
  503. # for (i in parent)
  504. # {
  505. # j = i
  506. # while (parent[j])
  507. # j = parent[j]
  508. #
  509. # if (!(i in child) && j != 1)
  510. # {
  511. # file = "/proc/" i "/cmdline"; getline command < file; close(file)
  512. # gsub(/\0/, " ", command)
  513. # "id -un " user[i] | getline username
  514. # print i":"username":"command
  515. # exit
  516. # }
  517. # }
  518. # }
  519. # '
  520. # ;;
  521. # *)
  522. # ps -t "$tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk '
  523. # NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) {
  524. # user[$2] = $1; parent[$2] = $3; child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4)
  525. # }
  526. # END {
  527. # for (i in parent)
  528. # {
  529. # j = i
  530. # while (parent[j])
  531. # j = parent[j]
  532. #
  533. # if (!(i in child) && j != 1)
  534. # {
  535. # print i":"user[i]":"command[i]
  536. # exit
  537. # }
  538. # }
  539. # }
  540. # '
  541. # ;;
  542. # esac
  543. # }
  544. #
  545. # _ssh_or_mosh_args() {
  546. # case "$1" in
  547. # *ssh*)
  548. # args=$(printf '%s' "$1" | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1 = ""; print $0; exit }')
  549. # ;;
  550. # *mosh-client*)
  551. # args=$(printf '%s' "$1" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g')
  552. # ;;
  553. # esac
  554. #
  555. # printf '%s' "$args"
  556. # }
  557. #
  558. # _username() {
  559. # tty=${1:-$(tmux display -p '#{pane_tty}')}
  560. # ssh_only=$2
  561. #
  562. # tty_info=$(_tty_info "$tty")
  563. # command=${tty_info#*:}
  564. # command=${command#*:}
  565. #
  566. # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command")
  567. # if [ -n "$ssh_or_mosh_args" ]; then
  568. # # shellcheck disable=SC2086
  569. # username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^user / { print $2; exit }')
  570. # # shellcheck disable=SC2086
  571. # [ -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 }')
  572. # else
  573. # if ! _is_enabled "$ssh_only"; then
  574. # username=${tty_info#*:}
  575. # username=${username%%:*}
  576. # fi
  577. # fi
  578. #
  579. # printf '%s\n' "$username"
  580. # }
  581. #
  582. # _hostname() {
  583. # tty=${1:-$(tmux display -p '#{pane_tty}')}
  584. # ssh_only=$2
  585. #
  586. # tty_info=$(_tty_info "$tty")
  587. # command=${tty_info#*:}
  588. # command=${command#*:}
  589. #
  590. # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command")
  591. # if [ -n "$ssh_or_mosh_args" ]; then
  592. # # shellcheck disable=SC2086
  593. # hostname=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^hostname / { print $2; exit }')
  594. # # shellcheck disable=SC2086
  595. # [ -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 }')
  596. #
  597. # case "$hostname" in
  598. # *[a-z-].*)
  599. # hostname=${hostname%%.*}
  600. # ;;
  601. # 127.0.0.1)
  602. # hostname="localhost"
  603. # ;;
  604. # esac
  605. # else
  606. # if ! _is_enabled "$ssh_only"; then
  607. # hostname=$3
  608. # fi
  609. # fi
  610. #
  611. # printf '%s\n' "$hostname"
  612. # }
  613. #
  614. # _root() {
  615. # tty=${1:-$(tmux display -p '#{pane_tty}')}
  616. # root=$2
  617. #
  618. # username=$(_username "$tty" false)
  619. #
  620. # [ x"$username" = x"root" ] && echo "$root"
  621. # }
  622. #
  623. # _uptime() {
  624. # case "$_uname_s" in
  625. # *Darwin*)
  626. # boot=$(sysctl -q -n kern.boottime | awk -F'[ ,:]+' '{ print $4 }')
  627. # now=$(date +%s)
  628. # ;;
  629. # *Linux*|*CYGWIN*|*MSYS*|*MINGW*)
  630. # boot=0
  631. # now=$(cut -d' ' -f1 < /proc/uptime)
  632. # ;;
  633. # *OpenBSD*)
  634. # boot=$(sysctl -n kern.boottime)
  635. # now=$(date +%s)
  636. # esac
  637. # # shellcheck disable=SC1004
  638. # awk -v boot="$boot" -v now="$now" '
  639. # BEGIN {
  640. # uptime = now - boot
  641. # y = int(uptime / 31536000)
  642. # dy = int(uptime / 86400) % 365
  643. # d = int(uptime / 86400)
  644. # h = int(uptime / 3600) % 24
  645. # m = int(uptime / 60) % 60
  646. # s = int(uptime) % 60
  647. #
  648. # system("tmux set -g @uptime_y " y + 0 " \\; " \
  649. # "set -g @uptime_dy " dy + 0 " \\; " \
  650. # "set -g @uptime_d " d + 0 " \\; " \
  651. # "set -g @uptime_h " h + 0 " \\; " \
  652. # "set -g @uptime_m " m + 0 " \\; " \
  653. # "set -g @uptime_s " s + 0)
  654. # }'
  655. # }
  656. #
  657. # _loadavg() {
  658. # case "$_uname_s" in
  659. # *Darwin*)
  660. # tmux set -g @loadavg "$(sysctl -q -n vm.loadavg | cut -d' ' -f2)"
  661. # ;;
  662. # *Linux*|*CYGWIN*)
  663. # tmux set -g @loadavg "$(cut -d' ' -f1 < /proc/loadavg)"
  664. # ;;
  665. # *OpenBSD*)
  666. # tmux set -g @loadavg "$(sysctl -q -n vm.loadavg | cut -d' ' -f1)"
  667. # ;;
  668. # esac
  669. # }
  670. #
  671. # _split_window() {
  672. # tty=${1:-$(tmux display -p '#{pane_tty}')}
  673. # shift
  674. #
  675. # tty_info=$(_tty_info "$tty")
  676. # command=${tty_info#*:}
  677. # command=${command#*:}
  678. #
  679. # case "$command" in
  680. # *mosh-client*)
  681. # # shellcheck disable=SC2046
  682. # tmux split-window "$@" mosh $(echo "$command" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/')
  683. # ;;
  684. # *ssh*)
  685. # # shellcheck disable=SC2046
  686. # tmux split-window "$@" $(echo "$command" | sed -e 's/;/\\;/g')
  687. # ;;
  688. # *)
  689. # tmux split-window "$@"
  690. # esac
  691. # }
  692. #
  693. # _apply_overrides() {
  694. # tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-false}
  695. # if _is_enabled "$tmux_conf_theme_24b_colour"; then
  696. # case "$TERM" in
  697. # screen-*|tmux-*)
  698. # ;;
  699. # *)
  700. # tmux set-option -ga terminal-overrides ",*256col*:Tc"
  701. # ;;
  702. # esac
  703. # fi
  704. # }
  705. #
  706. # _apply_bindings() {
  707. # cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT
  708. #
  709. # tmux list-keys | grep -vF 'tmux.conf.local' | grep -E 'new-window|split(-|_)window|new-session|copy-selection|copy-pipe' > "$cfg"
  710. #
  711. # # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the
  712. # # output of list-keys can be truncated
  713. # perl -p -i -e "s/'#\{\?window_zoomed_flag,Unzoom,Zoom\}' 'z' \{resize-pane -$/'#{?window_zoomed_flag,Unzoom,Zoom}' 'z' {resize-pane -Z}\"/g" "$cfg"
  714. #
  715. # perl -p -i -e "
  716. # s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g
  717. # ;
  718. # 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
  719. # ;
  720. # 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
  721. # ;
  722. # s/\bsplit-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" \
  723. # "$cfg"
  724. #
  725. # tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false}
  726. # if _is_enabled "$tmux_conf_new_window_retain_current_path"; then
  727. # perl -p -i -e "
  728. # s/\bnew-window\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/
  729. # ;
  730. # s/\bnew-window\b/new-window -c '#\{pane_current_path\}'/g" \
  731. # "$cfg"
  732. # fi
  733. #
  734. # tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true}
  735. # tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false}
  736. # if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then
  737. # perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{pane_tty\}\1'/g" "$cfg"
  738. # fi
  739. #
  740. # if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then
  741. # perl -p -i -e "
  742. # s/\bsplit-window\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/
  743. # ;
  744. # s/\bsplit-window\b/split-window -c '#{pane_current_path}'\1/g
  745. # ;
  746. # 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/
  747. # ;
  748. # 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" \
  749. # "$cfg"
  750. # fi
  751. #
  752. # tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false}
  753. # if _is_enabled "$tmux_conf_new_session_prompt"; then
  754. # perl -p -i \
  755. # -e "s/(?<!command-prompt -p )\b(new-session)\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/" \
  756. # -e ';' \
  757. # -e "s/(?<!\bcommand-prompt -p )\bnew-session\b(?! -s)/command-prompt -p new-session 'new-session -s \"%%\"'/g" \
  758. # "$cfg"
  759. # else
  760. # perl -p -i -e "s/\bcommand-prompt\s+-p\s+new-session\s+'new-session\s+-s\s+\"%%\"'/new-session/g" "$cfg"
  761. # fi
  762. #
  763. # tmux_conf_copy_to_os_clipboard=${tmux_conf_copy_to_os_clipboard:-false}
  764. # command -v pbcopy > /dev/null 2>&1 && command='pbcopy'
  765. # command -v reattach-to-user-namespace > /dev/null 2>&1 && command='reattach-to-user-namespace pbcopy'
  766. # command -v xsel > /dev/null 2>&1 && command='xsel -i -b'
  767. # ! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1 && command='xclip -i -selection clipboard > \/dev\/null 2>\&1'
  768. # command -v clip.exe > /dev/null 2>&1 && command='clip\.exe'
  769. # [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard'
  770. #
  771. # if [ -n "$command" ]; then
  772. # if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then
  773. # perl -p -i -e "s/\bcopy-selection(-and-cancel)?\b/copy-pipe\1 '$command'/g" "$cfg"
  774. # else
  775. # perl -p -i -e "s/\bcopy-pipe(-and-cancel)?\b\s+(\"|')?$command\2/copy-selection\1/g" "$cfg"
  776. # fi
  777. # fi
  778. #
  779. # # until tmux >= 3.0, output of tmux list-keys can't be consumed back by tmux source-file without applying some escapings
  780. # awk < "$cfg" \
  781. # '{i = $2 == "-T" ? 4 : 5; gsub(/^[;]$/, "\\\\&", $i); gsub(/^[$"#~]$/, "'"'"'&'"'"'", $i); gsub(/^['"'"']$/, "\"&\"", $i); print}' > "$cfg.in"
  782. #
  783. # # ignore bindings with errors
  784. # if ! tmux source-file "$cfg.in"; then
  785. # verbose_flag=$(tmux source-file -v /dev/null 2> /dev/null && printf -- '-v' || true)
  786. # while ! out=$(tmux source-file "$verbose_flag" "$cfg.in"); do
  787. # line=$(printf "%s" "$out" | tail -1 | cut -d':' -f2)
  788. # perl -n -i -e "if ($. != $line) { print }" "$cfg.in"
  789. # done
  790. # fi
  791. # }
  792. #
  793. # _apply_theme() {
  794. #
  795. # # -- panes -------------------------------------------------------------
  796. #
  797. # tmux_conf_theme_window_fg=${tmux_conf_theme_window_fg:-default}
  798. # tmux_conf_theme_window_bg=${tmux_conf_theme_window_bg:-default}
  799. # tmux_conf_theme_highlight_focused_pane=${tmux_conf_theme_highlight_focused_pane:-false}
  800. # tmux_conf_theme_focused_pane_fg=${tmux_conf_theme_focused_pane_fg:-default} # default
  801. # tmux_conf_theme_focused_pane_bg=${tmux_conf_theme_focused_pane_bg:-#0087d7} # light blue
  802. #
  803. # window_style="fg=$tmux_conf_theme_window_fg,bg=$tmux_conf_theme_window_bg"
  804. # if _is_enabled "$tmux_conf_theme_highlight_focused_pane"; then
  805. # window_active_style="fg=$tmux_conf_theme_focused_pane_fg,bg=$tmux_conf_theme_focused_pane_bg"
  806. # else
  807. # window_active_style="default"
  808. # fi
  809. #
  810. # tmux_conf_theme_pane_border_style=${tmux_conf_theme_pane_border_style:-thin}
  811. # tmux_conf_theme_pane_border=${tmux_conf_theme_pane_border:-#444444} # light gray
  812. # tmux_conf_theme_pane_active_border=${tmux_conf_theme_pane_active_border:-#00afff} # light blue
  813. # tmux_conf_theme_pane_border_fg=${tmux_conf_theme_pane_border_fg:-$tmux_conf_theme_pane_border}
  814. # tmux_conf_theme_pane_active_border_fg=${tmux_conf_theme_pane_active_border_fg:-$tmux_conf_theme_pane_active_border}
  815. # case "$tmux_conf_theme_pane_border_style" in
  816. # fat)
  817. # tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-$tmux_conf_theme_pane_border_fg}
  818. # tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-$tmux_conf_theme_pane_active_border_fg}
  819. # ;;
  820. # thin|*)
  821. # tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-default}
  822. # tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-default}
  823. # ;;
  824. # esac
  825. #
  826. # tmux_conf_theme_pane_indicator=${tmux_conf_theme_pane_indicator:-#00afff} # light blue
  827. # tmux_conf_theme_pane_active_indicator=${tmux_conf_theme_pane_active_indicator:-#00afff} # light blue
  828. #
  829. # # -- status line -------------------------------------------------------
  830. #
  831. # tmux_conf_theme_left_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_main-}")
  832. # tmux_conf_theme_left_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_sub-|}")
  833. # tmux_conf_theme_right_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_main-}")
  834. # tmux_conf_theme_right_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_sub-|}")
  835. #
  836. # tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-#000000} # black
  837. # tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-#ffff00} # yellow
  838. # tmux_conf_theme_message_attr=${tmux_conf_theme_message_attr:-bold}
  839. #
  840. # tmux_conf_theme_message_command_fg=${tmux_conf_theme_message_command_fg:-#ffff00} # yellow
  841. # tmux_conf_theme_message_command_bg=${tmux_conf_theme_message_command_bg:-#000000} # black
  842. # tmux_conf_theme_message_command_attr=${tmux_conf_theme_message_command_attr:-bold}
  843. #
  844. # tmux_conf_theme_mode_fg=${tmux_conf_theme_mode_fg:-#000000} # black
  845. # tmux_conf_theme_mode_bg=${tmux_conf_theme_mode_bg:-#ffff00} # yellow
  846. # tmux_conf_theme_mode_attr=${tmux_conf_theme_mode_attr:-bold}
  847. #
  848. # tmux_conf_theme_status_fg=${tmux_conf_theme_status_fg:-#8a8a8a} # white
  849. # tmux_conf_theme_status_bg=${tmux_conf_theme_status_bg:-#080808} # dark gray
  850. # tmux_conf_theme_status_attr=${tmux_conf_theme_status_attr:-none}
  851. #
  852. # tmux_conf_theme_terminal_title=${tmux_conf_theme_terminal_title:-#h ❐ #S ● #I #W}
  853. #
  854. # tmux_conf_theme_terminal_title=$(echo "$tmux_conf_theme_terminal_title" | sed \
  855. # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \
  856. # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \
  857. # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
  858. # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #h #D)%g' \
  859. # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
  860. # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g')
  861. #
  862. # tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-#8a8a8a} # white
  863. # tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-#080808} # dark gray
  864. # tmux_conf_theme_window_status_attr=${tmux_conf_theme_window_status_attr:-none}
  865. # tmux_conf_theme_window_status_format=${tmux_conf_theme_window_status_format:-#I #W}
  866. #
  867. # tmux_conf_theme_window_status_current_fg=${tmux_conf_theme_window_status_current_fg:-#000000} # black
  868. # tmux_conf_theme_window_status_current_bg=${tmux_conf_theme_window_status_current_bg:-#00afff} # light blue
  869. # tmux_conf_theme_window_status_current_attr=${tmux_conf_theme_window_status_current_attr:-bold}
  870. # tmux_conf_theme_window_status_current_format=${tmux_conf_theme_window_status_current_format:-#I #W}
  871. # if [ x"$(tmux show -g -v status-justify)" = x"right" ]; then
  872. # 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"
  873. # else
  874. # tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg]$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] $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_left_separator_main"
  875. # fi
  876. #
  877. # tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed \
  878. # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \
  879. # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \
  880. # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
  881. # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #h #D)%g' \
  882. # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
  883. # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g')
  884. # tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed \
  885. # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \
  886. # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \
  887. # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
  888. # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #h #D)%g' \
  889. # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
  890. # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g')
  891. #
  892. # tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-default}
  893. # tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-default}
  894. # tmux_conf_theme_window_status_activity_attr=${tmux_conf_theme_window_status_activity_attr:-underscore}
  895. #
  896. # tmux_conf_theme_window_status_bell_fg=${tmux_conf_theme_window_status_bell_fg:-#ffff00} # yellow
  897. # tmux_conf_theme_window_status_bell_bg=${tmux_conf_theme_window_status_bell_bg:-default}
  898. # tmux_conf_theme_window_status_bell_attr=${tmux_conf_theme_window_status_bell_attr:-blink,bold}
  899. #
  900. # tmux_conf_theme_window_status_last_fg=${tmux_conf_theme_window_status_last_fg:-#00afff} # light blue
  901. # tmux_conf_theme_window_status_last_bg=${tmux_conf_theme_window_status_last_bg:-default}
  902. # tmux_conf_theme_window_status_last_attr=${tmux_conf_theme_window_status_last_attr:-none}
  903. #
  904. # # -- indicators
  905. #
  906. # tmux_conf_theme_pairing=${tmux_conf_theme_pairing:-👓 } # U+1F453
  907. # tmux_conf_theme_pairing_fg=${tmux_conf_theme_pairing_fg:-#e4e4e4} # white
  908. # tmux_conf_theme_pairing_bg=${tmux_conf_theme_pairing_bg:-none}
  909. # tmux_conf_theme_pairing_attr=${tmux_conf_theme_pairing_attr:-none}
  910. #
  911. # tmux_conf_theme_prefix=${tmux_conf_theme_prefix:-⌨ } # U+2328
  912. # tmux_conf_theme_prefix_fg=${tmux_conf_theme_prefix_fg:-#e4e4e4} # white
  913. # tmux_conf_theme_prefix_bg=${tmux_conf_theme_prefix_bg:-none}
  914. # tmux_conf_theme_prefix_attr=${tmux_conf_theme_prefix_attr:-none}
  915. #
  916. # tmux_conf_theme_root=${tmux_conf_theme_root:-!}
  917. # tmux_conf_theme_root_fg=${tmux_conf_theme_root_fg:-none}
  918. # tmux_conf_theme_root_bg=${tmux_conf_theme_root_bg:-none}
  919. # tmux_conf_theme_root_attr=${tmux_conf_theme_root_attr:-bold,blink}
  920. #
  921. # tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-🔒} # U+1F512
  922. # tmux_conf_theme_synchronized_fg=${tmux_conf_theme_synchronized_fg:-none}
  923. # tmux_conf_theme_synchronized_bg=${tmux_conf_theme_synchronized_bg:-none}
  924. # tmux_conf_theme_synchronized_attr=${tmux_conf_theme_synchronized_attr:-none}
  925. #
  926. # # -- status-left style
  927. #
  928. # 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,} '}
  929. # tmux_conf_theme_status_left_fg=${tmux_conf_theme_status_left_fg:-#000000,#e4e4e4,#e4e4e4} # black, white , white
  930. # tmux_conf_theme_status_left_bg=${tmux_conf_theme_status_left_bg:-#ffff00,#ff00af,#00afff} # yellow, pink, white blue
  931. # tmux_conf_theme_status_left_attr=${tmux_conf_theme_status_left_attr:-bold,none,none}
  932. #
  933. # if [ -n "$tmux_conf_theme_status_left" ]; then
  934. # status_left=$(echo "$tmux_conf_theme_status_left" | sed \
  935. # -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" \
  936. # -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" \
  937. # -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" \
  938. # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
  939. #
  940. # if [ -n "$(tmux display -p '#{version}')" ]; then
  941. # status_left=$(echo "$status_left" | sed \
  942. # -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")
  943. # else
  944. # status_left=$(echo "$status_left" | sed \
  945. # -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")
  946. # fi
  947. #
  948. # status_left=$(printf '%s' "$status_left" | awk \
  949. # -v fg_="$tmux_conf_theme_status_left_fg" \
  950. # -v bg_="$tmux_conf_theme_status_left_bg" \
  951. # -v attr_="$tmux_conf_theme_status_left_attr" \
  952. # -v mainsep="$tmux_conf_theme_left_separator_main" \
  953. # -v subsep="$tmux_conf_theme_left_separator_sub" '
  954. # function subsplit(s, l, i, a, r)
  955. # {
  956. # l = split(s, a, ",")
  957. # for (i = 1; i <= l; ++i)
  958. # {
  959. # o = split(a[i], _, "(") - 1
  960. # c = split(a[i], _, ")") - 1
  961. # open += o - c
  962. # o_ = split(a[i], _, "{") - 1
  963. # c_ = split(a[i], _, "}") - 1
  964. # open_ += o_ - c_
  965. # o__ = split(a[i], _, "[") - 1
  966. # c__ = split(a[i], _, "]") - 1
  967. # open__ += o__ - c__
  968. #
  969. # if (i == l)
  970. # r = sprintf("%s%s", r, a[i])
  971. # else if (open || open_ || open__)
  972. # r = sprintf("%s%s,", r, a[i])
  973. # else
  974. # r = sprintf("%s%s#[fg=%s,bg=%s,%s]%s", r, a[i], fg[j], bg[j], attr[j], subsep)
  975. # }
  976. #
  977. # gsub(/#\[inherit\]/, sprintf("#[default]#[fg=%s,bg=%s,%s]", fg[j], bg[j], attr[j]), r)
  978. # return r
  979. # }
  980. # BEGIN {
  981. # FS = "|"
  982. # l1 = split(fg_, fg, ",")
  983. # l2 = split(bg_, bg, ",")
  984. # l3 = split(attr_, attr, ",")
  985. # l = l1 < l2 ? (l1 < l3 ? l1 : l3) : (l2 < l3 ? l2 : l3)
  986. # }
  987. # {
  988. # for (i = j = 1; i <= NF; ++i)
  989. # {
  990. # if (open || open_ || open__)
  991. # printf "|%s", subsplit($i)
  992. # else
  993. # {
  994. # if (i > 1)
  995. # printf "#[fg=%s,bg=%s,none]%s#[fg=%s,bg=%s,%s]%s", bg[j_], bg[j], mainsep, fg[j], bg[j], attr[j], subsplit($i)
  996. # else
  997. # printf "#[fg=%s,bg=%s,%s]%s", fg[j], bg[j], attr[j], subsplit($i)
  998. # }
  999. #
  1000. # if (!open && !open_ && !open__)
  1001. # {
  1002. # j_ = j
  1003. # j = j % l + 1
  1004. # }
  1005. # }
  1006. # printf "#[fg=%s,bg=%s,none]%s", bg[j_], "default", mainsep
  1007. # }')
  1008. # fi
  1009. #
  1010. # status_left="$status_left "
  1011. #
  1012. # # -- status-right style
  1013. #
  1014. # tmux_conf_theme_status_right=${tmux_conf_theme_status_right-'#{pairing}#{prefix} #{battery_status} #{battery_bar} #{battery_percentage} , %R , %d %b | #{username} | #{hostname} '}
  1015. # 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} '}
  1016. # tmux_conf_theme_status_right_fg=${tmux_conf_theme_status_right_fg:-#8a8a8a,#e4e4e4,#000000} # light gray, white, black
  1017. # tmux_conf_theme_status_right_bg=${tmux_conf_theme_status_right_bg:-#080808,#d70000,#e4e4e4} # dark gray, red, white
  1018. # tmux_conf_theme_status_right_attr=${tmux_conf_theme_status_right_attr:-none,none,bold}
  1019. #
  1020. # if [ -n "$tmux_conf_theme_status_right" ]; then
  1021. # status_right=$(echo "$tmux_conf_theme_status_right" | sed \
  1022. # -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" \
  1023. # -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" \
  1024. # -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" \
  1025. # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
  1026. #
  1027. # if [ -n "$(tmux display -p '#{version}')" ]; then
  1028. # status_right=$(echo "$status_right" | sed \
  1029. # -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")
  1030. # else
  1031. # status_right=$(echo "$status_right" | sed \
  1032. # -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")
  1033. # fi
  1034. #
  1035. # status_right=$(printf '%s' "$status_right" | awk \
  1036. # -v fg_="$tmux_conf_theme_status_right_fg" \
  1037. # -v bg_="$tmux_conf_theme_status_right_bg" \
  1038. # -v attr_="$tmux_conf_theme_status_right_attr" \
  1039. # -v mainsep="$tmux_conf_theme_right_separator_main" \
  1040. # -v subsep="$tmux_conf_theme_right_separator_sub" '
  1041. # function subsplit(s, l, i, a, r)
  1042. # {
  1043. # l = split(s, a, ",")
  1044. # for (i = 1; i <= l; ++i)
  1045. # {
  1046. # o = split(a[i], _, "(") - 1
  1047. # c = split(a[i], _, ")") - 1
  1048. # open += o - c
  1049. # o_ = split(a[i], _, "{") - 1
  1050. # c_ = split(a[i], _, "}") - 1
  1051. # open_ += o_ - c_
  1052. # o__ = split(a[i], _, "[") - 1
  1053. # c__ = split(a[i], _, "]") - 1
  1054. # open__ += o__ - c__
  1055. #
  1056. # if (i == l)
  1057. # r = sprintf("%s%s", r, a[i])
  1058. # else if (open || open_ || open__)
  1059. # r = sprintf("%s%s,", r, a[i])
  1060. # else
  1061. # r = sprintf("%s%s#[fg=%s,bg=%s,%s]%s", r, a[i], fg[j], bg[j], attr[j], subsep)
  1062. # }
  1063. #
  1064. # gsub(/#\[inherit\]/, sprintf("#[default]#[fg=%s,bg=%s,%s]", fg[j], bg[j], attr[j]), r)
  1065. # return r
  1066. # }
  1067. # BEGIN {
  1068. # FS = "|"
  1069. # l1 = split(fg_, fg, ",")
  1070. # l2 = split(bg_, bg, ",")
  1071. # l3 = split(attr_, attr, ",")
  1072. # l = l1 < l2 ? (l1 < l3 ? l1 : l3) : (l2 < l3 ? l2 : l3)
  1073. # }
  1074. # {
  1075. # for (i = j = 1; i <= NF; ++i)
  1076. # {
  1077. # if (open_ || open || open__)
  1078. # printf "|%s", subsplit($i)
  1079. # else
  1080. # printf "#[fg=%s,bg=%s,none]%s#[fg=%s,bg=%s,%s]%s", bg[j], (i == 1) ? "default" : bg[j_], mainsep, fg[j], bg[j], attr[j], subsplit($i)
  1081. #
  1082. # if (!open && !open_ && !open__)
  1083. # {
  1084. # j_ = j
  1085. # j = j % l + 1
  1086. # }
  1087. # }
  1088. # }')
  1089. # fi
  1090. #
  1091. # # -- variables
  1092. #
  1093. # tmux_conf_battery_bar_symbol_full=$(_decode_unicode_escapes "${tmux_conf_battery_bar_symbol_full:-◼}")
  1094. # tmux_conf_battery_bar_symbol_empty=$(_decode_unicode_escapes "${tmux_conf_battery_bar_symbol_empty:-◻}")
  1095. # tmux_conf_battery_bar_length=${tmux_conf_battery_bar_length:-auto}
  1096. # tmux_conf_battery_bar_palette=${tmux_conf_battery_bar_palette:-gradient}
  1097. # tmux_conf_battery_hbar_palette=${tmux_conf_battery_hbar_palette:-gradient} # red, orange, green
  1098. # tmux_conf_battery_vbar_palette=${tmux_conf_battery_vbar_palette:-gradient} # red, orange, green
  1099. # tmux_conf_battery_status_charging=$(_decode_unicode_escapes "${tmux_conf_battery_status_charging:-↑}") # U+2191
  1100. # tmux_conf_battery_status_discharging=$(_decode_unicode_escapes "${tmux_conf_battery_status_discharging:-↓}") # U+2193
  1101. #
  1102. # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _battery_bar'
  1103. # _battery_info
  1104. # if [ "$charge" != 0 ]; then
  1105. # case "$status_left $status_right" in
  1106. # *'#{battery_status}'*|*'#{battery_bar}'*|*'#{battery_hbar}'*|*'#{battery_vbar}'*|*'#{battery_percentage}'*)
  1107. # status_left=$(echo "$status_left" | sed -E \
  1108. # -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \
  1109. # -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \
  1110. # -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \
  1111. # -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \
  1112. # -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g')
  1113. # status_right=$(echo "$status_right" | sed -E \
  1114. # -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \
  1115. # -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \
  1116. # -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \
  1117. # -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \
  1118. # -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g')
  1119. # interval=60
  1120. # 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"
  1121. # 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"
  1122. # ;;
  1123. # esac
  1124. # fi
  1125. #
  1126. # case "$status_left $status_right" in
  1127. # *'#{username}'*|*'#{hostname}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*)
  1128. # status_left=$(echo "$status_left" | sed \
  1129. # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
  1130. # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #h #D)%g' \
  1131. # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
  1132. # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g')
  1133. # status_right=$(echo "$status_right" | sed \
  1134. # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
  1135. # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #h #D)%g' \
  1136. # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
  1137. # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g')
  1138. # ;;
  1139. # esac
  1140. #
  1141. # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _uptime'
  1142. # case "$status_left $status_right" in
  1143. # *'#{uptime_d}'*|*'#{uptime_h}'*|*'#{uptime_m}'*|*'#{uptime_s}'*)
  1144. # status_left=$(echo "$status_left" | sed -E \
  1145. # -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \
  1146. # -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \
  1147. # -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \
  1148. # -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \
  1149. # -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \
  1150. # -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g')
  1151. # status_right=$(echo "$status_right" | sed -E \
  1152. # -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \
  1153. # -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \
  1154. # -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \
  1155. # -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \
  1156. # -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \
  1157. # -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g')
  1158. # interval=60
  1159. # case "$status_left $status_right" in
  1160. # *'#{@uptime_s}'*)
  1161. # interval=$(tmux show -gv status-interval)
  1162. # ;;
  1163. # esac
  1164. # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _uptime; sleep $interval; done"
  1165. # ;;
  1166. # esac
  1167. #
  1168. # _pkillf 'cut -c3- ~/\.tmux\.conf \| sh -s _loadavg'
  1169. # case "$status_left $status_right" in
  1170. # *'#{loadavg}'*)
  1171. # status_left=$(echo "$status_left" | sed -E \
  1172. # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g')
  1173. # status_right=$(echo "$status_right" | sed -E \
  1174. # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g')
  1175. # interval=$(tmux show -gv status-interval)
  1176. # tmux run -b "trap 'exit 0' TERM; while :; do nice cut -c3- ~/.tmux.conf | sh -s _loadavg; sleep $interval; done"
  1177. # ;;
  1178. # esac
  1179. #
  1180. # # -- clock -------------------------------------------------------------
  1181. #
  1182. # tmux_conf_theme_clock_colour=${tmux_conf_theme_clock_colour:-#00afff} # light blue
  1183. # tmux_conf_theme_clock_style=${tmux_conf_theme_clock_style:-24}
  1184. #
  1185. # tmux setw -g window-style "$window_style" \; setw -g window-active-style "$window_active_style" \;\
  1186. # 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" \;\
  1187. # set -g display-panes-colour "$tmux_conf_theme_pane_indicator" \; set -g display-panes-active-colour "$tmux_conf_theme_pane_active_indicator" \;\
  1188. # set -g message-style "fg=$tmux_conf_theme_message_fg,bg=$tmux_conf_theme_message_bg,$tmux_conf_theme_message_attr" \;\
  1189. # 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" \;\
  1190. # setw -g mode-style "fg=$tmux_conf_theme_mode_fg,bg=$tmux_conf_theme_mode_bg,$tmux_conf_theme_mode_attr" \;\
  1191. # set -g status-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\
  1192. # set -g status-left-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\
  1193. # set -g status-right-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\
  1194. # set -g set-titles-string "$(_decode_unicode_escapes "$tmux_conf_theme_terminal_title")" \;\
  1195. # 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" \;\
  1196. # setw -g window-status-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_format")" \;\
  1197. # 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" \;\
  1198. # setw -g window-status-current-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_current_format")" \;\
  1199. # 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" \;\
  1200. # 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" \;\
  1201. # 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" \;\
  1202. # set -g status-left-length 1000 \; set -g status-left "$(_decode_unicode_escapes "$status_left")" \;\
  1203. # set -g status-right-length 1000 \; set -g status-right "$(_decode_unicode_escapes "$status_right")" \;\
  1204. # setw -g clock-mode-colour "$tmux_conf_theme_clock_colour" \;\
  1205. # setw -g clock-mode-style "$tmux_conf_theme_clock_style"
  1206. # }
  1207. #
  1208. # _apply_configuration() {
  1209. #
  1210. # if ! command -v perl > /dev/null 2>&1; then
  1211. # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires perl" \; set -u display-time'
  1212. # return
  1213. # fi
  1214. # if ! command -v sed > /dev/null 2>&1; then
  1215. # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires sed" \; set -u display-time'
  1216. # return
  1217. # fi
  1218. # if ! command -v awk > /dev/null 2>&1; then
  1219. # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time'
  1220. # return
  1221. # fi
  1222. #
  1223. # # see https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
  1224. # if command -v reattach-to-user-namespace > /dev/null 2>&1; then
  1225. # default_shell="$(tmux show -gv default-shell)"
  1226. # case "$default_shell" in
  1227. # *fish)
  1228. # tmux set -g default-command "reattach-to-user-namespace -l $default_shell"
  1229. # ;;
  1230. # *sh)
  1231. # tmux set -g default-command "exec $default_shell... 2> /dev/null & reattach-to-user-namespace -l $default_shell"
  1232. # ;;
  1233. # esac
  1234. # fi
  1235. #
  1236. # case "$_uname_s" in
  1237. # *CYGWIN*|*MSYS*)
  1238. # # prevent Cygwin and MSYS2 from cd-ing into home directory when evaluating /etc/profile
  1239. # tmux setenv -g CHERE_INVOKING 1
  1240. # ;;
  1241. # esac
  1242. #
  1243. # _apply_overrides
  1244. # _apply_theme&
  1245. # _apply_bindings&
  1246. # # shellcheck disable=SC2046
  1247. # tmux setenv -gu tmux_conf_dummy $(printenv | grep -E -o '^tmux_conf_[^=]+' | awk '{printf "; setenv -gu %s", $0}')
  1248. # wait
  1249. # }
  1250. #
  1251. # _urlview() {
  1252. # tmux capture-pane -J -S - -E - -b "urlview-$1" -t "$1"
  1253. # tmux split-window "tmux show-buffer -b urlview-$1 | urlview || true; tmux delete-buffer -b urlview-$1"
  1254. # }
  1255. #
  1256. # _fpp() {
  1257. # tmux capture-pane -J -S - -E - -b "fpp-$1" -t "$1"
  1258. # tmux split-window "tmux show-buffer -b fpp-$1 | fpp || true; tmux delete-buffer -b fpp-$1"
  1259. # }
  1260. #
  1261. # "$@"
  1262.  
Advertisement
Add Comment
Please, Sign In to add comment