UY-Scuti

Untitled

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