Guest User

.tmux.conf

a guest
Jan 27th, 2020
32
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # cat << EOF > /dev/null
  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. # __newline='
  192. # '
  193. #
  194. # _is_enabled() {
  195. # ( ([ x"$1" = x"enabled" ] || [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"1" ]) && return 0 ) || return 1
  196. # }
  197. #
  198. # _circled() {
  199. # circled_digits='⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳'
  200. # if [ "$1" -le 20 ] 2>/dev/null; then
  201. # i=$(( $1 + 1 ))
  202. # eval set -- "$circled_digits"
  203. # eval echo "\${$i}"
  204. # else
  205. # echo "$1"
  206. # fi
  207. # }
  208. #
  209. # _decode_unicode_escapes() {
  210. # 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
  211. # }
  212. #
  213. # _maximize_pane() {
  214. # current_session=${1:-$(tmux display -p '#{session_name}')}
  215. # current_pane=${2:-$(tmux display -p '#{pane_id}')}
  216. #
  217. # dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -E -o '^1 %.+maximized.+$' || true)
  218. # 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" )
  219. #
  220. # if [ -z "$restore" ]; then
  221. # [ "$(tmux list-panes -t "$current_session:" | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return
  222. # 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'")
  223. # window=${window%.*}
  224. #
  225. # retry=10
  226. # while [ x"$(tmux list-panes -t "$window" -F '#{session_name}:#{window_index} #{pane_dead}' 2>/dev/null)" != x"$window 1" ] && [ "$retry" -ne 0 ]; do
  227. # sleep 0.05
  228. # retry=$((retry - 1))
  229. # done
  230. # if [ "$retry" -eq 0 ]; then
  231. # tmux display 'Unable to maximize pane'
  232. # fi
  233. #
  234. # new_pane=$(tmux display -t "$window" -p '#{pane_id}')
  235. # tmux setw -t "$window" remain-on-exit off \; swap-pane -s "$current_pane" -t "$new_pane"
  236. # else
  237. # $restore || tmux kill-pane
  238. # fi
  239. # }
  240. #
  241. # _toggle_mouse() {
  242. # old=$(tmux show -gv mouse)
  243. # new=""
  244. #
  245. # if [ "$old" = "on" ]; then
  246. # new="off"
  247. # else
  248. # new="on"
  249. # fi
  250. #
  251. # tmux set -g mouse $new \;\
  252. # display "mouse: $new"
  253. # }
  254. #
  255. # _battery() {
  256. # count=0
  257. # charge=0
  258. # uname_s=$(uname -s)
  259. # case "$uname_s" in
  260. # *Darwin*)
  261. # while IFS= read -r line; do
  262. # if [ x"$discharging" != x"true" ]; then
  263. # discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false")
  264. # fi
  265. # percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%')
  266. # charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }')
  267. # count=$((count + 1))
  268. # done << EOF
  269. # $(pmset -g batt | grep 'InternalBattery')
  270. # EOF
  271. # ;;
  272. # *Linux*)
  273. # while IFS= read -r batpath; do
  274. # grep -i -q device "$batpath/scope" 2> /dev/null && continue
  275. #
  276. # if [ x"$discharging" != x"true" ]; then
  277. # discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false")
  278. # fi
  279. # bat_capacity="$batpath/capacity"
  280. # if [ -r "$bat_capacity" ]; then
  281. # charge=$(awk -v charge="$charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + capacity / 100 }')
  282. # else
  283. # bat_energy_full="$batpath/energy_full"
  284. # bat_energy_now="$batpath/energy_now"
  285. # if [ -r "$bat_energy_full" ] && [ -r "$bat_energy_now" ]; then
  286. # 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 }')
  287. # fi
  288. # fi
  289. # count=$((count + 1))
  290. # done << EOF
  291. # $(find /sys/class/power_supply -maxdepth 1 -iname '*bat*')
  292. # EOF
  293. # ;;
  294. # *CYGWIN*|*MSYS*|*MINGW*)
  295. # while IFS= read -r line; do
  296. # [ -z "$line" ] && continue
  297. # if [ x"$discharging" != x"true" ]; then
  298. # discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }')
  299. # fi
  300. # charge=$(printf '%s' "$line" | awk -v charge="$charge" '{ print charge + $2 / 100 }')
  301. # count=$((count + 1))
  302. # done << EOF
  303. # $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining | tr -d '\r' | tail -n +2)
  304. # EOF
  305. # ;;
  306. # *OpenBSD*)
  307. # for batid in 0 1 2; do
  308. # sysctl -n "hw.sensors.acpibat$batid.raw0" 2>&1 | grep -q 'not found' && continue
  309. # if [ x"$discharging" != x"true" ]; then
  310. # discharging=$(sysctl -n "hw.sensors.acpibat$batid.raw0" | grep -q 1 && echo "true" || echo "false")
  311. # fi
  312. # if sysctl -n "hw.sensors.acpibat$batid" | grep -q amphour; then
  313. # 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 }')
  314. # else
  315. # 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 }')
  316. # fi
  317. # count=$((count + 1))
  318. # done
  319. # ;;
  320. # esac
  321. # [ "$count" -ne 0 ] && charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }')
  322. # if [ "$charge" -eq 0 ]; then
  323. # tmux set -ug '@battery_status' \;\
  324. # set -ug '@battery_bar' \;\
  325. # set -ug '@battery_hbar' \;\
  326. # set -ug '@battery_vbar' \;\
  327. # set -ug '@battery_percentage'
  328. # return
  329. # fi
  330. #
  331. # variables=$(tmux show -gqv '@battery_bar_symbol_full' \;\
  332. # show -gqv '@battery_bar_symbol_empty' \;\
  333. # show -gqv '@battery_bar_length' \;\
  334. # show -gqv '@battery_bar_palette' \;\
  335. # show -gqv '@battery_hbar_palette' \;\
  336. # show -gqv '@battery_vbar_palette' \;\
  337. # show -gqv '@battery_status_charging' \;\
  338. # show -gqv '@battery_status_discharging')
  339. # # shellcheck disable=SC2086
  340. # { set -f; IFS="$__newline"; set -- $variables; unset IFS; set +f; }
  341. #
  342. # battery_bar_symbol_full=$1
  343. # battery_bar_symbol_empty=$2
  344. # battery_bar_length=$3
  345. # battery_bar_palette=$4
  346. # battery_hbar_palette=$5
  347. # battery_vbar_palette=$6
  348. # battery_status_charging=$7
  349. # battery_status_discharging=$8
  350. #
  351. # if [ x"$battery_bar_length" = x"auto" ]; then
  352. # columns=$(tmux -q display -p '#{client_width}' 2> /dev/null || echo 80)
  353. # if [ "$columns" -ge 80 ]; then
  354. # battery_bar_length=10
  355. # else
  356. # battery_bar_length=5
  357. # fi
  358. # fi
  359. #
  360. # if [ x"$discharging" = x"true" ]; then
  361. # battery_status="$battery_status_discharging"
  362. # else
  363. # battery_status="$battery_status_charging"
  364. # fi
  365. #
  366. # if echo "$battery_bar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then
  367. # # shellcheck disable=SC2086
  368. # { set -f; IFS=,; set -- $battery_bar_palette; unset IFS; set +f; }
  369. # palette_style=$1
  370. # battery_bg=${2:-none}
  371. # [ x"$palette_style" = x"gradient" ] && \
  372. # palette="196 202 208 214 220 226 190 154 118 82 46"
  373. # [ x"$palette_style" = x"heat" ] && \
  374. # palette="243 245 247 144 143 142 184 214 208 202 196"
  375. #
  376. # palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }')
  377. # eval set -- "$palette"
  378. #
  379. # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }")
  380. # battery_bar="#[bg=$battery_bg]"
  381. # # shellcheck disable=SC2046
  382. # [ "$full" -gt 0 ] && \
  383. # battery_bar="$battery_bar$(printf "#[fg=colour%s]$battery_bar_symbol_full" $(echo "$palette" | cut -d' ' -f1-"$full"))"
  384. # # shellcheck disable=SC2046
  385. # empty=$((battery_bar_length - full))
  386. # # shellcheck disable=SC2046
  387. # [ "$empty" -gt 0 ] && \
  388. # battery_bar="$battery_bar$(printf "#[fg=colour%s]$battery_bar_symbol_empty" $(echo "$palette" | cut -d' ' -f$((full + 1))-$((full + empty))))"
  389. # eval battery_bar="$battery_bar#[fg=colour\${$((full == 0 ? 1 : full))}]"
  390. # elif echo "$battery_bar_palette" | grep -q -E '^(([#a-z0-9]{7,9}|none),?){3}$'; then
  391. # # shellcheck disable=SC2086
  392. # { set -f; IFS=,; set -- $battery_bar_palette; unset IFS; set +f; }
  393. # battery_full_fg=$1
  394. # battery_empty_fg=$2
  395. # battery_bg=$3
  396. #
  397. # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }")
  398. # [ x"$battery_bg" != x"none" ] && \
  399. # battery_bar="#[bg=$battery_bg]"
  400. # #shellcheck disable=SC2046
  401. # [ "$full" -gt 0 ] && \
  402. # battery_bar="$battery_bar#[fg=$battery_full_fg]$(printf "%0.s$battery_bar_symbol_full" $(seq 1 "$full"))"
  403. # empty=$((battery_bar_length - full))
  404. # #shellcheck disable=SC2046
  405. # [ "$empty" -gt 0 ] && \
  406. # battery_bar="$battery_bar#[fg=$battery_empty_fg]$(printf "%0.s$battery_bar_symbol_empty" $(seq 1 "$empty"))" && \
  407. # battery_bar="$battery_bar#[fg=$battery_empty_fg]"
  408. # fi
  409. #
  410. # if echo "$battery_hbar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then
  411. # # shellcheck disable=SC2086
  412. # { set -f; IFS=,; set -- $battery_hbar_palette; unset IFS; set +f; }
  413. # palette_style=$1
  414. # [ x"$palette_style" = x"gradient" ] && \
  415. # palette="196 202 208 214 220 226 190 154 118 82 46"
  416. # [ x"$palette_style" = x"heat" ] && \
  417. # palette="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196"
  418. #
  419. # palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }')
  420. # eval set -- "$palette"
  421. #
  422. # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }")
  423. # eval battery_hbar_fg="colour\${$((full == 0 ? 1 : full))}"
  424. # elif echo "$battery_hbar_palette" | grep -q -E '^([#a-z0-9]{7,9},?){3}$'; then
  425. # # shellcheck disable=SC2086
  426. # { set -f; IFS=,; set -- $battery_hbar_palette; unset IFS; set +f; }
  427. #
  428. # # shellcheck disable=SC2046
  429. # eval $(awk "BEGIN { printf \"battery_hbar_fg=$%d\", (($charge) - 0.001) * $# + 1 }")
  430. # fi
  431. #
  432. # eval set -- "▏ ▎ ▍ ▌ ▋ ▊ ▉ █"
  433. # # shellcheck disable=SC2046
  434. # eval $(awk "BEGIN { printf \"battery_hbar_symbol=$%d\", ($charge) * ($# - 1) + 1 }")
  435. # battery_hbar="#[fg=${battery_hbar_fg?}]${battery_hbar_symbol?}"
  436. #
  437. # if echo "$battery_vbar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then
  438. # # shellcheck disable=SC2086
  439. # { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; }
  440. # palette_style=$1
  441. # [ x"$palette_style" = x"gradient" ] && \
  442. # palette="196 202 208 214 220 226 190 154 118 82 46"
  443. # [ x"$palette_style" = x"heat" ] && \
  444. # palette="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196"
  445. #
  446. # palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }')
  447. # eval set -- "$palette"
  448. #
  449. # full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }")
  450. # eval battery_vbar_fg="colour\${$((full == 0 ? 1 : full))}"
  451. # elif echo "$battery_vbar_palette" | grep -q -E '^([#a-z0-9]{7,9},?){3}$'; then
  452. # # shellcheck disable=SC2086
  453. # { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; }
  454. #
  455. # # shellcheck disable=SC2046
  456. # eval $(awk "BEGIN { printf \"battery_vbar_fg=$%d\", (($charge) - 0.001) * $# + 1 }")
  457. # fi
  458. #
  459. # eval set -- "▁ ▂ ▃ ▄ ▅ ▆ ▇ █"
  460. # # shellcheck disable=SC2046
  461. # eval $(awk "BEGIN { printf \"battery_vbar_symbol=$%d\", ($charge) * ($# - 1) + 1 }")
  462. # battery_vbar="#[fg=${battery_vbar_fg?}]${battery_vbar_symbol?}"
  463. #
  464. # battery_percentage="$(awk "BEGIN { printf \"%.0f%%\", ($charge) * 100 }")"
  465. #
  466. # tmux set -g '@battery_status' "$battery_status" \;\
  467. # set -g '@battery_bar' "$battery_bar" \;\
  468. # set -g '@battery_hbar' "$battery_hbar" \;\
  469. # set -g '@battery_vbar' "$battery_vbar" \;\
  470. # set -g '@battery_percentage' "$battery_percentage"
  471. # }
  472. #
  473. # _tty_info() {
  474. # tty="${1##/dev/}"
  475. # uname -s | grep -q "CYGWIN" && cygwin=true
  476. #
  477. # if [ x"$cygwin" = x"true" ]; then
  478. # ps -af | tail -n +2 | awk -v tty="$tty" '
  479. # ((/ssh/ && !/-W/) || !/ssh/) && $4 == tty {
  480. # user[$2] = $1; parent[$2] = $3; child[$3] = $2
  481. # }
  482. # END {
  483. # for (i in user)
  484. # {
  485. # if (!(i in child) && parent[i] != 1)
  486. # {
  487. # file = "/proc/" i "/cmdline"; getline command < file; close(file)
  488. # gsub(/\0/, " ", command)
  489. # print i, user[i], command
  490. # exit
  491. # }
  492. # }
  493. # }
  494. # '
  495. # else
  496. # ps -t "$tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk '
  497. # NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) {
  498. # user[$2] = $1; parent[$2] = $3; child[$3] = $2; for (i = 4 ; i <= NF; ++i) command[$2] = i > 4 ? command[$2] FS $i : $i
  499. # }
  500. # END {
  501. # for (i in parent)
  502. # {
  503. # if (!(i in child) && parent[i] != 1)
  504. # {
  505. # print i, user[i], command[i]
  506. # exit
  507. # }
  508. # }
  509. # }
  510. # '
  511. # fi
  512. # }
  513. #
  514. # _ssh_or_mosh_args() {
  515. # args=$(printf '%s' "$1" | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }')
  516. # if [ -z "$args" ]; then
  517. # args=$(printf '%s' "$1" | grep 'mosh-client' | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g')
  518. # fi
  519. #
  520. # printf '%s' "$args"
  521. # }
  522. #
  523. # _username() {
  524. # tty=${1:-$(tmux display -p '#{pane_tty}')}
  525. # ssh_only=$2
  526. #
  527. # tty_info=$(_tty_info "$tty")
  528. # command=$(printf '%s' "$tty_info" | cut -d' ' -f3-)
  529. #
  530. # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command")
  531. # if [ -n "$ssh_or_mosh_args" ]; then
  532. # # shellcheck disable=SC2086
  533. # username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk 'NR > 2 { exit } ; /^user / { print $2 }')
  534. # # shellcheck disable=SC2086
  535. # [ -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 }')
  536. # else
  537. # if ! _is_enabled "$ssh_only"; then
  538. # username=$(printf '%s' "$tty_info" | cut -d' ' -f2)
  539. # fi
  540. # fi
  541. #
  542. # printf '%s' "$username"
  543. # }
  544. #
  545. # _hostname() {
  546. # tty=${1:-$(tmux display -p '#{pane_tty}')}
  547. # ssh_only=$2
  548. #
  549. # tty_info=$(_tty_info "$tty")
  550. # command=$(printf '%s' "$tty_info" | cut -d' ' -f3-)
  551. #
  552. # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command")
  553. # if [ -n "$ssh_or_mosh_args" ]; then
  554. # # shellcheck disable=SC2086
  555. # hostname=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk 'NR > 2 { exit } ; /^hostname / { print $2 }')
  556. # # shellcheck disable=SC2086
  557. # [ -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 }')
  558. # #shellcheck disable=SC1004
  559. # hostname=$(echo "$hostname" | awk '\
  560. # { \
  561. # if ($1~/^[0-9.:]+$/) \
  562. # print $1; \
  563. # else \
  564. # split($1, a, ".") ; print a[1] \
  565. # }')
  566. # else
  567. # if ! _is_enabled "$ssh_only"; then
  568. # hostname=$(command hostname -s)
  569. # fi
  570. # fi
  571. #
  572. # printf '%s' "$hostname"
  573. # }
  574. #
  575. # _root() {
  576. # tty=${1:-$(tmux display -p '#{pane_tty}')}
  577. # username=$(_username "$tty" false)
  578. #
  579. # if [ x"$username" = x"root" ]; then
  580. # tmux show -gqv '@root'
  581. # else
  582. # echo ""
  583. # fi
  584. # }
  585. #
  586. # _uptime() {
  587. # case $(uname -s) in
  588. # *Darwin*)
  589. # boot=$(sysctl -q -n kern.boottime | awk -F'[ ,:]+' '{ print $4 }')
  590. # now=$(date +%s)
  591. # ;;
  592. # *Linux*|*CYGWIN*|*MSYS*|*MINGW*)
  593. # boot=0
  594. # now=$(cut -d' ' -f1 < /proc/uptime)
  595. # ;;
  596. # *OpenBSD*)
  597. # boot=$(sysctl -n kern.boottime)
  598. # now=$(date +%s)
  599. # esac
  600. # # shellcheck disable=SC1004
  601. # awk -v boot="$boot" -v now="$now" '
  602. # BEGIN {
  603. # uptime = now - boot
  604. # y = int(uptime / 31536000)
  605. # dy = int(uptime / 86400) % 365
  606. # d = int(uptime / 86400)
  607. # h = int(uptime / 3600) % 24
  608. # m = int(uptime / 60) % 60
  609. # s = int(uptime) % 60
  610. #
  611. # system("tmux set -g @uptime_y " y + 0 " \\; " \
  612. # "set -g @uptime_dy " dy + 0 " \\; " \
  613. # "set -g @uptime_d " d + 0 " \\; " \
  614. # "set -g @uptime_h " h + 0 " \\; " \
  615. # "set -g @uptime_m " m + 0 " \\; " \
  616. # "set -g @uptime_s " s + 0)
  617. # }'
  618. # }
  619. #
  620. # _loadavg() {
  621. # case $(uname -s) in
  622. # *Darwin*)
  623. # tmux set -g @loadavg "$(sysctl -q -n vm.loadavg | cut -d' ' -f2)"
  624. # ;;
  625. # *Linux*)
  626. # tmux set -g @loadavg "$(cut -d' ' -f1 < /proc/loadavg)"
  627. # ;;
  628. # *OpenBSD*)
  629. # tmux set -g @loadavg "$(sysctl -q -n vm.loadavg | cut -d' ' -f1)"
  630. # ;;
  631. # esac
  632. # }
  633. #
  634. # _split_window() {
  635. # tty=${1:-$(tmux display -p '#{pane_tty}')}
  636. # shift
  637. #
  638. # tty_info=$(_tty_info "$tty")
  639. # command=$(printf '%s' "$tty_info" | cut -d' ' -f3-)
  640. #
  641. # case "$command" in
  642. # *mosh-client*)
  643. # # shellcheck disable=SC2046
  644. # tmux split-window "$@" mosh $(echo "$command" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/')
  645. # ;;
  646. # *ssh*)
  647. # # shellcheck disable=SC2046
  648. # tmux split-window "$@" $(echo "$command" | sed -e 's/;/\\;/g')
  649. # ;;
  650. # *)
  651. # tmux split-window "$@"
  652. # esac
  653. # }
  654. #
  655. # _apply_overrides() {
  656. # tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-false}
  657. # if _is_enabled "$tmux_conf_theme_24b_colour"; then
  658. # case "$TERM" in
  659. # screen-*|tmux-*)
  660. # ;;
  661. # *)
  662. # tmux set-option -ga terminal-overrides ",*256col*:Tc"
  663. # ;;
  664. # esac
  665. # fi
  666. # }
  667. #
  668. # _apply_bindings() {
  669. # cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT
  670. #
  671. # tmux list-keys | grep -vF 'tmux.conf.local' | grep -E '(new-window|split(-|_)window|new-session|copy-selection|copy-pipe)' > "$cfg"
  672. #
  673. # # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the
  674. # # output of list-keys can be truncated
  675. # perl -p -i -e "s/'#\{\?window_zoomed_flag,Unzoom,Zoom\}' 'z' \{resize-pane -$/'#{?window_zoomed_flag,Unzoom,Zoom}' 'z' {resize-pane -Z}\"/g" "$cfg"
  676. #
  677. # tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false}
  678. # if _is_enabled "$tmux_conf_new_window_retain_current_path"; then
  679. # perl -p -i \
  680. # -e "s/\b(new-window)\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/" \
  681. # -e ';' \
  682. # -e "s/\bnew-window\b(?!([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2))/new-window -c '#{pane_current_path}'/g" \
  683. # "$cfg"
  684. # else
  685. # perl -p -i -e "s/\bnew-window\b([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2)/new-window\1/g" "$cfg"
  686. # fi
  687. #
  688. # tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-false}
  689. # if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then
  690. # perl -p -i -e "s/\bsplit-window\b(?!([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2))/split-window -c '#{pane_current_path}'/g" "$cfg"
  691. # else
  692. # perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*?)(?:\s+-c\s+(\\\?\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" "$cfg"
  693. # fi
  694. #
  695. # tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false}
  696. # if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then
  697. # if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then
  698. # perl -p -i \
  699. # -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" \
  700. # -e ';' \
  701. # -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" \
  702. # "$cfg"
  703. # else
  704. # perl -p -i \
  705. # -e "s/\bsplit-window\b([^;}\n]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1'/g" \
  706. # -e ';' \
  707. # -e "s/\b_split_window\b\s+#\{pane_tty\}(.*?)\s+-c\s+\\\\\"#\{pane_current_path\}\\\\\"\"/_split_window #{pane_tty}\1\"/g" \
  708. # "$cfg"
  709. # fi
  710. # else
  711. # if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then
  712. # 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"
  713. # else
  714. # 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"
  715. # fi
  716. # fi
  717. #
  718. # tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false}
  719. # if _is_enabled "$tmux_conf_new_session_prompt"; then
  720. # perl -p -i \
  721. # -e "s/(?<!command-prompt -p )\b(new-session)\b(?!\s+-)/{$&}/g if /\bdisplay-menu\b/" \
  722. # -e ';' \
  723. # -e "s/(?<!\bcommand-prompt -p )\bnew-session\b(?! -s)/command-prompt -p new-session 'new-session -s \"%%\"'/g" \
  724. # "$cfg"
  725. # else
  726. # perl -p -i -e "s/\bcommand-prompt\s+-p\s+new-session\s+'new-session\s+-s\s+\"%%\"'/new-session/g" "$cfg"
  727. # fi
  728. #
  729. # tmux_conf_copy_to_os_clipboard=${tmux_conf_copy_to_os_clipboard:-false}
  730. # command -v pbcopy > /dev/null 2>&1 && command='pbcopy'
  731. # command -v reattach-to-user-namespace > /dev/null 2>&1 && command='reattach-to-user-namespace pbcopy'
  732. # command -v xsel > /dev/null 2>&1 && command='xsel -i -b'
  733. # ! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1 && command='xclip -i -selection clipboard > \/dev\/null 2>\&1'
  734. # command -v clip.exe > /dev/null 2>&1 && command='clip\.exe'
  735. # [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard'
  736. #
  737. # if [ -n "$command" ]; then
  738. # if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then
  739. # perl -p -i -e "s/\bcopy-selection(-and-cancel)?\b/copy-pipe\1 '$command'/g" "$cfg"
  740. # else
  741. # perl -p -i -e "s/\bcopy-pipe(-and-cancel)?\b\s+(\"|')?$command\2/copy-selection\1/g" "$cfg"
  742. # fi
  743. # fi
  744. #
  745. # # until tmux >= 3.0, output of tmux list-keys can't be consumed back by tmux source-file without applying some escapings
  746. # awk < "$cfg" \
  747. # '{i = $2 == "-T" ? 4 : 5; gsub(/^[;]$/, "\\\\&", $i); gsub(/^[$"#~]$/, "'"'"'&'"'"'", $i); gsub(/^['"'"']$/, "\"&\"", $i); print}' > "$cfg.in"
  748. #
  749. # # ignore bindings with errors
  750. # while ! out=$(tmux source-file "$cfg.in"); do
  751. # line=$(printf "%s" "$out" | cut -d':' -f2)
  752. # perl -n -i -e "if ($. != $line) { print }" "$cfg.in"
  753. # done
  754. # }
  755. #
  756. # _apply_theme() {
  757. #
  758. # # -- panes -------------------------------------------------------------
  759. #
  760. # tmux_conf_theme_window_fg=${tmux_conf_theme_window_fg:-default}
  761. # tmux_conf_theme_window_bg=${tmux_conf_theme_window_bg:-default}
  762. # tmux_conf_theme_highlight_focused_pane=${tmux_conf_theme_highlight_focused_pane:-false}
  763. # tmux_conf_theme_focused_pane_fg=${tmux_conf_theme_focused_pane_fg:-'default'} # default
  764. # tmux_conf_theme_focused_pane_bg=${tmux_conf_theme_focused_pane_bg:-'#0087d7'} # light blue
  765. #
  766. # # tmux 1.9 doesn't really like set -q
  767. # if tmux show -g -w | grep -q window-style; then
  768. # tmux setw -g window-style "fg=$tmux_conf_theme_window_fg,bg=$tmux_conf_theme_window_bg"
  769. #
  770. # if _is_enabled "$tmux_conf_theme_highlight_focused_pane"; then
  771. # tmux setw -g window-active-style "fg=$tmux_conf_theme_focused_pane_fg,bg=$tmux_conf_theme_focused_pane_bg"
  772. # else
  773. # tmux setw -g window-active-style default
  774. # fi
  775. # fi
  776. #
  777. # tmux_conf_theme_pane_border_style=${tmux_conf_theme_pane_border_style:-thin}
  778. # tmux_conf_theme_pane_border=${tmux_conf_theme_pane_border:-'#444444'} # light gray
  779. # tmux_conf_theme_pane_active_border=${tmux_conf_theme_pane_active_border:-'#00afff'} # light blue
  780. # tmux_conf_theme_pane_border_fg=${tmux_conf_theme_pane_border_fg:-$tmux_conf_theme_pane_border}
  781. # tmux_conf_theme_pane_active_border_fg=${tmux_conf_theme_pane_active_border_fg:-$tmux_conf_theme_pane_active_border}
  782. # case "$tmux_conf_theme_pane_border_style" in
  783. # fat)
  784. # tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-$tmux_conf_theme_pane_border_fg}
  785. # tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-$tmux_conf_theme_pane_active_border_fg}
  786. # ;;
  787. # thin|*)
  788. # tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-'default'}
  789. # tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-'default'}
  790. # ;;
  791. # esac
  792. # 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"
  793. #
  794. # tmux_conf_theme_pane_indicator=${tmux_conf_theme_pane_indicator:-'#00afff'} # light blue
  795. # tmux_conf_theme_pane_active_indicator=${tmux_conf_theme_pane_active_indicator:-'#00afff'} # light blue
  796. #
  797. # tmux set -g display-panes-colour "$tmux_conf_theme_pane_indicator" \; set -g display-panes-active-colour "$tmux_conf_theme_pane_active_indicator"
  798. #
  799. # # -- status line -------------------------------------------------------
  800. #
  801. # tmux_conf_theme_left_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_main-}")
  802. # tmux_conf_theme_left_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_sub-|}")
  803. # tmux_conf_theme_right_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_main-}")
  804. # tmux_conf_theme_right_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_sub-|}")
  805. #
  806. # tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-'#000000'} # black
  807. # tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-'#ffff00'} # yellow
  808. # tmux_conf_theme_message_attr=${tmux_conf_theme_message_attr:-'bold'}
  809. # tmux set -g message-style "fg=$tmux_conf_theme_message_fg,bg=$tmux_conf_theme_message_bg,$tmux_conf_theme_message_attr"
  810. #
  811. # tmux_conf_theme_message_command_fg=${tmux_conf_theme_message_command_fg:-'#ffff00'} # yellow
  812. # tmux_conf_theme_message_command_bg=${tmux_conf_theme_message_command_bg:-'#000000'} # black
  813. # tmux_conf_theme_message_command_attr=${tmux_conf_theme_message_command_attr:-'bold'}
  814. # 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"
  815. #
  816. # tmux_conf_theme_mode_fg=${tmux_conf_theme_mode_fg:-'#000000'} # black
  817. # tmux_conf_theme_mode_bg=${tmux_conf_theme_mode_bg:-'#ffff00'} # yellow
  818. # tmux_conf_theme_mode_attr=${tmux_conf_theme_mode_attr:-'bold'}
  819. # tmux setw -g mode-style "fg=$tmux_conf_theme_mode_fg,bg=$tmux_conf_theme_mode_bg,$tmux_conf_theme_mode_attr"
  820. #
  821. # tmux_conf_theme_status_fg=${tmux_conf_theme_status_fg:-'#8a8a8a'} # white
  822. # tmux_conf_theme_status_bg=${tmux_conf_theme_status_bg:-'#080808'} # dark gray
  823. # tmux_conf_theme_status_attr=${tmux_conf_theme_status_attr:-'none'}
  824. # tmux set -g status-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\
  825. # set -g status-left-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\
  826. # set -g status-right-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr"
  827. #
  828. # tmux_conf_theme_terminal_title=${tmux_conf_theme_terminal_title:-'#h ❐ #S ● #I #W'}
  829. #
  830. # tmux_conf_theme_terminal_title=$(echo "$tmux_conf_theme_terminal_title" | sed \
  831. # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \
  832. # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \
  833. # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
  834. # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \
  835. # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
  836. # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
  837. # tmux set -g set-titles-string "$(_decode_unicode_escapes "$tmux_conf_theme_terminal_title")"
  838. #
  839. # tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-'#8a8a8a'} # white
  840. # tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-'#080808'} # dark gray
  841. # tmux_conf_theme_window_status_attr=${tmux_conf_theme_window_status_attr:-'none'}
  842. # tmux_conf_theme_window_status_format=${tmux_conf_theme_window_status_format:-'#I #W'}
  843. #
  844. # tmux_conf_theme_window_status_current_fg=${tmux_conf_theme_window_status_current_fg:-'#000000'} # black
  845. # tmux_conf_theme_window_status_current_bg=${tmux_conf_theme_window_status_current_bg:-'#00afff'} # light blue
  846. # tmux_conf_theme_window_status_current_attr=${tmux_conf_theme_window_status_current_attr:-'bold'}
  847. # tmux_conf_theme_window_status_current_format=${tmux_conf_theme_window_status_current_format:-'#I #W'}
  848. # if [ x"$(tmux show -g -v status-justify)" = x"right" ]; then
  849. # 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"
  850. # else
  851. # 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"
  852. # fi
  853. #
  854. # tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | 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 #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 #D)%g')
  861. # tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed \
  862. # -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \
  863. # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \
  864. # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
  865. # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \
  866. # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
  867. # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
  868. #
  869. # 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" \;\
  870. # setw -g window-status-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_format")" \;\
  871. # 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" \;\
  872. # setw -g window-status-current-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_current_format")"
  873. #
  874. # tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-'default'}
  875. # tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-'default'}
  876. # tmux_conf_theme_window_status_activity_attr=${tmux_conf_theme_window_status_activity_attr:-'underscore'}
  877. # 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"
  878. #
  879. # tmux_conf_theme_window_status_bell_fg=${tmux_conf_theme_window_status_bell_fg:-'#ffff00'} # yellow
  880. # tmux_conf_theme_window_status_bell_bg=${tmux_conf_theme_window_status_bell_bg:-'default'}
  881. # tmux_conf_theme_window_status_bell_attr=${tmux_conf_theme_window_status_bell_attr:-'blink,bold'}
  882. # 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"
  883. #
  884. # tmux_conf_theme_window_status_last_fg=${tmux_conf_theme_window_status_last_fg:-'#00afff'} # light blue
  885. # tmux_conf_theme_window_status_last_bg=${tmux_conf_theme_window_status_last_bg:-'default'}
  886. # tmux_conf_theme_window_status_last_attr=${tmux_conf_theme_window_status_last_attr:-'none'}
  887. # 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"
  888. #
  889. # # -- indicators
  890. #
  891. # tmux_conf_theme_pairing=${tmux_conf_theme_pairing:-'👓'} # U+1F453
  892. # tmux_conf_theme_pairing_fg=${tmux_conf_theme_pairing_fg:-'#e4e4e4'} # white
  893. # tmux_conf_theme_pairing_bg=${tmux_conf_theme_pairing_bg:-'none'}
  894. # tmux_conf_theme_pairing_attr=${tmux_conf_theme_pairing_attr:-'none'}
  895. #
  896. # tmux_conf_theme_prefix=${tmux_conf_theme_prefix:-'⌨'} # U+2328
  897. # tmux_conf_theme_prefix_fg=${tmux_conf_theme_prefix_fg:-'#e4e4e4'} # white
  898. # tmux_conf_theme_prefix_bg=${tmux_conf_theme_prefix_bg:-'none'}
  899. # tmux_conf_theme_prefix_attr=${tmux_conf_theme_prefix_attr:-'none'}
  900. #
  901. # tmux_conf_theme_root=${tmux_conf_theme_root:-'!'}
  902. # tmux_conf_theme_root_fg=${tmux_conf_theme_root_fg:-'none'}
  903. # tmux_conf_theme_root_bg=${tmux_conf_theme_root_bg:-'none'}
  904. # tmux_conf_theme_root_attr=${tmux_conf_theme_root_attr:-'bold,blink'}
  905. #
  906. # tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-'🔒'} # U+1F512
  907. # tmux_conf_theme_synchronized_fg=${tmux_conf_theme_synchronized_fg:-'none'}
  908. # tmux_conf_theme_synchronized_bg=${tmux_conf_theme_synchronized_bg:-'none'}
  909. # tmux_conf_theme_synchronized_attr=${tmux_conf_theme_synchronized_attr:-'none'}
  910. #
  911. # # -- status left style
  912. #
  913. # tmux_conf_theme_status_left=${tmux_conf_theme_status_left-' ❐ #S '}
  914. # tmux_conf_theme_status_left_fg=${tmux_conf_theme_status_left_fg:-'#000000,#e4e4e4,#e4e4e4'} # black, white , white
  915. # tmux_conf_theme_status_left_bg=${tmux_conf_theme_status_left_bg:-'#ffff00,#ff00af,#00afff'} # yellow, pink, white blue
  916. # tmux_conf_theme_status_left_attr=${tmux_conf_theme_status_left_attr:-'bold,none,none'}
  917. #
  918. # tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \
  919. # -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")
  920. #
  921. # tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \
  922. # -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")
  923. #
  924. # tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \
  925. # -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")
  926. #
  927. # tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \
  928. # -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")
  929. #
  930. # if [ -n "$tmux_conf_theme_status_left" ]; then
  931. # status_left=$(awk \
  932. # -v fg_="$tmux_conf_theme_status_left_fg" \
  933. # -v bg_="$tmux_conf_theme_status_left_bg" \
  934. # -v attr_="$tmux_conf_theme_status_left_attr" \
  935. # -v mainsep="$tmux_conf_theme_left_separator_main" \
  936. # -v subsep="$tmux_conf_theme_left_separator_sub" '
  937. # function subsplit(s, l, i, a, r)
  938. # {
  939. # l = split(s, a, ",")
  940. # for (i = 1; i <= l; ++i)
  941. # {
  942. # o = split(a[i], _, "(") - 1
  943. # c = split(a[i], _, ")") - 1
  944. # open += o - c
  945. # o_ = split(a[i], _, "{") - 1
  946. # c_ = split(a[i], _, "}") - 1
  947. # open_ += o_ - c_
  948. # o__ = split(a[i], _, "[") - 1
  949. # c__ = split(a[i], _, "]") - 1
  950. # open__ += o__ - c__
  951. #
  952. # if (i == l)
  953. # r = sprintf("%s%s", r, a[i])
  954. # else if (open || open_ || open__)
  955. # r = sprintf("%s%s,", r, a[i])
  956. # else
  957. # r = sprintf("%s%s#[fg=%s,bg=%s,%s]%s", r, a[i], fg[j], bg[j], attr[j], subsep)
  958. # }
  959. #
  960. # gsub(/#\[inherit\]/, sprintf("#[default]#[fg=%s,bg=%s,%s]", fg[j], bg[j], attr[j]), r)
  961. # return r
  962. # }
  963. # BEGIN {
  964. # FS = "|"
  965. # l1 = split(fg_, fg, ",")
  966. # l2 = split(bg_, bg, ",")
  967. # l3 = split(attr_, attr, ",")
  968. # l = l1 < l2 ? (l1 < l3 ? l1 : l3) : (l2 < l3 ? l2 : l3)
  969. # }
  970. # {
  971. # for (i = j = 1; i <= NF; ++i)
  972. # {
  973. # if (open || open_ || open__)
  974. # printf "|%s", subsplit($i)
  975. # else
  976. # {
  977. # if (i > 1)
  978. # 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)
  979. # else
  980. # printf "#[fg=%s,bg=%s,%s]%s", fg[j], bg[j], attr[j], subsplit($i)
  981. # }
  982. #
  983. # if (!open && !open_ && !open__)
  984. # {
  985. # j_ = j
  986. # j = j % l + 1
  987. # }
  988. # }
  989. # printf "#[fg=%s,bg=%s,none]%s", bg[j_], "default", mainsep
  990. # }' << EOF
  991. # $tmux_conf_theme_status_left
  992. # EOF
  993. # )
  994. # fi
  995. #
  996. # status_left="$status_left "
  997. #
  998. # # -- status right style
  999. #
  1000. # tmux_conf_theme_status_right=${tmux_conf_theme_status_right-'#{pairing}#{prefix} #{battery_status} #{battery_bar} #{battery_percentage} , %R , %d %b | #{username} | #{hostname} '}
  1001. # tmux_conf_theme_status_right_fg=${tmux_conf_theme_status_right_fg:-'#8a8a8a,#e4e4e4,#000000'} # light gray, white, black
  1002. # tmux_conf_theme_status_right_bg=${tmux_conf_theme_status_right_bg:-'#080808,#d70000,#e4e4e4'} # dark gray, red, white
  1003. # tmux_conf_theme_status_right_attr=${tmux_conf_theme_status_right_attr:-'none,none,bold'}
  1004. #
  1005. # tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \
  1006. # -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")
  1007. #
  1008. # tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \
  1009. # -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")
  1010. #
  1011. # tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \
  1012. # -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")
  1013. #
  1014. # tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \
  1015. # -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")
  1016. #
  1017. # if [ -n "$tmux_conf_theme_status_right" ]; then
  1018. # status_right=$(awk \
  1019. # -v fg_="$tmux_conf_theme_status_right_fg" \
  1020. # -v bg_="$tmux_conf_theme_status_right_bg" \
  1021. # -v attr_="$tmux_conf_theme_status_right_attr" \
  1022. # -v mainsep="$tmux_conf_theme_right_separator_main" \
  1023. # -v subsep="$tmux_conf_theme_right_separator_sub" '
  1024. # function subsplit(s, l, i, a, r)
  1025. # {
  1026. # l = split(s, a, ",")
  1027. # for (i = 1; i <= l; ++i)
  1028. # {
  1029. # o = split(a[i], _, "(") - 1
  1030. # c = split(a[i], _, ")") - 1
  1031. # open += o - c
  1032. # o_ = split(a[i], _, "{") - 1
  1033. # c_ = split(a[i], _, "}") - 1
  1034. # open_ += o_ - c_
  1035. # o__ = split(a[i], _, "[") - 1
  1036. # c__ = split(a[i], _, "]") - 1
  1037. # open__ += o__ - c__
  1038. #
  1039. # if (i == l)
  1040. # r = sprintf("%s%s", r, a[i])
  1041. # else if (open || open_ || open__)
  1042. # r = sprintf("%s%s,", r, a[i])
  1043. # else
  1044. # r = sprintf("%s%s#[fg=%s,bg=%s,%s]%s", r, a[i], fg[j], bg[j], attr[j], subsep)
  1045. # }
  1046. #
  1047. # gsub(/#\[inherit\]/, sprintf("#[default]#[fg=%s,bg=%s,%s]", fg[j], bg[j], attr[j]), r)
  1048. # return r
  1049. # }
  1050. # BEGIN {
  1051. # FS = "|"
  1052. # l1 = split(fg_, fg, ",")
  1053. # l2 = split(bg_, bg, ",")
  1054. # l3 = split(attr_, attr, ",")
  1055. # l = l1 < l2 ? (l1 < l3 ? l1 : l3) : (l2 < l3 ? l2 : l3)
  1056. # }
  1057. # {
  1058. # for (i = j = 1; i <= NF; ++i)
  1059. # {
  1060. # if (open_ || open || open__)
  1061. # printf "|%s", subsplit($i)
  1062. # else
  1063. # 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)
  1064. #
  1065. # if (!open && !open_ && !open__)
  1066. # {
  1067. # j_ = j
  1068. # j = j % l + 1
  1069. # }
  1070. # }
  1071. # }' << EOF
  1072. # $tmux_conf_theme_status_right
  1073. # EOF
  1074. # )
  1075. # fi
  1076. #
  1077. # # -- variables
  1078. #
  1079. # tmux set -g '@root' "$tmux_conf_theme_root"
  1080. #
  1081. # tmux_conf_battery_bar_symbol_full=${tmux_conf_battery_bar_symbol_full:-'◼'}
  1082. # tmux_conf_battery_bar_symbol_empty=${tmux_conf_battery_bar_symbol_empty:-'◻'}
  1083. # tmux_conf_battery_bar_length=${tmux_conf_battery_bar_length:-'auto'}
  1084. # tmux_conf_battery_bar_palette=${tmux_conf_battery_bar_palette:-'gradient'}
  1085. # tmux_conf_battery_hbar_palette=${tmux_conf_battery_hbar_palette:-'gradient'} # red, orange, green
  1086. # tmux_conf_battery_vbar_palette=${tmux_conf_battery_vbar_palette:-'gradient'} # red, orange, green
  1087. # tmux_conf_battery_status_charging=${tmux_conf_battery_status_charging:-'↑'} # U+2191
  1088. # tmux_conf_battery_status_discharging=${tmux_conf_battery_status_discharging:-'↓'} # U+2193
  1089. #
  1090. # case "$status_left $status_right" in
  1091. # *'#{battery_status}'*|*'#{battery_bar}'*|*'#{battery_hbar}'*|*'#{battery_vbar}'*|*'#{battery_percentage}'*)
  1092. # status_left=$(echo "$status_left" | sed -E \
  1093. # -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \
  1094. # -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \
  1095. # -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \
  1096. # -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \
  1097. # -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g')
  1098. # status_right=$(echo "$status_right" | sed -E \
  1099. # -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \
  1100. # -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \
  1101. # -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \
  1102. # -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \
  1103. # -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g')
  1104. #
  1105. # tmux set -g '@battery_bar_symbol_full' "$(_decode_unicode_escapes "$tmux_conf_battery_bar_symbol_full")" \;\
  1106. # set -g '@battery_bar_symbol_empty' "$(_decode_unicode_escapes "$tmux_conf_battery_bar_symbol_empty")" \;\
  1107. # set -g '@battery_bar_length' "$tmux_conf_battery_bar_length" \;\
  1108. # set -g '@battery_bar_palette' "$tmux_conf_battery_bar_palette" \;\
  1109. # set -g '@battery_hbar_palette' "$tmux_conf_battery_hbar_palette" \;\
  1110. # set -g '@battery_vbar_palette' "$tmux_conf_battery_vbar_palette" \;\
  1111. # set -g '@battery_status_charging' "$(_decode_unicode_escapes "$tmux_conf_battery_status_charging")" \;\
  1112. # set -g '@battery_status_discharging' "$(_decode_unicode_escapes "$tmux_conf_battery_status_discharging")"
  1113. # status_right="#(cut -c3- ~/.tmux.conf | sh -s _battery)$status_right"
  1114. # ;;
  1115. # esac
  1116. #
  1117. # case "$status_left $status_right" in
  1118. # *'#{username}'*|*'#{hostname}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*)
  1119. # status_left=$(echo "$status_left" | sed \
  1120. # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
  1121. # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \
  1122. # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
  1123. # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
  1124. # status_right=$(echo "$status_right" | sed \
  1125. # -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
  1126. # -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \
  1127. # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
  1128. # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
  1129. # ;;
  1130. # esac
  1131. #
  1132. # case "$status_left $status_right" in
  1133. # *'#{uptime_d}'*|*'#{uptime_h}'*|*'#{uptime_m}'*|*'#{uptime_s}'*)
  1134. # status_left=$(echo "$status_left" | sed -E \
  1135. # -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \
  1136. # -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \
  1137. # -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \
  1138. # -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \
  1139. # -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \
  1140. # -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g')
  1141. # status_right=$(echo "$status_right" | sed -E \
  1142. # -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \
  1143. # -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \
  1144. # -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \
  1145. # -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \
  1146. # -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \
  1147. # -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g')
  1148. # status_right="#(cut -c3- ~/.tmux.conf | sh -s _uptime)$status_right"
  1149. # ;;
  1150. # esac
  1151. #
  1152. # case "$status_left $status_right" in
  1153. # *'#{loadavg}'*)
  1154. # status_left=$(echo "$status_left" | sed -E \
  1155. # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g')
  1156. # status_right=$(echo "$status_right" | sed -E \
  1157. # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g')
  1158. # status_right="#(cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right"
  1159. # ;;
  1160. # esac
  1161. #
  1162. # status_left=$(echo "$status_left" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
  1163. # status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
  1164. #
  1165. # tmux set -g status-left-length 1000 \; set -g status-left "$(_decode_unicode_escapes "$status_left")" \;\
  1166. # set -g status-right-length 1000 \; set -g status-right "$(_decode_unicode_escapes "$status_right")"
  1167. #
  1168. # # -- clock -------------------------------------------------------------
  1169. #
  1170. # tmux_conf_theme_clock_colour=${tmux_conf_theme_clock_colour:-'#00afff'} # light blue
  1171. # tmux_conf_theme_clock_style=${tmux_conf_theme_clock_style:-'24'}
  1172. # tmux setw -g clock-mode-colour "$tmux_conf_theme_clock_colour" \;\
  1173. # setw -g clock-mode-style "$tmux_conf_theme_clock_style"
  1174. # }
  1175. #
  1176. # _apply_configuration() {
  1177. #
  1178. # if ! command -v perl > /dev/null 2>&1; then
  1179. # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires perl" \; set -u display-time'
  1180. # return
  1181. # fi
  1182. # if ! command -v sed > /dev/null 2>&1; then
  1183. # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires sed" \; set -u display-time'
  1184. # return
  1185. # fi
  1186. # if ! command -v awk > /dev/null 2>&1; then
  1187. # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time'
  1188. # return
  1189. # fi
  1190. #
  1191. # # see https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
  1192. # if command -v reattach-to-user-namespace > /dev/null 2>&1; then
  1193. # default_shell="$(tmux show -gv default-shell)"
  1194. # case "$default_shell" in
  1195. # *fish)
  1196. # tmux set -g default-command "reattach-to-user-namespace -l $default_shell"
  1197. # ;;
  1198. # *sh)
  1199. # tmux set -g default-command "exec $default_shell... 2> /dev/null & reattach-to-user-namespace -l $default_shell"
  1200. # ;;
  1201. # esac
  1202. # fi
  1203. #
  1204. # _apply_overrides
  1205. # _apply_bindings
  1206. # _apply_theme
  1207. # for name in $(printenv | grep -E -o '^tmux_conf_[^=]+'); do tmux setenv -gu "$name"; done;
  1208. # }
  1209. #
  1210. # _urlview() {
  1211. # tmux capture-pane -J -S - -E - -b "urlview-$1" -t "$1"
  1212. # tmux split-window "tmux show-buffer -b urlview-$1 | urlview || true; tmux delete-buffer -b urlview-$1"
  1213. # }
  1214. #
  1215. # _fpp() {
  1216. # tmux capture-pane -J -S - -E - -b "fpp-$1" -t "$1"
  1217. # tmux split-window "tmux show-buffer -b fpp-$1 | fpp || true; tmux delete-buffer -b fpp-$1"
  1218. # }
  1219. #
  1220. # "$@"
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×