my dotfiles
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: add dotfiles and configuration files for development environment setup

feat(tmux): add custom configuration and window icon scripts

+2169
+5
.gitattributes
··· 1 + # set .tishrc files to be detected as Lua 2 + .tishrc linguist-language=Lua 3 + 4 + # set .zprofile files to be detected as Shell (Zsh) 5 + .zprofile linguist-language=Shell
.hushlogin

This is a binary file and will not be displayed.

+44
.tishrc
··· 1 + config.use_tish_ls = true 2 + 3 + local pmc_ver <const> = sys.eval_to_str("pmc --version") 4 + env.pmc_version = pmc_ver:match("pmc (%d+%.%d+%.%d+)") 5 + 6 + -- prompt 7 + config.prompt = [[ 8 + {let docker_conn = cmd('docker context show')} 9 + {let version = cmd('docker --version') | match('Docker version (\d+\.\d+\.\d+)', 1)} 10 + 11 + \n<s.b><s.#5EFDFF>{path-folder}</s>{' '} 12 + 13 + {if git.in-repo { 14 + <s.b>in <s.{ 15 + if git.working.changed || git.staging.changed { #FFEB3B } 16 + else if git.ahead > 0 && git.behind > 0 { #FFCC80 } 17 + else if git.ahead > 0 { #B388FF } 4 18 + else if git.behind > 0 { #B388FB } else { #FF94DF } 19 + }> {git.branch} {git.status}</s> 20 + }} 21 + 22 + <s.b>on <s.#5EFDFF>󰡨 v{version} ({docker_conn})</s> 23 + <s.b>\n<s.#57E15D>➜</s>{' '} 24 + ]] 25 + 26 + -- functions 27 + 28 + function example_lua(arg1, arg2) 29 + print("arg1: " .. arg1 .. "\narg2: " .. arg2) 30 + end 31 + 32 + function meower(count) 33 + count = count or 1 34 + for i = 1, count do 35 + print("meow") 36 + end 37 + end 38 + 39 + -- aliases 40 + 41 + alias.kat = "bat" 42 + alias.ls = "ls -l" 43 + alias.exe = "example_lua 1" 44 + alias.exe2 = "exe 1"
+19
.zprofile
··· 1 + # mise runtimes manager 2 + eval "$(mise activate zsh)" 3 + eval "$(mise hook-env)" 4 + 5 + # set PATH, MANPATH, etc., for Homebrew. 6 + eval "$(/opt/homebrew/bin/brew shellenv)" 7 + 8 + # bun runtime 9 + export BUN_INSTALL="$HOME/.bun" 10 + export PATH="$BUN_INSTALL/bin:$PATH" 11 + 12 + # jetbrains toolbox 13 + export PATH="$PATH:/Users/themackabu/Library/Application Support/JetBrains/Toolbox/scripts" 14 + 15 + # Virtualization.framework cli 16 + export VMCTLDIR="$HOME/Documents/vm" 17 + 18 + # golang modules 19 + export GOPATH="$HOME/.local/share/go"
+46
assets/boykisser.cow
··· 1 + # boykisser 2 + # by themackabu 3 + 4 + $x = "\e[49m "; #reset color 5 + $t = "$thoughts "; 6 + $a = "\e[48;5;231m "; 7 + $b = "\e[48;5;204m "; 8 + $c = "\e[48;5;89m "; 9 + $d = "\e[48;5;125m "; 10 + $e = "\e[48;5;251m "; 11 + $f = "\e[48;5;102m "; 12 + 13 + $the_cow = <<EOC 14 + $t 15 + $a$x$t $a$x 16 + $a $x $a $x 17 + $a $x $a $x 18 + $a $x $a$x $a $x 19 + $a $x $a $x $a $x 20 + $a $x $a $x $a $x 21 + $a $x $a $x $a $x 22 + $a $x$a $x$a $x 23 + $a $x$a $x$a $x 24 + $a $x $a $x 25 + $a $x 26 + $a $x $a $x $a $x 27 + $a $x$a $x$a $x$a $x $a $x 28 + $a $x$a $x $a $x $a $x$a $x 29 + $a $x$a$x $a $x $a$x$a$x 30 + $a$x$a $x $a $x $a $x$a$x 31 + $a$x$a $x$a $x $a $x $a$x$a $x$a$x 32 + $a $x$a $x $a $x $a$x$a $x 33 + $a $x$a $x $a $x $a$x$a $x 34 + $a $x $a $x 35 + $a $b$a$b$a $x$a $b$a$b$a $x 36 + $a $x $a$b$a$b$a $x $a$b$a$b$a$x $a $x 37 + $a $x$c$d$x$a $x 38 + $a $x $a $x 39 + $a$e$x $a $x $e$x 40 + $a $e $a$e$f $e$a$e $a $x 41 + $a $e $a $x 42 + $a $x 43 + $a $x 44 + $a $x 45 + $a $x 46 + EOC
+97
assets/crates.toml
··· 1 + [v1] 2 + "battop 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = ["battop"] 3 + "bend-lang 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)" = ["bend"] 4 + "bottom 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = ["btm"] 5 + "bunyan 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = ["bunyan"] 6 + "cargo-bundle 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-bundle"] 7 + "cargo-cache 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-cache"] 8 + "cargo-chef 0.1.68 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-chef"] 9 + "cargo-clean-all 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-clean-all"] 10 + "cargo-clicker 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-clicker"] 11 + "cargo-clone 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-clone"] 12 + "cargo-edit 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = [ 13 + "cargo-add", 14 + "cargo-rm", 15 + "cargo-set-version", 16 + "cargo-upgrade", 17 + ] 18 + "cargo-expand 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-expand"] 19 + "cargo-generate 0.23.3 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-generate"] 20 + "cargo-machete 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-machete"] 21 + "cargo-mommy 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-mommy"] 22 + "cargo-pgo 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-pgo"] 23 + "cargo-release 0.25.14 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-release"] 24 + "cargo-space 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-space"] 25 + "cargo-udeps 0.1.53 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-udeps"] 26 + "cargo-updater 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-updater"] 27 + "cargo-upgrades 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-upgrades"] 28 + "cargo-validate 0.2.0 (path+file:///Users/themackabu/Developer/rust/cargo-publish)" = ["cargo-validate"] 29 + "cargo-wizard 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-wizard"] 30 + "cargo-zigbuild 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-zigbuild"] 31 + "compiler 0.1.0 (git+https://github.com/borgo-lang/borgo.git#3b9f01578941fb00ed93756e2fadc009feb50128)" = ["compiler"] 32 + "coreutils 0.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = ["coreutils"] 33 + "cotton 0.1.0 (git+https://github.com/danielhuang/cotton#4de9b5d6a0b22b93877ebc8996c12a6972a5b396)" = ["cotton"] 34 + "cpu-stress-test 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["cpu-stress-test"] 35 + "cross 0.2.5 (git+https://github.com/cross-rs/cross#49338b18fdb82dedb2a813664e2e565ca73e2047)" = [ 36 + "cross", 37 + "cross-util", 38 + ] 39 + "depth 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = ["depth"] 40 + "diesel_cli 2.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = ["diesel"] 41 + "diesel_cli_ext 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = ["diesel_ext"] 42 + "dufs 0.43.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["dufs"] 43 + "eza 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)" = ["eza"] 44 + "fd-find 10.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["fd"] 45 + "ferris-fetch 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = ["ferris-fetch"] 46 + "flamegraph 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = [ 47 + "cargo-flamegraph", 48 + "flamegraph", 49 + ] 50 + "fleet-rs 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = [ 51 + "cargo-fleet", 52 + "fleet", 53 + ] 54 + "ghostty_animation 0.1.0 (path+file:///Users/themackabu/Downloads/ghostty-animation-command)" = ["ghostty_animation"] 55 + "git-cliff 2.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = [ 56 + "git-cliff", 57 + "git-cliff-completions", 58 + "git-cliff-mangen", 59 + ] 60 + "gitoxide 0.39.0 (registry+https://github.com/rust-lang/crates.io-index)" = [ 61 + "ein", 62 + "gix", 63 + ] 64 + "gitu 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["gitu"] 65 + "golduck 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = ["golduck"] 66 + "hvm 2.0.22 (registry+https://github.com/rust-lang/crates.io-index)" = ["hvm"] 67 + "kade 0.0.1 (path+file:///Users/themackabu/Developer/rust/playground/db/crates/kade)" = [ 68 + "kade-cli", 69 + "kade-server", 70 + ] 71 + "loc 0.5.0 (git+https://github.com/cgag/loc.git#1e0c7f434ddfd51439e1d4eb126f31b7a04229d9)" = ["loc"] 72 + "loft 0.0.1-alpha.17 (path+file:///Users/themackabu/Developer/rust/loft)" = ["loft"] 73 + "mdcat 2.5.0 (git+https://github.com/swsnr/mdcat.git#01a75dbb6ffd9b830cf426ffe218ef7e4fb4dad6)" = ["mdcat"] 74 + "meow-editor 1.4.0 (path+file:///Users/themackabu/Developer/rust/playground/editor)" = ["meow"] 75 + "mhv 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = ["mhv"] 76 + "miniserve 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["miniserve"] 77 + "natls 2.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = ["natls"] 78 + "ns 0.1.0 (path+file:///Users/themackabu/Developer/rust/node-system)" = ["ns"] 79 + "onefetch 2.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["onefetch"] 80 + "pumas 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = ["pumas"] 81 + "rgssad 0.2.0 (git+https://github.com/luxrck/rgssad.git#0b74de8d8588b5e1acd86edaede7d364b279c9be)" = ["rgssad"] 82 + "ripgrep 14.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = ["rg"] 83 + "rnp 0.1.146 (registry+https://github.com/rust-lang/crates.io-index)" = [ 84 + "rnp", 85 + "rnp_server", 86 + ] 87 + "rust-ls 0.1.0 (path+file:///Users/themackabu/Developer/rust/ls)" = ["rust-ls"] 88 + "sccache 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["sccache"] 89 + "tauri-cli 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-tauri"] 90 + "thokr 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = ["thokr"] 91 + "tish 0.5.2 (path+file:///Users/themackabu/Downloads/tish)" = ["tish"] 92 + "volt-cli 0.2.1 (path+file:///Users/themackabu/Developer/rust/volt/crates/volt)" = ["volt"] 93 + "warp-cors 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["warp-cors"] 94 + "worker-build 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = [ 95 + "worker-build", 96 + "worker-codegen", 97 + ]
+3
assets/rustfmt.toml
··· 1 + max_width = 200 2 + fn_params_layout = "Compressed" 3 + fn_single_line = true
+159
bin/generate_cover
··· 1 + #!/bin/bash 2 + 3 + # usage: ./generate_cover.sh "url" [--title "Custom Title"] [--artist "Custom Artist"] [--date "YYYY"] 4 + 5 + # parse command line arguments 6 + CUSTOM_TITLE="" 7 + CUSTOM_ARTIST="" 8 + CUSTOM_DATE="" 9 + URL="" 10 + 11 + while [[ $# -gt 0 ]]; do 12 + case $1 in 13 + --title) 14 + CUSTOM_TITLE="$2" 15 + shift 2 16 + ;; 17 + --artist) 18 + CUSTOM_ARTIST="$2" 19 + shift 2 20 + ;; 21 + --date) 22 + CUSTOM_DATE="$2" 23 + shift 2 24 + ;; 25 + *) 26 + if [ -z "$URL" ]; then 27 + URL="$1" 28 + fi 29 + shift 30 + ;; 31 + esac 32 + done 33 + 34 + if [ -z "$URL" ]; then 35 + echo "Error: URL is required" 36 + echo "Usage: ./generate_video.sh \"url\" [--title \"Custom Title\"] [--artist \"Custom Artist\"] [--date \"YYYY\"]" 37 + exit 1 38 + fi 39 + 40 + # function to convert to snake_case 41 + to_snake_case() { 42 + echo "$1" | tr '[:upper:]' '[:lower:]' | \ 43 + sed -e 's/[^a-zA-Z0-9]/_/g' -e 's/__*/_/g' -e 's/^_//' -e 's/_$//' 44 + } 45 + 46 + # function to sanitize text for ImageMagick 47 + sanitize() { 48 + echo "$1" | sed 's/"/\\"/g' 49 + } 50 + 51 + # function to truncate text 52 + truncate_text() { 53 + local text="$1" 54 + if [ ${#text} -gt 50 ]; then 55 + echo "${text:0:47}..." 56 + else 57 + echo "$text" 58 + fi 59 + } 60 + 61 + # function to process title 62 + process_title() { 63 + local title="$1" 64 + # remove everything before the hyphen if it exists, and trim whitespace 65 + if [[ "$title" == *-* ]]; then 66 + title=$(echo "$title" | sed 's/^.*- *//') 67 + fi 68 + # remove everything after the colon if it exists, and trim whitespace 69 + if [[ "$title" == *:* ]]; then 70 + title=$(echo "$title" | sed 's/:.*//') 71 + fi 72 + 73 + # clean up common video title elements 74 + title=$(echo "$title" | sed -E ' 75 + s/\[[^]]*\]//g; 76 + s/\([^)]*\)//g; 77 + s/(HD|4K|8K|HQ|Official|Music Video)//gi; 78 + s/[0-9]+p//gi; 79 + s/High Quality//gi; 80 + s/Official Video//gi; 81 + s/Lyrics?//gi; 82 + s/[[:space:]]+/ /g; 83 + s/^[[:space:]]+//; 84 + s/[[:space:]]+$//') 85 + 86 + echo "$title" 87 + } 88 + 89 + process_artist() { 90 + local artist="$1" 91 + # remove "- Topic" if it exists 92 + echo "$artist" | sed 's/ - Topic$//' 93 + } 94 + 95 + # get the title to check if file exists 96 + echo "Checking metadata..." 97 + TITLE=$(yt-dlp --get-title "$URL") 98 + TITLE=$(process_title "$TITLE") 99 + # Use custom title if provided 100 + if [ -n "$CUSTOM_TITLE" ]; then 101 + TITLE="$CUSTOM_TITLE" 102 + fi 103 + TITLE_TRUNCATED=$(truncate_text "$TITLE") 104 + FILENAME=$(to_snake_case "$TITLE_TRUNCATED") 105 + 106 + # check if file exists 107 + if [ -f "${FILENAME}.mp4" ]; then 108 + echo "Error: ${FILENAME}.mp4 already exists" 109 + exit 1 110 + fi 111 + 112 + # download audio 113 + echo "Downloading audio..." 114 + yt-dlp -f bestaudio --extract-audio --audio-format mp3 --output "temp_audio.%(ext)s" --print-json "$URL" > metadata.json 2>/dev/null 115 + ARTIST=$(cat metadata.json | jq -r '.uploader') 116 + ARTIST=$(process_artist "$ARTIST") 117 + # Use custom artist if provided 118 + if [ -n "$CUSTOM_ARTIST" ]; then 119 + ARTIST="$CUSTOM_ARTIST" 120 + fi 121 + 122 + YEAR=$(cat metadata.json | jq -r '.upload_date[0:4]') 123 + # Use custom date if provided 124 + if [ -n "$CUSTOM_DATE" ]; then 125 + YEAR="$CUSTOM_DATE" 126 + fi 127 + 128 + DURATION=$(cat metadata.json | jq -r '.duration') 129 + rm metadata.json 130 + 131 + # format duration with leading space for single-digit minutes 132 + MINUTES=$((DURATION/60)) 133 + if [ $MINUTES -lt 10 ]; then 134 + DURATION_FORMATTED=$(printf "​ %d:%02d" $MINUTES $((DURATION%60))) 135 + else 136 + DURATION_FORMATTED=$(printf "%d:%02d" $MINUTES $((DURATION%60))) 137 + fi 138 + 139 + # download thumbnail 140 + echo "Downloading thumbnail..." 141 + yt-dlp --write-thumbnail --skip-download --convert-thumbnails jpg "$URL" -o "temp_thumb" 2>/dev/null 142 + 143 + # create title card using the external script 144 + echo "Generating title card..." 145 + create_title_card temp_thumb.jpg "$(sanitize "$TITLE_TRUNCATED")" "$(sanitize "$ARTIST")" "$YEAR" "$DURATION_FORMATTED" 146 + 147 + # create MP4 with title card and audio 148 + echo "Creating final video..." 149 + ffmpeg -loop 1 -i output_title_card.png -i temp_audio.mp3 \ 150 + -c:v libx264 -preset ultrafast -tune stillimage \ 151 + -c:a aac -b:a 192k -pix_fmt yuv420p \ 152 + -shortest \ 153 + -movflags +faststart \ 154 + "${FILENAME}.mp4" 2>/dev/null 155 + 156 + # clean up temporary files 157 + rm temp_thumb.jpg output_title_card.png temp_audio.mp3 158 + 159 + echo "Done! Created ${FILENAME}.mp4"
+22
pmc/config.toml
··· 1 + default = "local" 2 + 3 + [runner] 4 + shell = "/bin/sh" 5 + args = ["-c"] 6 + node = "node" 7 + log_path = "/Users/themackabu/.pmc/logs" 8 + 9 + [daemon] 10 + restarts = 10 11 + interval = 1000 12 + kind = "default" 13 + 14 + [daemon.web] 15 + ui = false 16 + api = false 17 + address = "localhost" 18 + port = 5630 19 + 20 + [daemon.web.secure] 21 + enabled = false 22 + token = "testing123"
+1741
tmux/config.conf
··· 1 + # : << 'EOF' 2 + 3 + # -- general ------------------------------------------------------------------- 4 + 5 + set -g default-terminal "screen-256color" 6 + 7 + %if #{>=:#{version},3.2} 8 + set -g extended-keys on # needed by Control + Shift bindings 9 + %endif 10 + set -s escape-time 10 # faster command sequences 11 + set -sg repeat-time 600 # increase repeat timeout 12 + set -s focus-events on 13 + 14 + set -g prefix2 C-a # GNU-Screen compatible prefix 15 + bind C-a send-prefix -2 16 + 17 + set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2) 18 + setw -q -g utf8 on 19 + 20 + set -g history-limit 5000 # boost history 21 + 22 + # edit configuration 23 + %if #{>=:#{version},3.0} 24 + bind e new-window -n "#{TMUX_CONF_LOCAL}" -e EDITOR="$EDITOR" sh -c 'case "${EDITOR:-vim}" in *vim*) ${EDITOR:-vim} -c ":set syntax=tmux" "$TMUX_CONF_LOCAL";; *) $EDITOR "$TMUX_CONF_LOCAL";; esac && "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"' 25 + %else 26 + set-environment -g EDITOR "$EDITOR" 27 + bind e new-window -n "#{TMUX_CONF_LOCAL}" sh -c 'case "${EDITOR:-vim}" in *vim*) ${EDITOR:-vim} -c ":set syntax=tmux" "$TMUX_CONF_LOCAL";; *) $EDITOR "$TMUX_CONF_LOCAL";; esac && "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"' 28 + %endif 29 + 30 + # reload configuration 31 + bind r run "sh -c '\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} source \"\$TMUX_CONF\"'" \; display "#{TMUX_CONF} sourced" 32 + 33 + 34 + # -- display ------------------------------------------------------------------- 35 + 36 + set -g base-index 1 # start windows numbering at 1 37 + setw -g pane-base-index 1 # make pane numbering consistent with windows 38 + 39 + setw -g automatic-rename on # rename window to reflect current program 40 + set -g renumber-windows on # renumber windows when a window is closed 41 + 42 + set -g set-titles on # set terminal title 43 + 44 + set -g display-panes-time 800 # slightly longer pane indicators display time 45 + set -g display-time 1000 # slightly longer status messages display time 46 + 47 + set -g status-interval 10 # redraw status line every 10 seconds 48 + 49 + # clear both screen and history 50 + bind -n C-l send-keys C-l \; run 'sleep 0.2' \; clear-history 51 + 52 + # activity 53 + set -g monitor-activity on 54 + set -g visual-activity off 55 + 56 + 57 + # -- navigation ---------------------------------------------------------------- 58 + 59 + # create session 60 + bind C-c new-session 61 + 62 + # find session 63 + bind C-f command-prompt -p find-session 'switch-client -t %%' 64 + 65 + # session navigation 66 + bind BTab switch-client -l # move to last session 67 + 68 + # split current window horizontally 69 + bind - split-window -v 70 + # split current window vertically 71 + bind _ split-window -h 72 + 73 + # pane navigation 74 + bind -r h select-pane -L # move left 75 + bind -r j select-pane -D # move down 76 + bind -r k select-pane -U # move up 77 + bind -r l select-pane -R # move right 78 + bind > swap-pane -D # swap current pane with the next one 79 + bind < swap-pane -U # swap current pane with the previous one 80 + 81 + # maximize current pane 82 + bind + run "cut -c3- '#{TMUX_CONF}' | sh -s _maximize_pane '#{session_name}' '#D'" 83 + 84 + # pane resizing 85 + bind -r H resize-pane -L 2 86 + bind -r J resize-pane -D 2 87 + bind -r K resize-pane -U 2 88 + bind -r L resize-pane -R 2 89 + 90 + # window navigation 91 + unbind n 92 + unbind p 93 + bind -r C-h previous-window # select previous window 94 + bind -r C-l next-window # select next window 95 + bind -r C-S-H swap-window -t -1 \; select-window -t -1 # swap current window with the previous one 96 + bind -r C-S-L swap-window -t +1 \; select-window -t +1 # swap current window with the next one 97 + bind Tab last-window # move to last active window 98 + 99 + # toggle mouse 100 + bind m run "cut -c3- '#{TMUX_CONF}' | sh -s _toggle_mouse" 101 + 102 + 103 + # -- facebook pathpicker ------------------------------------------------------- 104 + 105 + bind F run "cut -c3- '#{TMUX_CONF}' | sh -s _fpp '#{pane_id}' '#{pane_current_path}'" 106 + 107 + 108 + # -- copy mode ----------------------------------------------------------------- 109 + 110 + bind Enter copy-mode # enter copy mode 111 + 112 + bind -T copy-mode-vi v send -X begin-selection 113 + bind -T copy-mode-vi C-v send -X rectangle-toggle 114 + bind -T copy-mode-vi y send -X copy-selection-and-cancel 115 + bind -T copy-mode-vi Escape send -X cancel 116 + bind -T copy-mode-vi H send -X start-of-line 117 + bind -T copy-mode-vi L send -X end-of-line 118 + 119 + # copy to X11 clipboard 120 + if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | xsel -i -b"' 121 + if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"' 122 + # copy to Wayland clipboard 123 + if -b '[ "$XDG_SESSION_TYPE" = "wayland" ] && command -v wl-copy > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | wl-copy"' 124 + # copy to macOS clipboard 125 + if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | pbcopy"' 126 + # copy to Windows clipboard 127 + if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | clip.exe"' 128 + if -b '[ -c /dev/clipboard ]' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - > /dev/clipboard"' 129 + 130 + 131 + # -- buffers ------------------------------------------------------------------- 132 + 133 + bind b list-buffers # list paste buffers 134 + bind p paste-buffer -p # paste from the top paste buffer 135 + bind P choose-buffer # choose which buffer to paste from 136 + 137 + 138 + # -- 8< ------------------------------------------------------------------------ 139 + 140 + %if #{==:#{TMUX_PROGRAM},} 141 + run "exec sh -c 'TMUX_PROGRAM=\"\$(LSOF=\$(PATH=\"\$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin\" command -v lsof); \$LSOF -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e \"if (s/^n((?:.(?!dylib\$|so\$))+)\$/\\1/g && s/(?:\s+\\([^\\s]+?\\))?\$//g) { print; exit } } exit 1; {\" 2>/dev/null || readlink \"/proc/#{pid}/exe\" 2>/dev/null)\"; [ \"\$(\"\$TMUX_PROGRAM\" display -p \"#{l:#{pid}}\" 2>/dev/null)\" = \"#{pid}\" ] || TMUX_PROGRAM=\"\$(command -v tmux || printf tmux)\"; \"\$TMUX_PROGRAM\" -S #{socket_path} set-environment -g TMUX_PROGRAM \"\$TMUX_PROGRAM\"'" 142 + %endif 143 + %if #{==:#{TMUX_SOCKET},} 144 + run "exec sh -c '\"\$TMUX_PROGRAM\" -S #{socket_path} set-environment -g TMUX_SOCKET \"#{socket_path}\"'" 145 + %endif 146 + %if #{==:#{TMUX_CONF},} 147 + run "exec sh -c '\"\$TMUX_PROGRAM\" set-environment -g TMUX_CONF \$(for conf in \"\$HOME/.tmux.conf\" \"\$XDG_CONFIG_HOME/tmux/tmux.conf\" \"\$HOME/.config/tmux/tmux.conf\"; do [ -f \"\$conf\" ] && printf \"%s\" \"\$conf\" && break; done)'" 148 + %endif 149 + 150 + run '"$TMUX_PROGRAM" -S #{socket_path} source "$TMUX_CONF_LOCAL"' 151 + run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' 152 + 153 + set -g mouse on 154 + set -g status "on" 155 + set -g status-position top 156 + set -g status-justify "left" 157 + set -g status-style bg=default 158 + 159 + set -g status-left "#[fg=#84977f,bg=default,bold] █ session: #S" 160 + set -g status-right " #[fg=#828bb8,bg=default,bold] fluffy 󰁍  " 161 + 162 + setw -g window-status-format "#[bg=#171616,bg=default] #[fg=#495361,bg=default]#(~/.tmux/scripts/get-icons #I)󰁔 #W" 163 + setw -g window-status-current-format "#[bg=#171616,bg=default] #[fg=#7e93a9,bg=default,bold]#(~/.tmux/scripts/get-icons #I) #W" 164 + 165 + # EOF 166 + # 167 + # # exit the script if any statement returns a non-true return value 168 + # set -e 169 + # 170 + # unset SHELL 171 + # 172 + # unset GREP_OPTIONS 173 + # export LC_NUMERIC=C 174 + # # shellcheck disable=SC3041 175 + # if (set +H 2>/dev/null); then 176 + # set +H 177 + # fi 178 + # 179 + # if ! printf '' | sed -E 's///' 2>/dev/null; then 180 + # if printf '' | sed -r 's///' 2>/dev/null; then 181 + # sed() { 182 + # n=$#; while [ "$n" -gt 0 ]; do arg=$1; shift; case $arg in -E*) arg=-r${arg#-E};; esac; set -- "$@" "$arg"; n=$(( n - 1 )); done 183 + # command sed "$@" 184 + # } 185 + # fi 186 + # fi 187 + # 188 + # _uname_s=$(uname -s) 189 + # 190 + # [ -z "$TMUX" ] && exit 255 191 + # if [ -z "$TMUX_SOCKET" ]; then 192 + # TMUX_SOCKET=$(printf '%s' "$TMUX" | cut -d, -f1) 193 + # fi 194 + # if [ -z "$TMUX_PROGRAM" ]; then 195 + # TMUX_PID=$(printf '%s' "$TMUX" | cut -d, -f2) 196 + # TMUX_PROGRAM=$(lsof -b -w -a -d txt -p "$TMUX_PID" -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g) { print; exit } } exit 1; {" 2>/dev/null || readlink "/proc/$TMUX_PID/exe" 2>/dev/null) 197 + # [ "$("$TMUX_PROGRAM" -S "$TMUX_SOCKET" display -p '#{pid}' 2>/dev/null)" = "$TMUX_PID" ] || TMUX_PROGRAM=$(command -v tmux || printf tmux) 198 + # fi 199 + # if [ "$TMUX_PROGRAM" = "tmux" ]; then 200 + # tmux() { 201 + # command tmux ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} "$@" 202 + # } 203 + # else 204 + # tmux() { 205 + # "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} "$@" 206 + # } 207 + # fi 208 + # 209 + # _tmux_version=$(tmux -V | perl -n -e '($l, $r) = $_ =~ /^[^0-9]+([0-9.]+)([a-z])?(-rc.*)?$/; print $l * 1000 + ($r eq "" ? 0 : ord($r) - 96)') 210 + # 211 + # _is_true() { 212 + # case "$1" in 213 + # true|yes|1) 214 + # return 0 215 + # ;; 216 + # *) 217 + # return 1 218 + # ;; 219 + # esac 220 + # } 221 + # 222 + # _is_enabled() { 223 + # [ "$1" = "enabled" ] 224 + # } 225 + # 226 + # _is_disabled() { 227 + # [ "$1" = "disabled" ] 228 + # } 229 + # 230 + # _circled() { 231 + # circled_digits='⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳' 232 + # if [ "$1" -le 20 ] 2>/dev/null; then 233 + # i=$(( $1 + 1 )) 234 + # eval set -- "$circled_digits" 235 + # eval echo "\${$i}" 236 + # else 237 + # echo "$1" 238 + # fi 239 + # } 240 + # 241 + # _decode_unicode_escapes() { 242 + # 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 243 + # } 244 + # 245 + # _pretty_path() { 246 + # max_length=${1:-auto}; shift 247 + # if [ "$max_length" = "auto" ]; then 248 + # max_length=$(($(tmux -q display -p '#{client_width}') / 4)) 249 + # fi 250 + # { cd "$*" && pwd || printf '%s' "$*"; } | perl -s -p -E 's|^$HOME|~|; /^.{0,$max_length}$/ || s|(~?\/[^/]+)(/[^/]+)(?:/.+)(/[^/]+)$|$1$2/...$3|g' -- -HOME="$HOME" -max_length="$max_length" 251 + # } 252 + # 253 + # if command -v pkill > /dev/null 2>&1; then 254 + # _pkillf() { 255 + # pkill -f "$@" || true 256 + # } 257 + # else 258 + # case "$_uname_s" in 259 + # *CYGWIN*) 260 + # _pkillf() { 261 + # while IFS= read -r pid; do 262 + # kill "$pid" || true 263 + # done << EOF 264 + # $(grep -Eao "$@" /proc/*/cmdline | xargs -0 | sed -E -n 's,/proc/([0-9]+)/.+$,\1,pg') 265 + # EOF 266 + # } 267 + # ;; 268 + # *) 269 + # # shellcheck disable=SC2009 270 + # _pkillf() { 271 + # while IFS= read -r pid; do 272 + # kill "$pid" || true 273 + # done << EOF 274 + # $(ps -x -o pid= -o command= | grep -E "$@" | cut -d' ' -f1) 275 + # EOF 276 + # } 277 + # ;; 278 + # esac 279 + # fi 280 + # 281 + # if perl -MTime::HiRes -e1; then 282 + # _timestamp() { 283 + # while IFS= read -r line; do 284 + # printf '\t%s\n' "$line" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe '($s, $us) = gettimeofday(); printf ("[%s.%03d]", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)' 285 + # done 286 + # } 287 + # else 288 + # case "$_uname_s" in 289 + # Darwin) 290 + # _timestamp() { 291 + # while IFS= read -r line; do 292 + # printf '[%s]\t%s\n' "$(date +"%Y-%m-%d %H:%M:%S.000")" "$line" 293 + # done 294 + # } 295 + # ;; 296 + # *) 297 + # _timestamp() { 298 + # while IFS= read -r line; do 299 + # printf '[%s]\t%s\n' "$(date +"%Y-%m-%d %H:%M:%S.%3N")" "$line" 300 + # done 301 + # } 302 + # ;; 303 + # esac 304 + # fi 305 + # 306 + # _bar() { 307 + # bar_palette=$(printf '%s' "$1" | tr ';' ',') 308 + # bar_symbol_empty=$2 309 + # bar_symbol_full=$3 310 + # bar_length=$4 # "auto" or number of columns 311 + # bar_value=$5 # value between 0 and 1 312 + # 313 + # if [ "$bar_length" = "auto" ]; then 314 + # columns=${6:-$(tmux -q display -p '#{client_width}' 2> /dev/null || echo 80)} 315 + # if [ "$columns" -ge 160 ]; then 316 + # bar_length=12 317 + # elif [ "$columns" -ge 130 ]; then 318 + # bar_length=10 319 + # elif [ "$columns" -ge 120 ]; then 320 + # bar_length=8 321 + # elif [ "$columns" -ge 100 ]; then 322 + # bar_length=6 323 + # else 324 + # bar_length=4 325 + # fi 326 + # fi 327 + # 328 + # if printf '%s' "$bar_palette" | grep -q -E '^(heat|gradient|gradient\((\s*[#a-zA-Z0-9]{7,9},?)+\))(\s*,\s*[#a-zA-Z0-9]{7,9})?$'; then 329 + # # shellcheck disable=SC2086 330 + # { set -f; IFS=', '; set -- $bar_palette; unset IFS; set +f; } 331 + # palette_style=$1 332 + # shift 333 + # 334 + # case "$palette_style" in 335 + # gradient) 336 + # palette="colour196 colour202 colour208 colour214 colour220 colour226 colour190 colour154 colour118 colour82 colour46" 337 + # ;; 338 + # heat) 339 + # palette="colour243 colour245 colour247 colour144 colour143 colour142 colour184 colour214 colour208 colour202 colour196" 340 + # ;; 341 + # gradient*) 342 + # palette=${palette_style##gradient(} 343 + # while [ $# -gt 0 ]; do 344 + # palette="$palette${1+ }${1%%)}" 345 + # [ "$1" != "${1%%)}" ] && break 346 + # shift 347 + # done 348 + # ;; 349 + # esac 350 + # bg=${2:-none} 351 + # 352 + # palette=$(printf '%s' "$palette" | awk -v n="$bar_length" '{ for (i = 0; i < n - 1; ++i) printf "%s ", $(1 + i * NF / n); printf $NF }') 353 + # # shellcheck disable=SC2086 354 + # set -- $palette 355 + # 356 + # full=$(awk "BEGIN { printf \"%.0f\", ($bar_value) * $bar_length }") 357 + # bar="#[bg=$bg]" 358 + # if [ "$full" -gt 0 ]; then 359 + # # shellcheck disable=SC2046 360 + # bar="$bar$(printf "#[fg=%s]$bar_symbol_full" $(printf '%s' "$palette" | cut -d' ' -f1-"$full"))" 361 + # fi 362 + # empty=$((bar_length - full)) 363 + # if [ "$empty" -gt 0 ]; then 364 + # # shellcheck disable=SC2046 365 + # bar="$bar$(printf "#[fg=%s]$bar_symbol_empty" $(printf '%s' "$palette" | cut -d' ' -f$((full + 1))-$((full + empty))))" 366 + # fi 367 + # eval bar="$bar#[fg=\${$((full == 0 ? 1 : full))}]" 368 + # elif printf '%s' "$bar_palette" | grep -q -E '^(([#a-zA-Z0-9]{7,9}|none),?){3}$'; then 369 + # # shellcheck disable=SC2086 370 + # { set -f; IFS=,; set -- $bar_palette; unset IFS; set +f; } 371 + # full_fg=$1 372 + # empty_fg=$2 373 + # bg=${3:-none} 374 + # 375 + # full=$(awk "BEGIN { printf \"%.0f\", ($bar_value) * $bar_length }") 376 + # bar="#[bg=$bg]" 377 + # if [ "$full" -gt 0 ]; then 378 + # bar="$bar#[fg=$full_fg]$(printf "%0.s$bar_symbol_full" $(seq 1 "$full"))" 379 + # fi 380 + # empty=$((bar_length - full)) 381 + # if [ "$empty" -gt 0 ]; then 382 + # bar="$bar#[fg=$empty_fg]$(printf "%0.s$bar_symbol_empty" $(seq 1 "$empty"))#[fg=$empty_fg]" 383 + # fi 384 + # fi 385 + # 386 + # printf '%s' "$bar" 387 + # } 388 + # 389 + # _hbar() { 390 + # hbar_palette=$(printf '%s' "$1" | tr ';' ',') 391 + # hbar_value=$2 392 + # 393 + # if printf '%s' "$hbar_palette" | grep -q -E '^(heat|gradient|gradient\((\s*[#a-zA-Z0-9]{7,9},?)+\))(\s*,\s*[#a-zA-Z0-9]{7,9})?$'; then 394 + # # shellcheck disable=SC2086 395 + # { set -f; IFS=', '; set -- $hbar_palette; unset IFS; set +f; } 396 + # palette_style=$1 397 + # shift 398 + # 399 + # case "$palette_style" in 400 + # gradient) 401 + # palette="colour196 colour202 colour208 colour214 colour220 colour226 colour190 colour154 colour118 colour82 colour46" 402 + # ;; 403 + # heat) 404 + # palette="colour243 colour245 colour247 colour144 colour143 colour142 colour184 colour214 colour208 colour202 colour196" 405 + # ;; 406 + # gradient*) 407 + # palette=${palette_style##gradient(} 408 + # while [ $# -gt 0 ]; do 409 + # palette="$palette${1+ }${1%%)}" 410 + # [ "$1" != "${1%%)}" ] && break 411 + # shift 412 + # done 413 + # ;; 414 + # esac 415 + # bg=${2:-none} 416 + # 417 + # palette=$(printf '%s' "$palette" | awk -v n=8 '{ for (i = 0; i < n - 1; ++i) printf "%s ", $(1 + i * NF / n); printf $NF }') 418 + # # shellcheck disable=SC2086 419 + # set -- $palette 420 + # 421 + # full=$(awk "BEGIN { printf \"%.0f\", ($hbar_value) * 8 }") 422 + # eval hbar_fg="\${$((full == 0 ? 1 : full))}" 423 + # elif printf '%s' "$hbar_palette" | grep -q -E '^([#a-zA-Z0-9]{7,9},?){3}$'; then 424 + # # shellcheck disable=SC2086 425 + # { set -f; IFS=,; set -- $hbar_palette; unset IFS; set +f; } 426 + # 427 + # # shellcheck disable=SC2046 428 + # eval $(awk "BEGIN { printf \"hbar_fg=$%d\", (($hbar_value) - 0.001) * $# + 1 }") 429 + # fi 430 + # 431 + # set -- ▏ ▎ ▍ ▌ ▋ ▊ ▉ █ 432 + # # shellcheck disable=SC2046 433 + # eval $(awk "BEGIN { printf \"hbar_symbol=$%d\", ($hbar_value) * ($# - 1) + 1 }") 434 + # hbar="#[bg=$bg]#[fg=${hbar_fg?}]${hbar_symbol?}" 435 + # 436 + # printf '%s' "$hbar" 437 + # } 438 + # 439 + # _vbar() { 440 + # vbar_palette=$(printf '%s' "$1" | tr ';' ',') 441 + # vbar_value=$2 442 + # 443 + # if printf '%s' "$vbar_palette" | grep -q -E '^(heat|gradient|gradient\((\s*[#a-zA-Z0-9]{7,9},?)+\))(\s*,\s*[#a-zA-Z0-9]{7,9})?$'; then 444 + # # shellcheck disable=SC2086 445 + # { set -f; IFS=', '; set -- $vbar_palette; unset IFS; set +f; } 446 + # palette_style=$1 447 + # shift 448 + # 449 + # case "$palette_style" in 450 + # gradient) 451 + # palette="colour196 colour202 colour208 colour214 colour220 colour226 colour190 colour154 colour118 colour82 colour46" 452 + # ;; 453 + # heat) 454 + # palette="colour243 colour245 colour247 colour144 colour143 colour142 colour184 colour214 colour208 colour202 colour196" 455 + # ;; 456 + # gradient*) 457 + # palette=${palette_style##gradient(} 458 + # while [ $# -gt 0 ]; do 459 + # palette="$palette${1+ }${1%%)}" 460 + # [ "$1" != "${1%%)}" ] && break 461 + # shift 462 + # done 463 + # ;; 464 + # esac 465 + # bg=${2:-none} 466 + # 467 + # palette=$(printf '%s' "$palette" | awk -v n=8 '{ for (i = 0; i < n - 1; ++i) printf "%s ", $(1 + i * NF / n); printf $NF }') 468 + # # shellcheck disable=SC2086 469 + # set -- $palette 470 + # 471 + # full=$(awk "BEGIN { printf \"%.0f\", ($vbar_value) * 8 }") 472 + # eval vbar_fg="\${$((full == 0 ? 1 : full))}" 473 + # elif printf '%s' "$vbar_palette" | grep -q -E '^([#a-zA-Z0-9]{7,9},?){3}$'; then 474 + # # shellcheck disable=SC2086 475 + # { set -f; IFS=,; set -- $vbar_palette; unset IFS; set +f; } 476 + # 477 + # # shellcheck disable=SC2046 478 + # eval $(awk "BEGIN { printf \"vbar_fg=$%d\", (($vbar_value) - 0.001) * $# + 1 }") 479 + # fi 480 + # 481 + # set -- ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ 482 + # # shellcheck disable=SC2046 483 + # eval $(awk "BEGIN { printf \"vbar_symbol=$%d\", ($vbar_value) * ($# - 1) + 1 }") 484 + # vbar="#[bg=$bg]#[fg=${vbar_fg?}]${vbar_symbol?}" 485 + # 486 + # printf '%s' "$vbar" 487 + # } 488 + # 489 + # _maximize_pane() { 490 + # current_session=${1:-$(tmux display -p '#{session_name}')} 491 + # current_pane=${2:-$(tmux display -p '#{pane_id}')} 492 + # 493 + # dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -E -o '^1 %.+maximized.+$' || true) 494 + # restore=$(printf "%s" "$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"\ 495 + # -e "s/^1 (%[0-9]+) .+maximized.+'$current_pane'\"?$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t \1/p") 496 + # 497 + # if [ -z "$restore" ]; then 498 + # [ "$(tmux list-panes -t "$current_session:" | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return 499 + # info=$(tmux new-window -t "$current_session:" -F "#{session_name}:#{window_index}.#{pane_id}" -P "maximized... 2>/dev/null & \"$TMUX_PROGRAM\" ${TMUX_SOCKET:+-S \"$TMUX_SOCKET\"} setw -t \"$current_session:\" remain-on-exit on; printf \"\\033[\$(tput lines);0fPane has been maximized, press <prefix>+ to restore\n\" '$current_pane'") 500 + # session_window=${info%.*} 501 + # new_pane=${info#*.} 502 + # 503 + # retry=20 504 + # while [ "$("$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} list-panes -t "$session_window" -F '#{session_name}:#{window_index}.#{pane_id} #{pane_dead}' 2>/dev/null)" != "$info 1" ] && [ "$retry" -ne 0 ]; do 505 + # sleep 0.1 506 + # retry=$((retry - 1)) 507 + # done 508 + # if [ "$retry" -eq 0 ]; then 509 + # tmux display 'Unable to maximize pane' 510 + # fi 511 + # 512 + # tmux setw -t "$session_window" remain-on-exit off \; swap-pane -s "$current_pane" -t "$new_pane" 513 + # else 514 + # $restore || tmux kill-pane 515 + # fi 516 + # } 517 + # 518 + # _toggle_mouse() { 519 + # old=$(tmux show -gv mouse) 520 + # new="" 521 + # 522 + # if [ "$old" = "on" ]; then 523 + # new="off" 524 + # else 525 + # new="on" 526 + # fi 527 + # 528 + # tmux set -g mouse $new 529 + # } 530 + # 531 + # _battery_info() { 532 + # battery_count=0 533 + # battery_charge=0 534 + # case "$_uname_s" in 535 + # *Darwin*) 536 + # while IFS= read -r line; do 537 + # [ -z "$line" ] && continue 538 + # percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%' || echo "0%") 539 + # battery_charge=$(awk -v charge="$battery_charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }') 540 + # battery_count=$((battery_count + 1)) 541 + # done << EOF 542 + # $(pmset -g batt | grep 'InternalBattery') 543 + # EOF 544 + # ;; 545 + # *Linux*) 546 + # while IFS= read -r batpath; do 547 + # [ -z "$batpath" ] && continue 548 + # grep -i -q device "$batpath/scope" 2> /dev/null && continue 549 + # 550 + # bat_capacity="$batpath/capacity" 551 + # if [ -r "$bat_capacity" ]; then 552 + # battery_charge=$(awk -v charge="$battery_charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + (capacity > 100 ? 100 : capacity) / 100 }') 553 + # else 554 + # bat_energy_full="$batpath/energy_full" 555 + # bat_energy_now="$batpath/energy_now" 556 + # if [ -r "$bat_energy_full" ] && [ -r "$bat_energy_now" ]; then 557 + # battery_charge=$(awk -v charge="$battery_charge" -v energy_now="$(cat "$bat_energy_now")" -v energy_full="$(cat "$bat_energy_full")" 'BEGIN { print charge + energy_now / energy_full }') 558 + # fi 559 + # fi 560 + # battery_count=$((battery_count + 1)) 561 + # done << EOF 562 + # $(find /sys/class/power_supply -maxdepth 1 -iname '*bat*') 563 + # EOF 564 + # ;; 565 + # *CYGWIN*|*MSYS*|*MINGW*) 566 + # while IFS= read -r line; do 567 + # [ -z "$line" ] && continue 568 + # battery_charge=$(printf '%s' "$line" | awk -v charge="$battery_charge" '{ print charge + $2 / 100 }') 569 + # battery_count=$((battery_count + 1)) 570 + # done << EOF 571 + # $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining 2> /dev/null | tr -d '\r' | tail -n +2 || true) 572 + # EOF 573 + # ;; 574 + # *OpenBSD*) 575 + # for batid in 0 1 2; do 576 + # sysctl -n "hw.sensors.acpibat$batid.raw0" 2>&1 | grep -q 'not found' && continue 577 + # if sysctl -n "hw.sensors.acpibat$batid" | grep -q amphour; then 578 + # battery_charge=$(awk -v charge="$battery_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 }') 579 + # else 580 + # battery_charge=$(awk -v charge="$battery_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 }') 581 + # fi 582 + # battery_count=$((battery_count + 1)) 583 + # done 584 + # ;; 585 + # *FreeBSD*) 586 + # battery_charge=$(awk -v charge="$(sysctl -n 'hw.acpi.battery.life')" 'BEGIN { print charge / 100 }') 587 + # battery_count=1 588 + # ;; 589 + # esac 590 + # if [ "$battery_count" -ne 0 ]; then 591 + # battery_charge=$(awk -v charge="$battery_charge" -v count="$battery_count" 'BEGIN { print charge / count }') 592 + # fi 593 + # 594 + # if [ "$battery_charge" = 0 ]; then 595 + # tmux set -ug '@battery_percentage' \;\ 596 + # set -ug '@battery_charge' 597 + # else 598 + # battery_percentage="$(awk "BEGIN { printf \"%.0f%%\", ($battery_charge) * 100 }")" 599 + # 600 + # tmux set -g '@battery_percentage' "$battery_percentage" \;\ 601 + # set -g '@battery_charge' "$battery_charge" 602 + # fi 603 + # } 604 + # 605 + # _battery_status() { 606 + # battery_status_charging=$1 607 + # battery_status_discharging=$2 608 + # 609 + # case "$_uname_s" in 610 + # *Darwin*) 611 + # while IFS= read -r line; do 612 + # [ -z "$line" ] && continue 613 + # battery_discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false") 614 + # done << EOF 615 + # $(pmset -g batt | grep 'InternalBattery') 616 + # EOF 617 + # ;; 618 + # *Linux*) 619 + # while IFS= read -r batpath; do 620 + # [ -z "$batpath" ] && continue 621 + # grep -i -q device "$batpath/scope" 2> /dev/null && continue 622 + # 623 + # battery_discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false") 624 + # done << EOF 625 + # $(find /sys/class/power_supply -maxdepth 1 -iname '*bat*') 626 + # EOF 627 + # ;; 628 + # *CYGWIN*|*MSYS*|*MINGW*) 629 + # while IFS= read -r line; do 630 + # [ -z "$line" ] && continue 631 + # battery_discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }') 632 + # done << EOF 633 + # $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining 2> /dev/null | tr -d '\r' | tail -n +2 || true) 634 + # EOF 635 + # ;; 636 + # *OpenBSD*) 637 + # for batid in 0 1 2; do 638 + # battery_discharging=$(sysctl -n "hw.sensors.acpibat$batid.raw0" | grep -q 1 && echo "true" || echo "false") 639 + # done 640 + # ;; 641 + # *FreeBSD*) 642 + # battery_discharging=$(sysctl -n 'hw.acpi.battery.state' | grep -q 1 && echo "true" || echo "false") 643 + # ;; 644 + # esac 645 + # 646 + # if [ -z "$battery_discharging" ]; then 647 + # tmux set -ug '@battery_status' 648 + # return 649 + # fi 650 + # 651 + # if [ "$battery_discharging" = "true" ]; then 652 + # battery_status="$battery_status_discharging" 653 + # else 654 + # battery_status="$battery_status_charging" 655 + # fi 656 + # 657 + # tmux set -g '@battery_status' "$battery_status" >/dev/null 2>/dev/null 658 + # } 659 + # 660 + # _pane_info() { 661 + # pane_pid="$1" 662 + # pane_tty="${2##/dev/}" 663 + # case "$_uname_s" in 664 + # *CYGWIN*) 665 + # ps -al | tail -n +2 | awk -v pane_pid="$pane_pid" -v tty="$pane_tty" -v ssh="$(command -v ssh)" ' 666 + # ((/ssh/ && !/-W/ && !/tsh proxy ssh/ && !/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ && $5 == tty { 667 + # user[$1] = $6; if (!child[$2]) child[$2] = $1 668 + # } 669 + # END { 670 + # pid = pane_pid 671 + # while (child[pid]) { 672 + # if (match(command[pid], "^" ssh " |^ssh ")) { 673 + # break 674 + # } 675 + # pid = child[pid] 676 + # } 677 + # 678 + # file = "/proc/" pid "/cmdline"; getline command < file; close(file) 679 + # gsub(/\0/, " ", command) 680 + # "id -un " user[pid] | getline username 681 + # print pid":"username":"command 682 + # } 683 + # ' 684 + # ;; 685 + # *Linux*) 686 + # ps -t "$pane_tty" --sort=lstart -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" -v ssh="$(command -v ssh)" ' 687 + # ((/ssh/ && !/-W/ && !/tsh proxy ssh/ && !/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ { 688 + # user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4) 689 + # } 690 + # END { 691 + # pid = pane_pid 692 + # while (child[pid]) { 693 + # if (match(command[pid], "^" ssh " |^ssh ")) { 694 + # break 695 + # } 696 + # pid = child[pid] 697 + # } 698 + # 699 + # print pid":"user[pid]":"command[pid] 700 + # } 701 + # ' 702 + # ;; 703 + # *) 704 + # ps -t "/dev/$pane_tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" -v ssh="$(command -v ssh)" ' 705 + # ((/ssh/ && !/-W/ && !/tsh proxy ssh/ && !/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ { 706 + # user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4) 707 + # } 708 + # END { 709 + # pid = pane_pid 710 + # while (child[pid]) { 711 + # if (match(command[pid], "^" ssh " |^ssh ")) { 712 + # break 713 + # } 714 + # pid = child[pid] 715 + # } 716 + # 717 + # print pid":"user[pid]":"command[pid] 718 + # } 719 + # ' 720 + # ;; 721 + # esac 722 + # } 723 + # 724 + # _ssh_or_mosh_args() { 725 + # case "$1" in 726 + # *ssh*) 727 + # args=$(printf '%s' "$1" | perl -n -e 'print if s/.*?\bssh[\w_-]*\s*(.*)/\1/') 728 + # ;; 729 + # *mosh-client*) 730 + # args=$(printf '%s' "$1" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g') 731 + # ;; 732 + # esac 733 + # 734 + # printf '%s' "$args" 735 + # } 736 + # 737 + # _username() { 738 + # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} 739 + # pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} 740 + # ssh_only=$3 741 + # 742 + # pane_info=$(_pane_info "$pane_pid" "$pane_tty") 743 + # command=${pane_info#*:} 744 + # command=${command#*:} 745 + # 746 + # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command") 747 + # if [ -n "$ssh_or_mosh_args" ]; then 748 + # # shellcheck disable=SC2086 749 + # username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^user / { print $2; exit }') 750 + # # shellcheck disable=SC2086 751 + # [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" 2>&1 | awk '/^%username% / { print $2; exit }') 752 + # # shellcheck disable=SC2086 753 + # [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -v -T -o ControlPath=none -o ProxyCommand=false -o IdentityFile='%%username%%/%r' 2>&1 | awk '/%username%/ { print substr($4,12); exit }') 754 + # else 755 + # if ! _is_true "$ssh_only"; then 756 + # username=${pane_info#*:} 757 + # username=${username%%:*} 758 + # fi 759 + # fi 760 + # 761 + # printf '%s\n' "$username" 762 + # } 763 + # 764 + # _hostname() { 765 + # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} 766 + # pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} 767 + # ssh_only=$3 768 + # full=$4 769 + # h_or_H=$5 770 + # 771 + # pane_info=$(_pane_info "$pane_pid" "$pane_tty") 772 + # command=${pane_info#*:} 773 + # command=${command#*:} 774 + # 775 + # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command") 776 + # if [ -n "$ssh_or_mosh_args" ]; then 777 + # # shellcheck disable=SC2086 778 + # hostname=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^hostname / { print $2; exit }') 779 + # # shellcheck disable=SC2086 780 + # [ -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 }') 781 + # 782 + # if ! _is_true "$full"; then 783 + # case "$hostname" in 784 + # *[a-z-].*) 785 + # hostname=${hostname%%.*} 786 + # ;; 787 + # 127.0.0.1) 788 + # hostname="localhost" 789 + # ;; 790 + # esac 791 + # fi 792 + # else 793 + # if ! _is_true "$ssh_only"; then 794 + # hostname="$h_or_H" 795 + # fi 796 + # fi 797 + # 798 + # printf '%s\n' "$hostname" 799 + # } 800 + # 801 + # _root() { 802 + # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} 803 + # pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} 804 + # root=$3 805 + # 806 + # username=$(_username "$pane_pid" "$pane_tty" false) 807 + # 808 + # [ "$username" = "root" ] && echo "$root" 809 + # } 810 + # 811 + # _uptime() { 812 + # case "$_uname_s" in 813 + # *Darwin*|*FreeBSD*) 814 + # boot=$(sysctl -n kern.boottime 2>/dev/null | awk -F'[ ,:]+' '{ print $4 }') 815 + # now=$(date +%s) 816 + # ;; 817 + # *Linux*|*CYGWIN*|*MSYS*|*MINGW*) 818 + # boot=0 819 + # now=$(cut -d' ' -f1 < /proc/uptime) 820 + # ;; 821 + # *OpenBSD*) 822 + # boot=$(sysctl -n kern.boottime) 823 + # now=$(date +%s) 824 + # esac 825 + # # shellcheck disable=SC1004 826 + # awk -v tmux="$TMUX_PROGRAM ${TMUX_SOCKET:+-S "$TMUX_SOCKET"}" -v boot="$boot" -v now="$now" ' 827 + # BEGIN { 828 + # uptime = now - boot 829 + # y = int(uptime / 31536000) 830 + # dy = int(uptime / 86400) % 365 831 + # d = int(uptime / 86400) 832 + # h = int(uptime / 3600) % 24 833 + # m = int(uptime / 60) % 60 834 + # s = int(uptime) % 60 835 + # 836 + # system(tmux " set -g @uptime_y " y + 0 " \\;" \ 837 + # " set -g @uptime_dy " dy + 0 " \\;" \ 838 + # " set -g @uptime_d " d + 0 " \\;" \ 839 + # " set -g @uptime_h " h + 0 " \\;" \ 840 + # " set -g @uptime_m " m + 0 " \\;" \ 841 + # " set -g @uptime_s " s + 0) 842 + # }' 843 + # } 844 + # 845 + # _loadavg() { 846 + # case "$_uname_s" in 847 + # *Darwin*|*FreeBSD*) 848 + # tmux set -g @loadavg "$(sysctl -n vm.loadavg 2>/dev/null | cut -d' ' -f2)" 849 + # ;; 850 + # *Linux*|*CYGWIN*) 851 + # tmux set -g @loadavg "$(cut -d' ' -f1 < /proc/loadavg)" 852 + # ;; 853 + # *OpenBSD*) 854 + # tmux set -g @loadavg "$(sysctl -n vm.loadavg 2>/dev/null | cut -d' ' -f1)" 855 + # ;; 856 + # esac 857 + # } 858 + # 859 + # _new_window_ssh() { 860 + # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} 861 + # pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} 862 + # shift 2 863 + # 864 + # pane_info=$(_pane_info "$pane_pid" "$pane_tty") 865 + # command=${pane_info#*:} 866 + # command=${command#*:} 867 + # 868 + # case "$command" in 869 + # *mosh-client*) 870 + # # shellcheck disable=SC2046 871 + # tmux new-window "$@" mosh $(echo "$command" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/') 872 + # ;; 873 + # *ssh*) 874 + # # shellcheck disable=SC2046 875 + # tmux new-window "$@" $(echo "$command" | sed -e 's/;/\\;/g') 876 + # ;; 877 + # *) 878 + # tmux new-window "$@" 879 + # esac 880 + # } 881 + # 882 + # _new_window() { 883 + # _new_window_ssh "$@" 884 + # } 885 + # 886 + # _split_window_ssh() { 887 + # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} 888 + # pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} 889 + # shift 2 890 + # 891 + # pane_info=$(_pane_info "$pane_pid" "$pane_tty") 892 + # command=${pane_info#*:} 893 + # command=${command#*:} 894 + # 895 + # case "$command" in 896 + # *mosh-client*) 897 + # # shellcheck disable=SC2046 898 + # tmux split-window "$@" mosh $(echo "$command" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/') 899 + # ;; 900 + # *ssh*) 901 + # # shellcheck disable=SC2046 902 + # tmux split-window "$@" $(echo "$command" | sed -e 's/;/\\;/g') 903 + # ;; 904 + # *) 905 + # tmux split-window "$@" 906 + # esac 907 + # } 908 + # 909 + # _split_window() { 910 + # _split_window_ssh "$@" 911 + # } 912 + # 913 + # _apply_tmux_256color() { 914 + # case "$(tmux show -gv default-terminal)" in 915 + # tmux-256color|tmux-direct) 916 + # return 917 + # ;; 918 + # esac 919 + # 920 + # # when tmux-256color is available, use it 921 + # # on macOS though, make sure to use /usr/bin/infocmp to probe if it's availalbe system wide 922 + # case "$_uname_s" in 923 + # *Darwin*) 924 + # if /usr/bin/infocmp -x tmux-256color > /dev/null 2>&1; then 925 + # tmux set -g default-terminal 'tmux-256color' 926 + # fi 927 + # ;; 928 + # *) 929 + # if command infocmp -x tmux-256color > /dev/null 2>&1; then 930 + # tmux set -g default-terminal 'tmux-256color' 931 + # fi 932 + # ;; 933 + # esac 934 + # } 935 + # 936 + # _apply_24b() { 937 + # tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-auto} 938 + # tmux_conf_24b_colour=${tmux_conf_24b_colour:-$tmux_conf_theme_24b_colour} 939 + # if [ "$tmux_conf_24b_colour" = "auto" ]; then 940 + # case "$COLORTERM" in 941 + # truecolor|24bit) 942 + # apply_24b=true 943 + # ;; 944 + # esac 945 + # if [ "$apply_24b" = "" ] && [ "$(tput colors)" = "16777216" ]; then 946 + # apply_24b=true 947 + # fi 948 + # elif _is_true "$tmux_conf_24b_colour"; then 949 + # apply_24b=true 950 + # fi 951 + # if [ "$apply_24b" = "true" ]; then 952 + # case "$TERM" in 953 + # screen-*|tmux-*) 954 + # ;; 955 + # *) 956 + # tmux set-option -ga terminal-overrides ",*256col*:Tc" 957 + # ;; 958 + # esac 959 + # fi 960 + # } 961 + # 962 + # _apply_bindings() { 963 + # cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT 964 + # 965 + # tmux_conf_preserve_stock_bindings=${tmux_conf_preserve_stock_bindings:-false} 966 + # tmux list-keys | grep -vF 'TMUX_CONF_LOCAL' | grep -E 'new-window|split(-|_)window|new-session|copy-selection|copy-pipe' > "$cfg" 967 + # if _is_true "$tmux_conf_preserve_stock_bindings"; then 968 + # probe_socket="$(dirname "$TMUX_SOCKET")/tmux-stock-bindings-$$" 969 + # TMUX_SOCKET="$probe_socket" tmux -f /dev/null list-keys >> "$cfg" 970 + # rm -f "$probe_socket" 971 + # fi 972 + # 973 + # # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the 974 + # # output of list-keys can be truncated 975 + # perl -p -i -e "s/'#\{\?window_zoomed_flag,Unzoom,Zoom\}' 'z' \{resize-pane -$/'#{?window_zoomed_flag,Unzoom,Zoom}' 'z' {resize-pane -Z}\"/g" "$cfg" 976 + # 977 + # tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-true} 978 + # if ! _is_disabled "$tmux_conf_new_window_retain_current_path"; then 979 + # perl -p -i -e " 980 + # s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+(.+?)\s+\|\s+sh\s+-s\s+_new_window\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^\n\1]*?)(?:\s+-c\s+((?:\\\\{1,3}\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*?)\1/run-shell \1cut -c3- \2 | sh -s _new_window #\{pane_pid\} #\{b:pane_tty\}\3\5\1/g 981 + # ; 982 + # s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+.+?\s+\|\s+sh\s+-s\s+_new_window\s+#\{pane_pid\}\s+#\{b:pane_tty\}(\s+.+?)?\1/new-window\2/g 983 + # ; 984 + # s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g" \ 985 + # "$cfg" 986 + # fi 987 + # 988 + # perl -p -i -e " 989 + # s,\bnew-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?,run-shell 'cut -c3- \"$TMUX_CONF\" | sh -s _new_window_ssh #\{pane_pid\} #\{b:pane_tty\}\1',g if /\bnew-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\ 990 + # "$cfg" 991 + # 992 + # tmux_conf_new_window_reconnect_ssh=${tmux_conf_new_window_reconnect_ssh:-false} 993 + # if ! _is_disabled "$tmux_conf_new_window_reconnect_ssh" && _is_true "$tmux_conf_new_window_reconnect_ssh"; then 994 + # perl -p -i -e "s,\bnew-window\b([^;}\n\"]*),run-shell 'cut -c3- \"$TMUX_CONF\" | sh -s _new_window #\{pane_pid\} #\{b:pane_tty\}\1',g" "$cfg" 995 + # fi 996 + # 997 + # tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false} 998 + # if ! _is_disabled "$tmux_conf_new_window_retain_current_path" && _is_true "$tmux_conf_new_window_retain_current_path"; then 999 + # perl -p -i -e " 1000 + # s/\bnew-window\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/ 1001 + # ; 1002 + # s/\bnew-window\b/new-window -c '#{pane_current_path}'/g 1003 + # ; 1004 + # s/\brun-shell\b\s+'cut\s+-c3-\s+(.+?)\s+\|\s+sh\s+-s\s+_new_window(_ssh)?\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- \1 | sh -s _new_window\2 #\{pane_pid\} #\{b:pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\3'/g if /\bdisplay-menu\b/ 1005 + # ; 1006 + # s/\brun-shell\b\s+'cut\s+-c3-\s+(.+?)\s+\|\s+sh\s+-s\s+_new_window(_ssh)?\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- \1 | sh -s _new_window\2 #\{pane_pid\} #\{b:pane_tty\} -c \"#\{pane_current_path\}\"\3'/g" \ 1007 + # "$cfg" 1008 + # fi 1009 + # 1010 + # tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true} 1011 + # if ! _is_disabled "$tmux_conf_new_pane_retain_current_path"; then 1012 + # perl -p -i -e " 1013 + # s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+(.+?)\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^\n\1]*?)(?:\s+-c\s+((?:\\\\{1,3}\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*?)\1/run-shell \1cut -c3- \2 | sh -s _split_window #\{pane_pid\} #\{b:pane_tty\}\3\5\1/g 1014 + # ; 1015 + # s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+.+?\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_pid\}\s+#\{b:pane_tty\}(\s+.+?)?\1/split-window\2/g 1016 + # ; 1017 + # s/\bsplit-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" \ 1018 + # "$cfg" 1019 + # fi 1020 + # 1021 + # perl -p -i -e " 1022 + # s,\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?,run-shell 'cut -c3- \"$TMUX_CONF\" | sh -s _split_window_ssh #\{pane_pid\} #\{b:pane_tty\}\1',g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\ 1023 + # "$cfg" 1024 + # 1025 + # tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false} 1026 + # if ! _is_disabled "$tmux_conf_new_pane_reconnect_ssh" && _is_true "$tmux_conf_new_pane_reconnect_ssh"; then 1027 + # perl -p -i -e "s,\bsplit-window\b([^;}\n\"]*),run-shell 'cut -c3- \"$TMUX_CONF\" | sh -s _split_window #\{pane_pid\} #\{b:pane_tty\}\1',g" "$cfg" 1028 + # fi 1029 + # 1030 + # if ! _is_disabled "$tmux_conf_new_pane_retain_current_path" && _is_true "$tmux_conf_new_pane_retain_current_path"; then 1031 + # perl -p -i -e " 1032 + # s/\bsplit-window\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/ 1033 + # ; 1034 + # s/\bsplit-window\b/split-window -c '#{pane_current_path}'\1/g 1035 + # ; 1036 + # s/\brun-shell\b\s+'cut\s+-c3-\s+(.+?)\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- \1 | sh -s _split_window\2 #\{pane_pid\} #\{b:pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\3'/g if /\bdisplay-menu\b/ 1037 + # ; 1038 + # s/\brun-shell\b\s+'cut\s+-c3-\s+(.+?)\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- \1 | sh -s _split_window\2 #\{pane_pid\} #\{b:pane_tty\} -c \"#\{pane_current_path\}\"\3'/g" \ 1039 + # "$cfg" 1040 + # fi 1041 + # 1042 + # tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false} 1043 + # if ! _is_disabled "$tmux_conf_new_session_prompt" && _is_true "$tmux_conf_new_session_prompt"; then 1044 + # perl -p -i -e " 1045 + # s/(?<!command-prompt -p )\b(new-session)\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/ 1046 + # ; 1047 + # s/(?<!\bcommand-prompt -p )\bnew-session\b(?! -s)/command-prompt -p new-session \"new-session -s '%%'\"/g" \ 1048 + # "$cfg" 1049 + # else 1050 + # perl -p -i -e "s/\bcommand-prompt\s+-p\s+new-session\s+\"new-session\s+-s\s+'%%'\"/new-session/g" "$cfg" 1051 + # fi 1052 + # 1053 + # tmux_conf_new_session_retain_current_path=${tmux_conf_new_session_retain_current_path:-false} 1054 + # if ! _is_disabled "$tmux_conf_new_session_retain_current_path" && _is_true "$tmux_conf_new_session_retain_current_path"; then 1055 + # perl -p -i -e " 1056 + # s/(?<!\bcommand-prompt -p )\bnew-session\b/new-session -c '#{pane_current_path}'/g" \ 1057 + # "$cfg" 1058 + # else 1059 + # perl -p -i -e " 1060 + # s/\bnew-session\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-session\1/g" \ 1061 + # "$cfg" 1062 + # fi 1063 + # 1064 + # tmux_conf_copy_to_os_clipboard=${tmux_conf_copy_to_os_clipboard:-false} 1065 + # command -v xsel > /dev/null 2>&1 && command='xsel -i -b' 1066 + # ! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1 && command='xclip -i -selection clipboard > \/dev\/null 2>\&1' 1067 + # [ "$XDG_SESSION_TYPE" = "wayland" ] && command -v wl-copy > /dev/null 2>&1 && command='wl-copy' 1068 + # command -v pbcopy > /dev/null 2>&1 && command='pbcopy' 1069 + # command -v clip.exe > /dev/null 2>&1 && command='clip\.exe' 1070 + # [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard' 1071 + # 1072 + # if [ -n "$command" ]; then 1073 + # if ! _is_disabled "$tmux_conf_copy_to_os_clipboard" && _is_true "$tmux_conf_copy_to_os_clipboard"; then 1074 + # perl -p -i -e "s/(?!.*?$command)\bcopy-(?:selection|pipe)(-end-of-line|-and-cancel|-end-of-line-and-cancel|-no-clear)?\b/copy-pipe\1 '$command'/g" "$cfg" 1075 + # else 1076 + # if [ "$_tmux_version" -ge 3200 ]; then 1077 + # perl -p -i -e "s/\bcopy-pipe(-end-of-line|-and-cancel|end-of-line-and-cancel|-no-clear)?\b\s+(\"|')?$command\2?/copy-pipe\1/g" "$cfg" 1078 + # else 1079 + # perl -p -i -e "s/\bcopy-pipe(-end-of-line|-and-cancel|end-of-line-and-cancel|-no-clear)?\b\s+(\"|')?$command\2?/copy-selection\1/g" "$cfg" 1080 + # fi 1081 + # fi 1082 + # fi 1083 + # 1084 + # # until tmux >= 3.0, output of tmux list-keys can't be consumed back by tmux source-file without applying some escapings 1085 + # awk < "$cfg" \ 1086 + # '{i = $2 == "-T" ? 4 : 5; gsub(/^[;]$/, "\\\\&", $i); gsub(/^[$"#~]$/, "'"'"'&'"'"'", $i); gsub(/^['"'"']$/, "\"&\"", $i); print}' > "$cfg.in" 1087 + # 1088 + # # ignore bindings with errors 1089 + # if ! tmux source-file "$cfg.in"; then 1090 + # if tmux source-file -v /dev/null 2> /dev/null; then 1091 + # verbose_flag='-v' 1092 + # fi 1093 + # while ! out=$(tmux source-file "${verbose_flag:+$verbose_flag}" "$cfg.in"); do 1094 + # line=$(printf "%s" "$out" | tail -1 | cut -d':' -f2) 1095 + # perl -n -i -e "if ($. != $line) { print }" "$cfg.in" 1096 + # done 1097 + # fi 1098 + # 1099 + # tmux_conf_urlscan_options=${tmux_conf_urlscan_options:---compact --dedupe} 1100 + # if command -v urlscan > /dev/null 2>&1; then 1101 + # tmux bind U run "cut -c3- '#{TMUX_CONF}' | sh -s _urlscan '#{pane_id}' $tmux_conf_urlscan_options" 1102 + # elif command -v urlview > /dev/null 2>&1; then 1103 + # tmux bind U run "cut -c3- '#{TMUX_CONF}' | sh -s _urlview '#{pane_id}'" 1104 + # fi 1105 + # } 1106 + # 1107 + # _apply_theme() { 1108 + # tmux_conf_theme=${tmux_conf_theme:-enabled} 1109 + # if ! _is_disabled "$tmux_conf_theme"; then 1110 + # 1111 + # # -- default theme ------------------------------------------------------- 1112 + # 1113 + # tmux_conf_theme_colour_1=${tmux_conf_theme_colour_1:-#080808} # dark gray 1114 + # tmux_conf_theme_colour_2=${tmux_conf_theme_colour_2:-#303030} # gray 1115 + # tmux_conf_theme_colour_3=${tmux_conf_theme_colour_3:-#8a8a8a} # light gray 1116 + # tmux_conf_theme_colour_4=${tmux_conf_theme_colour_4:-#00afff} # light blue 1117 + # tmux_conf_theme_colour_5=${tmux_conf_theme_colour_5:-#ffff00} # yellow 1118 + # tmux_conf_theme_colour_6=${tmux_conf_theme_colour_6:-#080808} # dark gray 1119 + # tmux_conf_theme_colour_7=${tmux_conf_theme_colour_7:-#e4e4e4} # white 1120 + # tmux_conf_theme_colour_8=${tmux_conf_theme_colour_8:-#080808} # dark gray 1121 + # tmux_conf_theme_colour_9=${tmux_conf_theme_colour_9:-#ffff00} # yellow 1122 + # tmux_conf_theme_colour_10=${tmux_conf_theme_colour_10:-#ff00af} # pink 1123 + # tmux_conf_theme_colour_11=${tmux_conf_theme_colour_11:-#5fff00} # green 1124 + # tmux_conf_theme_colour_12=${tmux_conf_theme_colour_12:-#8a8a8a} # light gray 1125 + # tmux_conf_theme_colour_13=${tmux_conf_theme_colour_13:-#e4e4e4} # white 1126 + # tmux_conf_theme_colour_14=${tmux_conf_theme_colour_14:-#080808} # dark gray 1127 + # tmux_conf_theme_colour_15=${tmux_conf_theme_colour_15:-#080808} # dark gray 1128 + # tmux_conf_theme_colour_16=${tmux_conf_theme_colour_16:-#d70000} # red 1129 + # tmux_conf_theme_colour_17=${tmux_conf_theme_colour_17:-#e4e4e4} # white 1130 + ## tmux_conf_theme_colour_18=${tmux_conf_theme_colour_18:-default} # blank 1131 + 1132 + # # -- panes --------------------------------------------------------------- 1133 + # 1134 + # tmux_conf_theme_window_fg=${tmux_conf_theme_window_fg:-default} 1135 + # tmux_conf_theme_window_bg=${tmux_conf_theme_window_bg:-default} 1136 + # tmux_conf_theme_highlight_focused_pane=${tmux_conf_theme_highlight_focused_pane:-false} 1137 + # tmux_conf_theme_focused_pane_fg=${tmux_conf_theme_focused_pane_fg:-default} 1138 + # tmux_conf_theme_focused_pane_bg=${tmux_conf_theme_focused_pane_bg:-$tmux_conf_theme_colour_2} 1139 + # 1140 + # window_style="fg=$tmux_conf_theme_window_fg,bg=$tmux_conf_theme_window_bg" 1141 + # if _is_true "$tmux_conf_theme_highlight_focused_pane"; then 1142 + # window_active_style="fg=$tmux_conf_theme_focused_pane_fg,bg=$tmux_conf_theme_focused_pane_bg" 1143 + # else 1144 + # window_active_style="default" 1145 + # fi 1146 + # 1147 + # tmux_conf_theme_pane_border_style=${tmux_conf_theme_pane_border_style:-thin} 1148 + # tmux_conf_theme_pane_border=${tmux_conf_theme_pane_border:-$tmux_conf_theme_colour_2} 1149 + # tmux_conf_theme_pane_active_border=${tmux_conf_theme_pane_active_border:-$tmux_conf_theme_colour_4} 1150 + # tmux_conf_theme_pane_border_fg=${tmux_conf_theme_pane_border_fg:-$tmux_conf_theme_pane_border} 1151 + # tmux_conf_theme_pane_active_border_fg=${tmux_conf_theme_pane_active_border_fg:-$tmux_conf_theme_pane_active_border} 1152 + # case "$tmux_conf_theme_pane_border_style" in 1153 + # fat) 1154 + # tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-$tmux_conf_theme_pane_border_fg} 1155 + # tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-$tmux_conf_theme_pane_active_border_fg} 1156 + # ;; 1157 + # thin|*) 1158 + # tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-default} 1159 + # tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-default} 1160 + # ;; 1161 + # esac 1162 + # 1163 + # tmux_conf_theme_pane_indicator=${tmux_conf_theme_pane_indicator:-$tmux_conf_theme_colour_4} 1164 + # tmux_conf_theme_pane_active_indicator=${tmux_conf_theme_pane_active_indicator:-$tmux_conf_theme_colour_4} 1165 + # 1166 + # # -- status line --------------------------------------------------------- 1167 + # 1168 + # tmux_conf_theme_left_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_main-}") 1169 + # tmux_conf_theme_left_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_sub-|}") 1170 + # tmux_conf_theme_right_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_main-}") 1171 + # tmux_conf_theme_right_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_sub-|}") 1172 + # 1173 + # tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-$tmux_conf_theme_colour_18} 1174 + # tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-$tmux_conf_theme_colour_18} 1175 + # tmux_conf_theme_message_attr=${tmux_conf_theme_message_attr:-bold} 1176 + # 1177 + # tmux_conf_theme_message_command_fg=${tmux_conf_theme_message_command_fg:-$tmux_conf_theme_colour_18} 1178 + # tmux_conf_theme_message_command_bg=${tmux_conf_theme_message_command_bg:-$tmux_conf_theme_colour_18} 1179 + # tmux_conf_theme_message_command_attr=${tmux_conf_theme_message_command_attr:-bold} 1180 + # 1181 + # tmux_conf_theme_mode_fg=${tmux_conf_theme_mode_fg:-$tmux_conf_theme_colour_18} 1182 + # tmux_conf_theme_mode_bg=${tmux_conf_theme_mode_bg:-$tmux_conf_theme_colour_18} 1183 + # tmux_conf_theme_mode_attr=${tmux_conf_theme_mode_attr:-bold} 1184 + # 1185 + # tmux_conf_theme_status_fg=${tmux_conf_theme_status_fg:-$tmux_conf_theme_colour_18} 1186 + # tmux_conf_theme_status_bg=${tmux_conf_theme_status_bg:-$tmux_conf_theme_colour_18} 1187 + # tmux_conf_theme_status_attr=${tmux_conf_theme_status_attr:-none} 1188 + # 1189 + # tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-$tmux_conf_theme_colour_18} 1190 + # tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-$tmux_conf_theme_colour_18} 1191 + # tmux_conf_theme_window_status_attr=${tmux_conf_theme_window_status_attr:-none} 1192 + # tmux_conf_theme_window_status_format=${tmux_conf_theme_window_status_format:-'#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}'} 1193 + # 1194 + # tmux_conf_theme_window_status_current_fg=${tmux_conf_theme_window_status_current_fg:-$tmux_conf_theme_colour_18} 1195 + # tmux_conf_theme_window_status_current_bg=${tmux_conf_theme_window_status_current_bg:-$tmux_conf_theme_colour_18} 1196 + # tmux_conf_theme_window_status_current_attr=${tmux_conf_theme_window_status_current_attr:-bold} 1197 + # tmux_conf_theme_window_status_current_format=${tmux_conf_theme_window_status_current_format:-'#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}'} 1198 + # 1199 + # tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-default} 1200 + # tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-default} 1201 + # tmux_conf_theme_window_status_activity_attr=${tmux_conf_theme_window_status_activity_attr:-default} 1202 + # 1203 + # tmux_conf_theme_window_status_bell_fg=${tmux_conf_theme_window_status_bell_fg:-$tmux_conf_theme_colour_18} 1204 + # tmux_conf_theme_window_status_bell_bg=${tmux_conf_theme_window_status_bell_bg:-default} 1205 + # tmux_conf_theme_window_status_bell_attr=${tmux_conf_theme_window_status_bell_attr:-blink,bold} 1206 + # 1207 + # tmux_conf_theme_window_status_last_fg=${tmux_conf_theme_window_status_last_fg:-$tmux_conf_theme_colour_18} 1208 + # tmux_conf_theme_window_status_last_bg=${tmux_conf_theme_window_status_last_bg:-default} 1209 + # tmux_conf_theme_window_status_last_attr=${tmux_conf_theme_window_status_last_attr:-none} 1210 + # 1211 + # if [ "$tmux_conf_theme_window_status_bg" = "$tmux_conf_theme_status_bg" ] || [ "$tmux_conf_theme_window_status_bg" = "default" ]; then 1212 + # spacer='' 1213 + # spacer_current=' ' 1214 + # else 1215 + # spacer=' ' 1216 + # spacer_current=' ' 1217 + # fi 1218 + # if [ "$tmux_conf_theme_window_status_last_bg" = "$tmux_conf_theme_status_bg" ] || [ "$tmux_conf_theme_window_status_last_bg" = "default" ] ; then 1219 + # spacer_last='' 1220 + # else 1221 + # spacer_last=' ' 1222 + # fi 1223 + # if [ "$tmux_conf_theme_window_status_activity_bg" = "$tmux_conf_theme_status_bg" ] || [ "$tmux_conf_theme_window_status_activity_bg" = "default" ] ; then 1224 + # spacer_activity='' 1225 + # spacer_last_activity="$spacer_last" 1226 + # else 1227 + # spacer_activity=' ' 1228 + # spacer_last_activity=' ' 1229 + # fi 1230 + # if [ "$tmux_conf_theme_window_status_bell_bg" = "$tmux_conf_theme_status_bg" ] || [ "$tmux_conf_theme_window_status_bell_bg" = "default" ] ; then 1231 + # spacer_bell='' 1232 + # spacer_last_bell="$spacer_last" 1233 + # spacer_activity_bell="$spacer_activity" 1234 + # spacer_last_activity_bell="$spacer_last_activity" 1235 + # else 1236 + # spacer_bell=' ' 1237 + # spacer_last_bell=' ' 1238 + # spacer_activity_bell=' ' 1239 + # spacer_last_activity_bell=' ' 1240 + # fi 1241 + # spacer="#{?window_last_flag,#{?window_activity_flag,#{?window_bell_flag,$spacer_last_activity_bell,$spacer_last_activity},#{?window_bell_flag,$spacer_last_bell,$spacer_last}},#{?window_activity_flag,#{?window_bell_flag,$spacer_activity_bell,$spacer_activity},#{?window_bell_flag,$spacer_bell,$spacer}}}" 1242 + # if [ "$(tmux show -g -v status-justify)" = "right" ]; then 1243 + # if [ -z "$tmux_conf_theme_right_separator_main" ]; then 1244 + # window_status_separator=' ' 1245 + # else 1246 + # window_status_separator='' 1247 + # fi 1248 + # window_status_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg,none]#{?window_last_flag,$(printf '%s' "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf '%s' "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf '%s' "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf '%s' "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf '%s' "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf '%s' "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf '%s' "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf '%s' "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf '%s' "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$spacer$(printf '%s' "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#{?window_last_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')$(printf '%s' "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#{?window_activity_flag?,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')$(printf '%s' "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#{?window_bell_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')$tmux_conf_theme_window_status_format#[none]$spacer#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg]#{?window_last_flag,$(printf '%s' "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf '%s' "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf '%s' "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#[none]$tmux_conf_theme_right_separator_main" 1249 + # window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none]$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]$spacer_current$tmux_conf_theme_window_status_current_format$spacer_current#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_right_separator_main" 1250 + # else 1251 + # if [ -z "$tmux_conf_theme_left_separator_main" ]; then 1252 + # window_status_separator=' ' 1253 + # else 1254 + # window_status_separator='' 1255 + # fi 1256 + # window_status_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg,none]#{?window_last_flag,$(printf '%s' "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf '%s' "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf '%s' "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf '%s' "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf '%s' "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf '%s' "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf '%s' "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf '%s' "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf '%s' "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$spacer$(printf '%s' "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#{?window_last_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')$(printf '%s' "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#{?window_activity_flag,#[none],}" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')$(printf '%s' "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#{?window_bell_flag,#[none],}" if /!default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')$tmux_conf_theme_window_status_format#[none]$spacer#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg]#{?window_last_flag,$(printf '%s' "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf '%s' "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf '%s' "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main" 1257 + # window_status_current_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$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]$spacer_current$tmux_conf_theme_window_status_current_format$spacer_current#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg]$tmux_conf_theme_left_separator_main" 1258 + # fi 1259 + # 1260 + # # -- indicators 1261 + # 1262 + # tmux_conf_theme_pairing=${tmux_conf_theme_pairing:-⚇} # U+2687 1263 + # tmux_conf_theme_pairing_fg=${tmux_conf_theme_pairing_fg:-none} 1264 + # tmux_conf_theme_pairing_bg=${tmux_conf_theme_pairing_bg:-none} 1265 + # tmux_conf_theme_pairing_attr=${tmux_conf_theme_pairing_attr:-none} 1266 + # 1267 + # tmux_conf_theme_prefix=${tmux_conf_theme_prefix:-⌨} # U+2328 1268 + # tmux_conf_theme_prefix_fg=${tmux_conf_theme_prefix_fg:-none} 1269 + # tmux_conf_theme_prefix_bg=${tmux_conf_theme_prefix_bg:-none} 1270 + # tmux_conf_theme_prefix_attr=${tmux_conf_theme_prefix_attr:-none} 1271 + # 1272 + # tmux_conf_theme_mouse=${tmux_conf_theme_mouse:-↗} # U+2197 1273 + # tmux_conf_theme_mouse_fg=${tmux_conf_theme_mouse_fg:-none} 1274 + # tmux_conf_theme_mouse_bg=${tmux_conf_theme_mouse_bg:-none} 1275 + # tmux_conf_theme_mouse_attr=${tmux_conf_theme_mouse_attr:-none} 1276 + # 1277 + # tmux_conf_theme_root=${tmux_conf_theme_root:-!} 1278 + # tmux_conf_theme_root_fg=${tmux_conf_theme_root_fg:-none} 1279 + # tmux_conf_theme_root_bg=${tmux_conf_theme_root_bg:-none} 1280 + # tmux_conf_theme_root_attr=${tmux_conf_theme_root_attr:-bold,blink} 1281 + # 1282 + # tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-⚏} # U+268F 1283 + # tmux_conf_theme_synchronized_fg=${tmux_conf_theme_synchronized_fg:-none} 1284 + # tmux_conf_theme_synchronized_bg=${tmux_conf_theme_synchronized_bg:-none} 1285 + # tmux_conf_theme_synchronized_attr=${tmux_conf_theme_synchronized_attr:-none} 1286 + # 1287 + # # -- clock --------------------------------------------------------------- 1288 + # 1289 + # tmux_conf_theme_clock_colour=${tmux_conf_theme_clock_colour:-$tmux_conf_theme_colour_4} 1290 + # tmux_conf_theme_clock_style=${tmux_conf_theme_clock_style:-24} 1291 + # 1292 + # tmux setw -g window-style "$window_style" \; setw -g window-active-style "$window_active_style" \;\ 1293 + # 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" \;\ 1294 + # set -g display-panes-colour "$tmux_conf_theme_pane_indicator" \; set -g display-panes-active-colour "$tmux_conf_theme_pane_active_indicator" \;\ 1295 + # set -g message-style "fg=$tmux_conf_theme_message_fg,bg=$tmux_conf_theme_message_bg,$tmux_conf_theme_message_attr" \;\ 1296 + # 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" \;\ 1297 + # setw -g mode-style "fg=$tmux_conf_theme_mode_fg,bg=$tmux_conf_theme_mode_bg,$tmux_conf_theme_mode_attr" \;\ 1298 + # set -g status-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ 1299 + # set -g status-left-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ 1300 + # set -g status-right-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ 1301 + # 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" \;\ 1302 + # 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" \;\ 1303 + # 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" \;\ 1304 + # 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" \;\ 1305 + # 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" \;\ 1306 + # setw -g window-status-separator "$window_status_separator" \;\ 1307 + # setw -g clock-mode-colour "$tmux_conf_theme_clock_colour" \;\ 1308 + # setw -g clock-mode-style "$tmux_conf_theme_clock_style" 1309 + # fi 1310 + # 1311 + # # -- variables ------------------------------------------------------------- 1312 + # 1313 + # set_titles_string=$(printf '%s' "${tmux_conf_theme_terminal_title:-$(tmux show -gv set-titles-string)}" | sed \ 1314 + # -e "s%#{circled_window_index}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#I')%g" \ 1315 + # -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \ 1316 + # -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \ 1317 + # -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \ 1318 + # -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \ 1319 + # -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \ 1320 + # -e "s%#{username_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' true '#D')%g" \ 1321 + # -e "s%#{hostname_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true false '#h' '#D')%g" \ 1322 + # -e "s%#{hostname_full_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true true '#H' '#D')%g") 1323 + # 1324 + # window_status_format=$(printf '%s' "${window_status_format:-$(tmux show -gv window-status-format)}" | sed \ 1325 + # -e "s%#{circled_window_index}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#I')%g" \ 1326 + # -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \ 1327 + # -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \ 1328 + # -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \ 1329 + # -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \ 1330 + # -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \ 1331 + # -e "s%#{username_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' true '#D')%g" \ 1332 + # -e "s%#{hostname_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true false '#h' '#D')%g" \ 1333 + # -e "s%#{hostname_full_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true true '#H' '#D')%g") 1334 + # 1335 + # window_status_current_format=$(printf '%s' "${window_status_current_format:-$(tmux show -gv window-status-current-format)}" | sed \ 1336 + # -e "s%#{circled_window_index}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#I')%g" \ 1337 + # -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \ 1338 + # -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \ 1339 + # -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \ 1340 + # -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \ 1341 + # -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \ 1342 + # -e "s%#{username_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' true '#D')%g" \ 1343 + # -e "s%#{hostname_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true false '#h' '#D')%g" \ 1344 + # -e "s%#{hostname_full_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true true '#H' '#D')%g") 1345 + # 1346 + # status_left=$(printf '%s' "${status_left-$(tmux show -gv status-left)}" | sed \ 1347 + # -e "s/#{pairing}/#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ 1348 + # -e "s/#{prefix}/#{?client_prefix,$tmux_conf_theme_prefix ,$(printf '%s' "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ 1349 + # -e "s/#{mouse}/#{?mouse,$tmux_conf_theme_mouse ,$(printf '%s' "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \ 1350 + # -e "s%#{synchronized}%#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ 1351 + # -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \ 1352 + # -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \ 1353 + # -e "s%#{root}%#{?#{==:#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' '#D'),root},$tmux_conf_theme_root,}%g") 1354 + # 1355 + # status_right=$(printf '%s' "${status_right-$(tmux show -gv status-right)}" | sed \ 1356 + # -e "s/#{pairing}/#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ 1357 + # -e "s/#{prefix}/#{?client_prefix,$tmux_conf_theme_prefix ,$(printf '%s' "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ 1358 + # -e "s/#{mouse}/#{?mouse,$tmux_conf_theme_mouse ,$(printf '%s' "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \ 1359 + # -e "s%#{synchronized}%#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ 1360 + # -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \ 1361 + # -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \ 1362 + # -e "s%#{root}%#{?#{==:#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' '#D'),root},$tmux_conf_theme_root,}%g") 1363 + # 1364 + # tmux_conf_battery_bar_symbol_full=$(_decode_unicode_escapes "${tmux_conf_battery_bar_symbol_full:-◼}") 1365 + # tmux_conf_battery_bar_symbol_empty=$(_decode_unicode_escapes "${tmux_conf_battery_bar_symbol_empty:-◻}") 1366 + # tmux_conf_battery_bar_length=${tmux_conf_battery_bar_length:-auto} 1367 + # tmux_conf_battery_bar_palette=${tmux_conf_battery_bar_palette:-gradient} 1368 + # tmux_conf_battery_hbar_palette=${tmux_conf_battery_hbar_palette:-gradient} 1369 + # tmux_conf_battery_vbar_palette=${tmux_conf_battery_vbar_palette:-gradient} 1370 + # tmux_conf_battery_status_charging=$(_decode_unicode_escapes "${tmux_conf_battery_status_charging:-↑}") # U+2191 1371 + # tmux_conf_battery_status_discharging=$(_decode_unicode_escapes "${tmux_conf_battery_status_discharging:-↓}") # U+2193 1372 + # 1373 + # _pkillf 'sh -s _battery_info' 1374 + # _battery_info 1375 + # if [ "$battery_charge" != 0 ]; then 1376 + # case "$status_left $status_right" in 1377 + # *'#{battery_'*|*'#{?battery_'*) 1378 + # status_left=$(echo "$status_left" | sed -E \ 1379 + # -e 's%#\{\?battery_bar%#\{?@battery_percentage%g' \ 1380 + # -e 's%#\{\?battery_hbar%#\{?@battery_percentage%g' \ 1381 + # -e 's%#\{\?battery_vbar%#\{?@battery_percentage%g' \ 1382 + # -e "s%#\{battery_bar\}%#(nice cut -c3- '$TMUX_CONF' | sh -s _bar '$(printf '%s' "$tmux_conf_battery_bar_palette" | tr ',' ';')' '$tmux_conf_battery_bar_symbol_empty' '$tmux_conf_battery_bar_symbol_full' '$tmux_conf_battery_bar_length' '#{@battery_charge}' '#{client_width}')%g" \ 1383 + # -e "s%#\{battery_hbar\}%#(nice cut -c3- '$TMUX_CONF' | sh -s _hbar '$(printf '%s' "$tmux_conf_battery_hbar_palette" | tr ',' ';')' '#{@battery_charge}')%g" \ 1384 + # -e "s%#\{battery_vbar\}%#(nice cut -c3- '$TMUX_CONF' | sh -s _vbar '$(printf '%s' "$tmux_conf_battery_vbar_palette" | tr ',' ';')' '#{@battery_charge}')%g" \ 1385 + # -e 's%#\{(\?)?battery_status%#\{\1@battery_status%g' \ 1386 + # -e 's%#\{(\?)?battery_percentage%#\{\1@battery_percentage%g') 1387 + # status_right=$(echo "$status_right" | sed -E \ 1388 + # -e 's%#\{\?battery_bar%#\{?@battery_percentage%g' \ 1389 + # -e 's%#\{\?battery_hbar%#\{?@battery_percentage%g' \ 1390 + # -e 's%#\{\?battery_vbar%#\{?@battery_percentage%g' \ 1391 + # -e "s%#\{battery_bar\}%#(nice cut -c3- '$TMUX_CONF' | sh -s _bar '$(printf '%s' "$tmux_conf_battery_bar_palette" | tr ',' ';')' '$tmux_conf_battery_bar_symbol_empty' '$tmux_conf_battery_bar_symbol_full' '$tmux_conf_battery_bar_length' '#{@battery_charge}' '#{client_width}')%g" \ 1392 + # -e "s%#\{battery_hbar\}%#(nice cut -c3- '$TMUX_CONF' | sh -s _hbar '$(printf '%s' "$tmux_conf_battery_hbar_palette" | tr ',' ';')' '#{@battery_charge}')%g" \ 1393 + # -e "s%#\{battery_vbar\}%#(nice cut -c3- '$TMUX_CONF' | sh -s _vbar '$(printf '%s' "$tmux_conf_battery_vbar_palette" | tr ',' ';')' '#{@battery_charge}')%g" \ 1394 + # -e 's%#\{(\?)?battery_status%#\{\1@battery_status%g' \ 1395 + # -e 's%#\{(\?)?battery_percentage%#\{\1@battery_percentage%g') 1396 + # status_right="#(echo; nice cut -c3- '$TMUX_CONF' | sh -s _battery_status '$tmux_conf_battery_status_charging' '$tmux_conf_battery_status_discharging')$status_right" 1397 + # interval=60 1398 + # if [ "$_tmux_version" -eq 3500 ]; then 1399 + # tmux run -b "exec sh -c 'trap \"[ -n \\\\\"\\\\\$sleep_pid\\\\\" ] && kill -9 \\\\\"\\\\\$sleep_pid\\\\\"; exit 0\" TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S \"#{socket_path}\" display -p \"#{l:#{pid}}\")\" = \"#{pid}\" ]; do nice cut -c3- \"$TMUX_CONF\" | sh -s _battery_info; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done'" 1400 + # elif [ "$_tmux_version" -ge 3200 ]; then 1401 + # tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done" 1402 + # elif [ "$_tmux_version" -ge 2800 ]; then 1403 + # status_right="#(echo; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; sleep $interval; done)$status_right" 1404 + # elif [ "$_tmux_version" -gt 2400 ]; then 1405 + # status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; sleep $interval; done)$status_right" 1406 + # else 1407 + # status_right="#(nice cut -c3- '$TMUX_CONF' | sh -s _battery_info)$status_right" 1408 + # fi 1409 + # ;; 1410 + # esac 1411 + # fi 1412 + # 1413 + # case "$status_left $status_right" in 1414 + # *'#{username}'*|*'#{hostname}'*|*'#{hostname_full}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*|*'#{hostname_full_ssh}'*) 1415 + # status_left=$(echo "$status_left" | sed \ 1416 + # -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \ 1417 + # -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \ 1418 + # -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \ 1419 + # -e "s%#{username_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' true '#D')%g" \ 1420 + # -e "s%#{hostname_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true false '#h' '#D')%g" \ 1421 + # -e "s%#{hostname_full_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true true '#H' '#D')%g") 1422 + # status_right=$(echo "$status_right" | sed \ 1423 + # -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \ 1424 + # -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \ 1425 + # -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \ 1426 + # -e "s%#{username_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' true '#D')%g" \ 1427 + # -e "s%#{hostname_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true false '#h' '#D')%g" \ 1428 + # -e "s%#{hostname_full_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true true '#H' '#D')%g") 1429 + # ;; 1430 + # esac 1431 + # 1432 + # _pkillf 'sh -s _uptime' 1433 + # case "$status_left $status_right" in 1434 + # *'#{uptime_'*|*'#{?uptime_'*) 1435 + # status_left=$(echo "$status_left" | perl -p -e ' 1436 + # ; s/#\{(\?)?uptime_y\b/#\{\1\@uptime_y/g 1437 + # ; s/#\{(\?)?uptime_d\b/#\{\1\@uptime_d/g 1438 + # ; s/\@uptime_d\b/\@uptime_dy/g if /\@uptime_y\b/ 1439 + # ; s/#\{(\?)?uptime_h\b/#\{\1\@uptime_h/g 1440 + # ; s/#\{(\?)?uptime_m\b/#\{\1\@uptime_m/g 1441 + # ; s/#\{(\?)?uptime_s\b/#\{\1\@uptime_s/g') 1442 + # status_right=$(echo "$status_right" | perl -p -e ' 1443 + # ; s/#\{(\?)?uptime_y\b/#\{\1\@uptime_y/g 1444 + # ; s/#\{(\?)?uptime_d\b/#\{\1\@uptime_d/g 1445 + # ; s/\@uptime_d\b/\@uptime_dy/g if /\@uptime_y\b/ 1446 + # ; s/#\{(\?)?uptime_h\b/#\{\1\@uptime_h/g 1447 + # ; s/#\{(\?)?uptime_m\b/#\{\1\@uptime_m/g 1448 + # ; s/#\{(\?)?uptime_s\b/#\{\1\@uptime_s/g') 1449 + # interval=60 1450 + # case "$status_left $status_right" in 1451 + # *'#{@uptime_s}'*) 1452 + # interval=$(tmux show -gv status-interval) 1453 + # ;; 1454 + # esac 1455 + # if [ "$_tmux_version" -eq 3500 ]; then 1456 + # tmux run -b "exec sh -c 'trap \"[ -n \\\\\"\\\\\$sleep_pid\\\\\" ] && kill -9 \\\\\"\\\\\$sleep_pid\\\\\"; exit 0\" TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S \"#{socket_path}\" display -p \"#{l:#{pid}}\")\" = \"#{pid}\" ]; do nice cut -c3- \"$TMUX_CONF\" | sh -s _uptime; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done'" 1457 + # elif [ "$_tmux_version" -ge 3200 ]; then 1458 + # tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done" 1459 + # elif [ "$_tmux_version" -ge 2800 ]; then 1460 + # status_right="#(echo; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval; done)$status_right" 1461 + # elif [ "$_tmux_version" -gt 2400 ]; then 1462 + # status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval; done)$status_right" 1463 + # else 1464 + # status_right="#(nice cut -c3- '$TMUX_CONF' | sh -s _uptime)$status_right" 1465 + # fi 1466 + # ;; 1467 + # esac 1468 + # 1469 + # _pkillf 'sh -s _loadavg' 1470 + # case "$status_left $status_right" in 1471 + # *'#{loadavg'*|*'#{?loadavg'*) 1472 + # status_left=$(echo "$status_left" | sed -E \ 1473 + # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') 1474 + # status_right=$(echo "$status_right" | sed -E \ 1475 + # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') 1476 + # interval=$(tmux show -gv status-interval) 1477 + # if [ "$_tmux_version" -eq 3500 ]; then 1478 + # tmux run -b "exec sh -c 'trap \"[ -n \\\\\"\\\\\$sleep_pid\\\\\" ] && kill -9 \\\\\"\\\\\$sleep_pid\\\\\"; exit 0\" TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S \"#{socket_path}\" display -p \"#{l:#{pid}}\")\" = \"#{pid}\" ]; do nice cut -c3- \"$TMUX_CONF\" | sh -s _loadavg; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done'" 1479 + # elif [ "$_tmux_version" -ge 3200 ]; then 1480 + # tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done" 1481 + # elif [ "$_tmux_version" -ge 2800 ]; then 1482 + # status_right="#(echo; while [ \"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = \"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval; done)$status_right" 1483 + # elif [ "$_tmux_version" -gt 2400 ]; then 1484 + # status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval; done)$status_right" 1485 + # else 1486 + # status_right="#(nice cut -c3- '$TMUX_CONF' | sh -s _loadavg)$status_right" 1487 + # fi 1488 + # ;; 1489 + # esac 1490 + # 1491 + # # -- custom variables ------------------------------------------------------ 1492 + # 1493 + # if [ -f "$TMUX_CONF_LOCAL" ] && [ "$(cut -c3- "$TMUX_CONF_LOCAL" | sh 2>/dev/null -s printf probe)" = "probe" ]; then 1494 + # replacements=$(perl -n -e 'print if s!^#\s+([^_][^()\s]+)\s*\(\)\s*{\s*(?:#.*)?\n!s%#\\\{\1((?:\\s+(?:[^\{\}]+?|#\\{(?:[^\{\}]+?)\}))*)\\\}%#(cut -c3- \"\\\$TMUX_CONF_LOCAL\" | sh -s \1\\1)%g; !p' "$TMUX_CONF_LOCAL") 1495 + # status_left=$(echo "$status_left" | perl -p -e "$replacements" || echo "$status_left") 1496 + # status_right=$(echo "$status_right" | perl -p -e "$replacements" || echo "$status_right") 1497 + # fi 1498 + # 1499 + # # -------------------------------------------------------------------------- 1500 + # 1501 + # tmux set -g set-titles-string "$(_decode_unicode_escapes "$set_titles_string")" \;\ 1502 + # setw -g window-status-format "$(_decode_unicode_escapes "$window_status_format")" \;\ 1503 + # setw -g window-status-current-format "$(_decode_unicode_escapes "$window_status_current_format")" \;\ 1504 + # set -g status-left-length 1000 \; set -g status-left "$(_decode_unicode_escapes "$status_left")" \;\ 1505 + # set -g status-right-length 1000 \; set -g status-right "$(_decode_unicode_escapes "$status_right")" 1506 + # } 1507 + # 1508 + # __apply_plugins() { 1509 + # TMUX_PLUGIN_MANAGER_PATH="$1" 1510 + # window_active="$2" 1511 + # tmux_conf_update_plugins_on_launch="$3" 1512 + # tmux_conf_update_plugins_on_reload="$4" 1513 + # tmux_conf_uninstall_plugins_on_reload="$5" 1514 + # 1515 + # if [ -z "$TMUX_PLUGIN_MANAGER_PATH" ]; then 1516 + # return 255 1517 + # fi 1518 + # mkdir -p "$TMUX_PLUGIN_MANAGER_PATH" 1519 + # 1520 + # __discover_plugins() ( 1521 + # probe_socket="$(dirname "$TMUX_SOCKET")/tmux-discover-plugins-$$" 1522 + # TMUX_SOCKET="$probe_socket" tmux -f /dev/null start-server \; set-option exit-empty off 1523 + # ___discover_plugins() { 1524 + # depth=$((${depth:-0} + 1)) 1525 + # IFS=${_IFS:-$IFS} 1526 + # [ "$depth" -le 100 ] || return 1527 + # for current_file in "$@"; do 1528 + # current_file="$(cd "${current_file%/*}" 2>/dev/null && pwd)/${current_file##*/}" || continue 1529 + # while IFS= read -r line; do 1530 + # if plugin=$(printf '%s\n' "$line" | perl -s -n -E 'print if s/^set-option\s+-g\s+\@plugin\s+//g or die' 2>/dev/null); then 1531 + # discovered_plugins="${discovered_plugins}${discovered_plugins:+ }${plugin}" 1532 + # elif next_files=$(printf '%s\n' "$line" | perl -s -n -E 's/(?<!\@)current_file/\@current_file/g ; print if s/^source(?:-file)?(?:\s+-[qF]+)*\s*(.+?)$/\1/g or die' 2>/dev/null); then 1533 + # next_files=$(TMUX_SOCKET="$probe_socket" tmux -f /dev/null \ 1534 + # set -g @current_file "$current_file" \; \ 1535 + # display -pF "$next_files") 1536 + # 1537 + # _IFS="$IFS" 1538 + # IFS=$(printf '\n\nx') 1539 + # IFS=${IFS%?} 1540 + # # we don't want quoting here as we want wildcard expansion 1541 + # # shellcheck disable=SC2046 1542 + # ___discover_plugins $(printf '%s\n' "$next_files" | xargs printf '%s\n\n') 1543 + # fi 1544 + # done << EOF 1545 + # $(TMUX_SOCKET="$probe_socket" tmux -f /dev/null source -nvq "$current_file" | perl -s -n -E 'print if s/^$current_file:\d+:\s*(set-option\s+-g\s+\@plugin\s+|source-file)/\1/g' -- -current_file="$current_file") 1546 + # EOF 1547 + # done 1548 + # } 1549 + # ___discover_plugins "$@" 1550 + # TMUX_SOCKET="$probe_socket" tmux -f /dev/null kill-server 1551 + # rm -rf "$probe_socket" 1552 + # printf '%s\n' "$discovered_plugins" 1553 + # ) 1554 + # 1555 + # tpm_plugins=$(tmux show -gvq '@tpm_plugins' 2>/dev/null) 1556 + # tpm_plugins=$(cat << EOF | tr ' ' '\n' | awk '/^\s*$/ {next;}; !seen[$0]++ { gsub(/^[ \t]+/,"",$0); gsub(/[ \t]+$/,"",$0); print $0 }' 1557 + # $tpm_plugins 1558 + # $(__discover_plugins "$TMUX_CONF_LOCAL") 1559 + # EOF 1560 + # ) 1561 + # if [ -z "$tpm_plugins" ]; then 1562 + # if _is_true "$tmux_conf_uninstall_plugins_on_reload" && [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then 1563 + # tmux display 'Uninstalling tpm and plugins...' 1564 + # tmux set-environment -gu TMUX_PLUGIN_MANAGER_PATH 1565 + # rm -rf "$TMUX_PLUGIN_MANAGER_PATH" 1566 + # tmux display 'Done uninstalling tpm and plugins...' 1567 + # fi 1568 + # else 1569 + # if [ "$(command tmux display -p '#{pid} #{version} #{socket_path}')" = "$("$TMUX_PROGRAM" display -p '#{pid} #{version} #{socket_path}')" ]; then 1570 + # tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH" 1571 + # tmux set -g '@tpm_plugins' "$tpm_plugins" 1572 + # 1573 + # if [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then 1574 + # [ -z "$(tmux show -gqv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I' 1575 + # [ -z "$(tmux show -gqv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u' 1576 + # [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u' 1577 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" || tmux display "One or more tpm plugin(s) failed" 1578 + # fi 1579 + # 1580 + # if git ls-remote -hq https://github.com/gpakosz/.tmux.git master > /dev/null; then 1581 + # if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then 1582 + # install_tpm=true 1583 + # tmux display 'Installing tpm and plugins...' 1584 + # git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm" 1585 + # elif { [ -z "$window_active" ] && _is_true "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_true "$tmux_conf_update_plugins_on_reload"; }; then 1586 + # update_tpm=true 1587 + # tmux display 'Updating tpm and plugins...' 1588 + # (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git fetch -q -p && git checkout -q master && git reset -q --hard origin/master) 1589 + # fi 1590 + # if [ "$install_tpm" = "true" ] || [ "$update_tpm" = "true" ]; then 1591 + # perl -0777 -p -i -e 's/git clone(?!\s+--depth\s+1)/git clone --depth 1/g 1592 + # ;s/(install_plugin(.(?!&))*)\n(\s+)done/\1&\n\3done\n\3wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh" 1593 + # perl -p -i -e 's/git submodule update --init --recursive(?!\s+--depth\s+1)/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh" 1594 + # perl -p -i -e 's,\$tmux_file\s+>/dev/null\s+2>\&1,$& || { tmux display "Plugin \$(basename \${plugin_path}) failed" && false; },' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/source_plugins.sh" 1595 + # fi 1596 + # if [ "$update_tpm" = "true" ]; then 1597 + # { 1598 + # { 1599 + # printf 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | _timestamp 1600 + # printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | _timestamp 1601 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | _timestamp 1602 + # printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins all" | _timestamp 1603 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all 2>&1 | _timestamp 1604 + # printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins all" | _timestamp 1605 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all 2>&1 | _timestamp 1606 + # printf 'Done.\n' | _timestamp 1607 + # printf '\n' 1608 + # } >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 1609 + # 1610 + # tmux display 'Done updating tpm and plugins...' 1611 + # } || tmux display 'Failed updating tpm and plugins...' 1612 + # elif [ "$install_tpm" = "true" ]; then 1613 + # { 1614 + # { 1615 + # printf 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | _timestamp 1616 + # printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | _timestamp 1617 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | _timestamp 1618 + # printf 'Done.\n' | _timestamp 1619 + # printf '\n' >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 1620 + # } >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 1621 + # 1622 + # tmux display 'Done installing tpm and plugins...' 1623 + # 1624 + # [ -z "$(tmux show -gqv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I' 1625 + # [ -z "$(tmux show -gqv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u' 1626 + # [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u' 1627 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" || tmux display "One or more tpm plugin(s) failed" 1628 + # } || tmux display 'Failed installing tpm and plugins...' 1629 + # fi 1630 + # else 1631 + # tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..." 1632 + # fi 1633 + # else 1634 + # if [ "$_tmux_version" -ge 3200 ]; then 1635 + # tmux run -b "exec sh -c 'sleep \$((#{display-time} / 1000)) && \"$TMUX_PROGRAM\" display -N -d 3000 \"Cannot use tpm which assumes a globally installed tmux\"'" 1636 + # else 1637 + # tmux run -b "exec sh -c 'sleep \$((#{display-time} / 1000)) && \"$TMUX_PROGRAM\" set display-time 3000 \; display \"Cannot use tpm which assumes a globally installed tmux\" \; set -u display-time'" 1638 + # fi 1639 + # fi 1640 + # 1641 + # if [ "$_tmux_version" -gt 2600 ]; then 1642 + # tmux set -gu '@tpm-install' \; set -gu '@tpm-update' \; set -gu '@tpm-clean' \; set -gu '@plugin' \; set -gu '@tpm_plugins' 1643 + # else 1644 + # tmux set -g '@tpm-install' '' \; set -g '@tpm-update' '' \; set -g '@tpm-clean' '' \; set -g '@plugin' '' \; set-gu '@tpm_plugins' '' 1645 + # fi 1646 + # fi 1647 + # } 1648 + # 1649 + # _apply_plugins() { 1650 + # tmux_conf_update_plugins_on_launch=${tmux_conf_update_plugins_on_launch:-true} 1651 + # tmux_conf_update_plugins_on_reload=${tmux_conf_update_plugins_on_reload:-true} 1652 + # tmux_conf_uninstall_plugins_on_reload=${tmux_conf_uninstall_plugins_on_reload:-true} 1653 + # 1654 + # if [ -z "$TMUX_PLUGIN_MANAGER_PATH" ]; then 1655 + # if [ "$(dirname "$TMUX_CONF")" = "$HOME" ]; then 1656 + # TMUX_PLUGIN_MANAGER_PATH="$HOME/.tmux/plugins" 1657 + # else 1658 + # TMUX_PLUGIN_MANAGER_PATH="$(dirname "$TMUX_CONF")/plugins" 1659 + # fi 1660 + # fi 1661 + # tmux run -b "cut -c3- '$TMUX_CONF' | sh -s __apply_plugins '$TMUX_PLUGIN_MANAGER_PATH' '$window_active' '$tmux_conf_update_plugins_on_launch' '$tmux_conf_update_plugins_on_reload' '$tmux_conf_uninstall_plugins_on_reload'" 1662 + # } 1663 + # 1664 + # _apply_important() { 1665 + # cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT 1666 + # 1667 + # if perl -n -e 'print if /^\s*(?:set|bind|unbind).+?#!important\s*$/' "$TMUX_CONF_LOCAL" 2>/dev/null > "$cfg.local"; then 1668 + # if ! tmux source-file "$cfg.local"; then 1669 + # if tmux source-file -v /dev/null 2> /dev/null; then 1670 + # verbose_flag='-v' 1671 + # fi 1672 + # while ! out=$(tmux source-file "${verbose_flag:+$verbose_flag}" "$cfg.local"); do 1673 + # line=$(printf "%s" "$out" | tail -1 | cut -d':' -f2) 1674 + # perl -n -i -e "if ($. != $line) { print }" "$cfg.local" 1675 + # done 1676 + # fi 1677 + # fi 1678 + # } 1679 + # 1680 + # _apply_configuration() { 1681 + # window_active="$(tmux display -p '#{window_active}' 2>/dev/null || true)" 1682 + # if [ -z "$window_active" ]; then 1683 + # if [ "$_tmux_version" -lt 2600 ]; then 1684 + # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires tmux 2.6+" \; set -u display-time \; run "sleep 3" \; kill-server' 1685 + # return 1686 + # fi 1687 + # if [ "$_tmux_version" -ge 3200 ]; then 1688 + # for cmd in perl sed awk; do 1689 + # if ! command -v "$cmd" > /dev/null 2>&1; then 1690 + # tmux run -b "tmux display -N -d 3000 'This configuration requires $cmd' \; run 'sleep 3' \; kill-server" 1691 + # return 1692 + # fi 1693 + # done 1694 + # else 1695 + # for cmd in perl sed awk; do 1696 + # if ! command -v "$cmd" > /dev/null 2>&1; then 1697 + # tmux run -b "tmux set display-time 3000 \; display 'This configuration requires $cmd' \; set -u display-time \; run 'sleep 3' \; kill-server" 1698 + # return 1699 + # fi 1700 + # done 1701 + # fi 1702 + # fi 1703 + # 1704 + # case "$_uname_s" in 1705 + # *CYGWIN*|*MSYS*) 1706 + # # prevent Cygwin and MSYS2 from cd-ing into home directory when evaluating /etc/profile 1707 + # tmux setenv -g CHERE_INVOKING 1 1708 + # ;; 1709 + # esac 1710 + # 1711 + # _apply_tmux_256color 1712 + # _apply_24b& 1713 + # _apply_theme& 1714 + # _apply_bindings& 1715 + # wait 1716 + # 1717 + # _apply_plugins 1718 + # _apply_important 1719 + # 1720 + # # shellcheck disable=SC2046 1721 + # tmux setenv -gu tmux_conf_dummy $(printenv | grep -E -o '^tmux_conf_[^=]+' | awk '{printf "; setenv -gu %s", $0}') 1722 + # } 1723 + # 1724 + # _urlview() { 1725 + # pane_id="$1"; shift 1726 + # tmux capture-pane -J -S - -E - -b "urlview-$pane_id" -t "$pane_id" 1727 + # tmux split-window "'$TMUX_PROGRAM' ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} show-buffer -b 'urlview-$pane_id' | urlview || true; '$TMUX_PROGRAM' ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} delete-buffer -b 'urlview-$pane_id'" 1728 + # } 1729 + # 1730 + # _urlscan() { 1731 + # pane_id="$1"; shift 1732 + # tmux capture-pane -J -S - -E - -b "urlscan-$pane_id" -t "$pane_id" 1733 + # tmux split-window "'$TMUX_PROGRAM' ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} show-buffer -b 'urlscan-$pane_id' | urlscan $* || true; '$TMUX_PROGRAM' ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} delete-buffer -b 'urlscan-$pane_id'" 1734 + # } 1735 + # 1736 + # _fpp() { 1737 + # tmux capture-pane -J -S - -E - -b "fpp-$1" -t "$1" 1738 + # tmux split-window -c "$2" "'$TMUX_PROGRAM' ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} show-buffer -b 'fpp-$1' | fpp || true; '$TMUX_PROGRAM' ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} delete-buffer -b 'fpp-$1'" 1739 + # } 1740 + # 1741 + # "$@"
+33
tmux/scripts/get-icons
··· 1 + #!/bin/zsh 2 + 3 + get_icons() { 4 + local session_name="$1" 5 + local result="" 6 + 7 + local panes=($(tmux list-panes -t "$session_name" -F '#{pane_current_command}')) 8 + 9 + for i in "${panes[@]}"; do 10 + case "$i" in 11 + nvim) result+=" " ;; 12 + ssh) result+="󰒒 " ;; 13 + meow) result+=" " ;; 14 + nano) result+=" " ;; 15 + cargo) result+=" " ;; 16 + maid) result+="󰃢 " ;; 17 + pnpm) result+=" " ;; 18 + node) result+="⬢ " ;; 19 + ncdu) result+=" " ;; 20 + htop | btop | top | pumas) result+="󱔓 " ;; 21 + zsh | *) result+=" " ;; 22 + esac 23 + done 24 + 25 + echo "$result" 26 + } 27 + 28 + if (( $# != 1 )); then 29 + echo "Usage: $0 <session-name>" 30 + exit 1 31 + fi 32 + 33 + get_icons "$1"