Config and setup files

initial commit

finxol.io ecd1fcfc

+3009
+8
.config/ghostty/config
··· 1 + confirm-close-surface = false 2 + window-padding-color = background 3 + theme = peppermint 4 + cursor-style = block 5 + cursor-style-blink = false 6 + shell-integration-features = no-cursor 7 + mouse-hide-while-typing = true 8 + font-family = "MonoLisa Script"
+10
.config/sprinkles/global.css
··· 1 + /* This is Sprinkles' global.css. 2 + * 3 + * The styles you add here will be added to every page you visit. 4 + * 5 + * To add styles specific to a single domain, create files in this directory, named 6 + * after the (full) domain, eg. "twitter.com.css" or "subdomain.example.com.css". 7 + * 8 + * For example, uncomment the line below to get an extra creamy web experience: */ 9 + 10 + /* body { background-color: papayawhip; } */
+14
.config/sprinkles/global.js
··· 1 + // This is Sprinkles' global.js. 2 + // 3 + // The JavaScript code you add here will be run on every page you visit. 4 + // 5 + // To add scripts specific to a single domain, create files in this directory, name 6 + // after the domain, eg. "twitter.com.js" or "subdomain.example.com.js". 7 + // 8 + // For example, uncomment the lines below to change every image on the web to random new one: 9 + 10 + // for (const elm of document.querySelectorAll("img")) { 11 + // elm.src = `//picsum.photos/${elm.width}` 12 + // } 13 + 14 + console.log("sprinkles running")
+4
.config/sprinkles/pepite-bretagne.pepitizy.fr.css
··· 1 + * { 2 + color: #1c1c1c; 3 + font-family: "Roboto", sans-serif !important; 4 + }
+23
.config/sprinkles/www.mycecurity.com.css
··· 1 + /* Styles for My Cecurity */ 2 + 3 + :root { 4 + --color-secondary-orange: rgb(185, 73, 1); 5 + --color-primary-blue: 70, 155, 230; 6 + } 7 + 8 + .bg-monochrome-6 { 9 + background-color: rgb(225, 225, 225); 10 + } 11 + 12 + body { 13 + filter: invert(1) hue-rotate(180deg); 14 + background: #000; 15 + } 16 + 17 + object[type="application/pdf"] .page { 18 + filter: invert(1) hue-rotate(180deg); 19 + } 20 + 21 + .btn { 22 + border-radius: .5rem !important; 23 + }
+65
.config/sprinkles/www.mycecurity.com.js
··· 1 + console.log("Optimized Mycecurity sprinkle is running."); 2 + ("this is pretty cool"); 3 + 4 + /** 5 + * Finds and formats ISO date strings within a given DOM node and its children. 6 + * @param {Node} node The root node to search within. 7 + */ 8 + function formatDatesWithinNode(node) { 9 + // 1. Ensure the node is an element we can query. 10 + // This filters out text nodes, comments, etc. 11 + if (!(node instanceof Element)) { 12 + return; 13 + } 14 + 15 + // 2. Create a list of candidates to check: 16 + // - The node itself (if it's a potential candidate). 17 + // - All descendant elements that could contain a date. 18 + const candidates = [node, ...node.querySelectorAll("div, span, p, td")]; 19 + 20 + // 3. Filter the candidates to find only the ones with parsable dates. 21 + const dateElements = candidates.filter( 22 + (el) => el.textContent && !isNaN(Date.parse(el.textContent.trim())), 23 + ); 24 + 25 + // 4. Loop through and format the valid date elements. 26 + for (const element of dateElements) { 27 + // Skip elements we have already formatted to prevent errors. 28 + if (element.dataset.formatted) continue; 29 + 30 + const originalDate = element.textContent.trim(); 31 + element.textContent = new Date(originalDate).toLocaleDateString( 32 + "fr-FR", 33 + { 34 + year: "numeric", 35 + month: "numeric", 36 + day: "numeric", 37 + }, 38 + ); 39 + 40 + // Mark the element as formatted. 41 + element.dataset.formatted = "true"; 42 + } 43 + } 44 + 45 + // Create an observer that will run our function on specific added nodes. 46 + const observer = new MutationObserver((mutationsList) => { 47 + for (const mutation of mutationsList) { 48 + // We only care about 'childList' mutations (nodes being added/removed). 49 + if (mutation.type === "childList") { 50 + // For every node that was added, run our formatting function on it. 51 + for (const addedNode of mutation.addedNodes) { 52 + formatDatesWithinNode(addedNode); 53 + } 54 + } 55 + } 56 + }); 57 + 58 + // Start observing the entire body for changes to its descendants. 59 + observer.observe(document.body, { 60 + childList: true, 61 + subtree: true, 62 + }); 63 + 64 + // Finally, run the function once on the entire body for the initial page load. 65 + formatDatesWithinNode(document.body);
+24
.config/zed/keymap.json
··· 1 + [ 2 + { 3 + "bindings": { 4 + "cmd-ctrl-t": "workspace::NewTerminal", 5 + "cmd-ctrl-n": "workspace::NewFile", 6 + "cmd--": "zed::DecreaseBufferFontSize", 7 + "cmd-+": "zed::IncreaseBufferFontSize", 8 + "cmd-t": "file_finder::Toggle", 9 + "cmd-ctrl-c": "workspace::ToggleLeftDock", 10 + "cmd-ctrl-r": "workspace::ToggleRightDock", 11 + "cmd-ctrl-g": "git_panel::ToggleFocus", 12 + "cmd-ctrl-f": "project_panel::ToggleFocus", 13 + "cmd-1": "workspace::ToggleLeftDock", 14 + "cmd-2": "workspace::ToggleRightDock" 15 + } 16 + }, 17 + { 18 + "context": "Editor", 19 + "bindings": { 20 + "alt-up": "editor::MoveLineUp", 21 + "alt-down": "editor::MoveLineDown" 22 + } 23 + } 24 + ]
+81
.config/zed/settings.json
··· 1 + // For information on how to configure Zed, see the Zed 2 + // documentation: https://zed.dev/docs/configuring-zed 3 + // 4 + // To see all of Zed's default settings without changing your 5 + // custom settings, run the `open default settings` command 6 + // from the command palette or from `Zed` application menu. 7 + { 8 + "edit_predictions": { 9 + "mode": "eager", 10 + "copilot": { 11 + "proxy": null, 12 + "proxy_no_verify": null 13 + }, 14 + "enabled_in_text_threads": false 15 + }, 16 + "language_servers": ["!biome"], 17 + "languages": { 18 + "Plain Text": { 19 + "show_edit_predictions": false 20 + }, 21 + "Markdown": { 22 + "show_edit_predictions": false, 23 + "soft_wrap": "none" 24 + }, 25 + "Vue.js": { 26 + "language_servers": ["vls"], 27 + "formatter": "language_server" 28 + }, 29 + "Java": { 30 + "show_edit_predictions": true 31 + } 32 + }, 33 + "show_edit_predictions": true, 34 + "features": { 35 + "edit_prediction_provider": "zed" 36 + }, 37 + "agent": { 38 + "inline_assistant_model": { 39 + "provider": "zed.dev", 40 + "model": "claude-sonnet-4-latest" 41 + }, 42 + "default_model": { 43 + "provider": "zed.dev", 44 + "model": "claude-sonnet-4-thinking" 45 + }, 46 + "version": "2" 47 + }, 48 + "autosave": "on_focus_change", 49 + "base_keymap": "JetBrains", 50 + "vim_mode": true, 51 + "theme": "Ayu Dark", 52 + "wrap_guides": [80], 53 + "diagnostics": { 54 + "inline": { 55 + "enabled": true 56 + } 57 + }, 58 + "telemetry": { 59 + "diagnostics": true, 60 + "metrics": false 61 + }, 62 + "ui_font_size": 16, 63 + "buffer_font_size": 14.0, 64 + "buffer_font_family": "MonoLisa Script", 65 + "experimental.theme_overrides": { 66 + "syntax": { 67 + "comment": { 68 + "font_style": "italic", 69 + "font_family": "MonoLisa Script" 70 + }, 71 + "comment.doc": { 72 + "font_style": "italic", 73 + "font_family": "MonoLisa Script" 74 + } 75 + } 76 + }, 77 + "tab_size": 4, 78 + "file_types": { 79 + "Haskell": ["idr"] 80 + } 81 + }
+19
.gitconfig
··· 1 + [user] 2 + name = finxol 3 + email = git@finxol.io 4 + signingkey = A5BE641C6434A4FE 5 + [init] 6 + defaultBranch = main 7 + [commit] 8 + gpgsign = true 9 + [gpg] 10 + program = /opt/homebrew/bin/gpg 11 + [tag] 12 + gpgSign = true 13 + [gitbutler] 14 + aiModelProvider = ollama 15 + aiOllamaModelName = llama3.1 16 + 17 + ; Karr specific config 18 + [includeIf "gitdir:~/Karr/"] 19 + path = ~/Karr/code/.gitconfig
+1900
.oh-my-tmux/.tmux.conf
··· 1 + # : << 'EOF' 2 + # Oh my tmux! 3 + # 💛🩷💙🖤❤️🤍 4 + # https://github.com/gpakosz/.tmux 5 + # (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, 6 + # without any warranty. 7 + # Copyright 2012— Gregory Pakosz (@gpakosz). 8 + # 9 + # ------------------------------------------------------------------------------ 10 + # 🚨 DO NOT MODIFY THIS FILE 11 + # instead, override your .local customization file copy, see README.md 12 + # ------------------------------------------------------------------------------ 13 + 14 + 15 + # -- general ------------------------------------------------------------------- 16 + 17 + set -g default-terminal "screen-256color" 18 + 19 + %if #{||:#{m/ri:mintty|iTerm,#{TERM_PROGRAM}},#{!=:#{XTERM_VERSION},}} 20 + set -g extended-keys on # needed by Control + Shift bindings 21 + %endif 22 + set -s escape-time 10 # faster command sequences 23 + set -sg repeat-time 600 # increase repeat timeout 24 + set -s focus-events on 25 + 26 + set -g prefix2 C-a # GNU-Screen compatible prefix 27 + bind C-a send-prefix -2 28 + 29 + set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2) 30 + setw -q -g utf8 on 31 + 32 + set -g history-limit 5000 # boost history 33 + 34 + # edit configuration 35 + %if #{>=:#{version},3.0} 36 + 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"' 37 + %else 38 + set-environment -g EDITOR "$EDITOR" 39 + 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"' 40 + %endif 41 + 42 + # reload configuration 43 + bind r run "sh -c '\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} source \"\$TMUX_CONF\"'" \; display "#{TMUX_CONF} sourced" 44 + 45 + 46 + # -- display ------------------------------------------------------------------- 47 + 48 + set -g base-index 1 # start windows numbering at 1 49 + setw -g pane-base-index 1 # make pane numbering consistent with windows 50 + 51 + setw -g automatic-rename on # rename window to reflect current program 52 + set -g renumber-windows on # renumber windows when a window is closed 53 + 54 + set -g set-titles on # set terminal title 55 + 56 + set -g display-panes-time 800 # slightly longer pane indicators display time 57 + set -g display-time 1000 # slightly longer status messages display time 58 + 59 + set -g status-interval 10 # redraw status line every 10 seconds 60 + 61 + # clear both screen and history 62 + bind -n C-l send-keys C-l \; run 'sleep 0.2' \; clear-history 63 + 64 + # activity 65 + set -g monitor-activity on 66 + set -g visual-activity off 67 + 68 + 69 + # -- navigation ---------------------------------------------------------------- 70 + 71 + # create session 72 + bind C-c new-session 73 + 74 + # find session 75 + bind C-f command-prompt -p find-session 'switch-client -t %%' 76 + 77 + # session navigation 78 + bind BTab switch-client -l # move to last session 79 + 80 + # split current window horizontally 81 + bind - split-window -v 82 + # split current window vertically 83 + bind _ split-window -h 84 + 85 + # pane navigation 86 + bind -r h select-pane -L # move left 87 + bind -r j select-pane -D # move down 88 + bind -r k select-pane -U # move up 89 + bind -r l select-pane -R # move right 90 + bind > swap-pane -D # swap current pane with the next one 91 + bind < swap-pane -U # swap current pane with the previous one 92 + 93 + # maximize current pane 94 + bind + run "cut -c3- '#{TMUX_CONF}' | sh -s _maximize_pane '#{session_name}' '#D'" 95 + 96 + # pane resizing 97 + bind -r H resize-pane -L 2 98 + bind -r J resize-pane -D 2 99 + bind -r K resize-pane -U 2 100 + bind -r L resize-pane -R 2 101 + 102 + # window navigation 103 + unbind n 104 + unbind p 105 + bind -r C-h previous-window # select previous window 106 + bind -r C-l next-window # select next window 107 + bind -r C-S-H swap-window -t -1 \; select-window -t -1 # swap current window with the previous one 108 + bind -r C-S-L swap-window -t +1 \; select-window -t +1 # swap current window with the next one 109 + bind Tab last-window # move to last active window 110 + 111 + # toggle mouse 112 + bind m run "cut -c3- '#{TMUX_CONF}' | sh -s _toggle_mouse" 113 + 114 + 115 + # -- facebook pathpicker ------------------------------------------------------- 116 + 117 + bind F run "cut -c3- '#{TMUX_CONF}' | sh -s _fpp '#{pane_id}' '#{pane_current_path}'" 118 + 119 + 120 + # -- copy mode ----------------------------------------------------------------- 121 + 122 + bind Enter copy-mode # enter copy mode 123 + 124 + bind -T copy-mode-vi v send -X begin-selection 125 + bind -T copy-mode-vi C-v send -X rectangle-toggle 126 + bind -T copy-mode-vi y send -X copy-selection-and-cancel 127 + bind -T copy-mode-vi Escape send -X cancel 128 + bind -T copy-mode-vi H send -X start-of-line 129 + bind -T copy-mode-vi L send -X end-of-line 130 + 131 + # copy to X11 clipboard 132 + 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"' 133 + 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"' 134 + # copy to Wayland clipboard 135 + 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"' 136 + # copy to macOS clipboard 137 + if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - | pbcopy"' 138 + # copy to Windows clipboard 139 + 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"' 140 + if -b '[ -c /dev/clipboard ]' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - > /dev/clipboard"' 141 + 142 + 143 + # -- buffers ------------------------------------------------------------------- 144 + 145 + bind b list-buffers # list paste buffers 146 + bind p paste-buffer -p # paste from the top paste buffer 147 + bind P choose-buffer # choose which buffer to paste from 148 + 149 + 150 + # -- 8< ------------------------------------------------------------------------ 151 + 152 + %if #{==:#{TMUX_PROGRAM},} 153 + 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\"'" 154 + %endif 155 + %if #{==:#{TMUX_SOCKET},} 156 + run "exec sh -c '\"\$TMUX_PROGRAM\" -S #{socket_path} set-environment -g TMUX_SOCKET \"#{socket_path}\"'" 157 + %endif 158 + %if #{==:#{TMUX_CONF},} 159 + 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)'" 160 + %endif 161 + %if #{==:#{TMUX_CONF_LOCAL},} 162 + run "exec sh -c '\"\$TMUX_PROGRAM\" set-environment -g TMUX_CONF_LOCAL \"\$TMUX_CONF.local\"'" 163 + %endif 164 + 165 + run '"$TMUX_PROGRAM" -S #{socket_path} source "$TMUX_CONF_LOCAL"' 166 + run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' 167 + 168 + # EOF 169 + # 170 + # # exit the script if any statement returns a non-true return value 171 + # set -e 172 + # 173 + # unset SHELL 174 + # 175 + # unset GREP_OPTIONS 176 + # export LC_NUMERIC=C 177 + # # shellcheck disable=SC3041 178 + # if (set +H 2>/dev/null); then 179 + # set +H 180 + # fi 181 + # 182 + # if ! printf '' | sed -E 's///' 2>/dev/null; then 183 + # if printf '' | sed -r 's///' 2>/dev/null; then 184 + # sed() { 185 + # n=$#; while [ "$n" -gt 0 ]; do arg=$1; shift; case $arg in -E*) arg=-r${arg#-E};; esac; set -- "$@" "$arg"; n=$(( n - 1 )); done 186 + # command sed "$@" 187 + # } 188 + # fi 189 + # fi 190 + # 191 + # _uname_s=$(uname -s) 192 + # 193 + # [ -z "$TMUX" ] && exit 255 194 + # if [ -z "$TMUX_SOCKET" ]; then 195 + # TMUX_SOCKET=$(printf '%s' "$TMUX" | cut -d, -f1) 196 + # fi 197 + # if [ -z "$TMUX_PROGRAM" ]; then 198 + # TMUX_PID=$(printf '%s' "$TMUX" | cut -d, -f2) 199 + # 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) 200 + # [ "$("$TMUX_PROGRAM" -S "$TMUX_SOCKET" display -p '#{pid}' 2>/dev/null)" = "$TMUX_PID" ] || TMUX_PROGRAM=$(command -v tmux || printf tmux) 201 + # fi 202 + # if [ "$TMUX_PROGRAM" = "tmux" ]; then 203 + # tmux() { 204 + # command tmux ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} "$@" 205 + # } 206 + # else 207 + # tmux() { 208 + # "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} "$@" 209 + # } 210 + # fi 211 + # 212 + # _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)') 213 + # 214 + # _is_true() { 215 + # case "$1" in 216 + # true|yes|1) 217 + # return 0 218 + # ;; 219 + # *) 220 + # return 1 221 + # ;; 222 + # esac 223 + # } 224 + # 225 + # _is_enabled() { 226 + # [ "$1" = "enabled" ] 227 + # } 228 + # 229 + # _is_disabled() { 230 + # [ "$1" = "disabled" ] 231 + # } 232 + # 233 + # _circled() { 234 + # circled_digits='⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳' 235 + # if [ "$1" -le 20 ] 2>/dev/null; then 236 + # i=$(( $1 + 1 )) 237 + # eval set -- "$circled_digits" 238 + # eval echo "\${$i}" 239 + # else 240 + # echo "$1" 241 + # fi 242 + # } 243 + # 244 + # _decode_unicode_escapes() { 245 + # 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 246 + # } 247 + # 248 + # _pretty_path() { 249 + # max_length=${1:-auto}; shift 250 + # if [ "$max_length" = "auto" ]; then 251 + # max_length=$(($(tmux -q display -p '#{client_width}') / 4)) 252 + # fi 253 + # { cd "$*" && pwd || printf '%s' "$*"; } | perl -s -p -E ' 254 + # s|^$HOME|~|; 255 + # /^.{0,$max_length}$/ || s|(~/[^/]+)(/[^/]+)(?:/.+)?(/[^/]+)$|$1$2/...$3|g; 256 + # /^.{0,$max_length}$/ || s|(~/[^/]+)(/[^/]+)(?:/.+)(/[^/]+)$|$1/...$3|g;' -- -HOME="$HOME" -max_length="$max_length" 257 + # } 258 + # 259 + # if command -v pkill > /dev/null 2>&1; then 260 + # _pkillf() { 261 + # pkill -f "$@" || true 262 + # } 263 + # else 264 + # case "$_uname_s" in 265 + # *CYGWIN*) 266 + # _pkillf() { 267 + # while IFS= read -r pid; do 268 + # kill "$pid" || true 269 + # done << EOF 270 + # $(grep -Eao "$@" /proc/*/cmdline | xargs -0 | sed -E -n 's,/proc/([0-9]+)/.+$,\1,pg') 271 + # EOF 272 + # } 273 + # ;; 274 + # *) 275 + # # shellcheck disable=SC2009 276 + # _pkillf() { 277 + # while IFS= read -r pid; do 278 + # kill "$pid" || true 279 + # done << EOF 280 + # $(ps -x -o pid= -o command= | grep -E "$@" | cut -d' ' -f1) 281 + # EOF 282 + # } 283 + # ;; 284 + # esac 285 + # fi 286 + # 287 + # if perl -MTime::HiRes -e1; then 288 + # _timestamp() { 289 + # while IFS= read -r line; do 290 + # 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)' 291 + # done 292 + # } 293 + # else 294 + # case "$_uname_s" in 295 + # Darwin) 296 + # _timestamp() { 297 + # while IFS= read -r line; do 298 + # printf '[%s]\t%s\n' "$(date +"%Y-%m-%d %H:%M:%S.000")" "$line" 299 + # done 300 + # } 301 + # ;; 302 + # *) 303 + # _timestamp() { 304 + # while IFS= read -r line; do 305 + # printf '[%s]\t%s\n' "$(date +"%Y-%m-%d %H:%M:%S.%3N")" "$line" 306 + # done 307 + # } 308 + # ;; 309 + # esac 310 + # fi 311 + # 312 + # _bar() { 313 + # bar_palette=$(printf '%s' "$1" | tr ';' ',') 314 + # bar_symbol_empty=$2 315 + # bar_symbol_full=$3 316 + # bar_length=$4 # "auto" or number of columns 317 + # bar_value=$5 # value between 0 and 1 318 + # 319 + # if [ "$bar_length" = "auto" ]; then 320 + # columns=${6:-$(tmux -q display -p '#{client_width}' 2> /dev/null || echo 80)} 321 + # if [ "$columns" -ge 160 ]; then 322 + # bar_length=12 323 + # elif [ "$columns" -ge 130 ]; then 324 + # bar_length=10 325 + # elif [ "$columns" -ge 120 ]; then 326 + # bar_length=8 327 + # elif [ "$columns" -ge 100 ]; then 328 + # bar_length=6 329 + # else 330 + # bar_length=4 331 + # fi 332 + # fi 333 + # 334 + # 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 335 + # # shellcheck disable=SC2086 336 + # { set -f; IFS=', '; set -- $bar_palette; unset IFS; set +f; } 337 + # palette_style=$1 338 + # shift 339 + # 340 + # case "$palette_style" in 341 + # gradient) 342 + # palette="colour196 colour202 colour208 colour214 colour220 colour226 colour190 colour154 colour118 colour82 colour46" 343 + # ;; 344 + # heat) 345 + # palette="colour243 colour245 colour247 colour144 colour143 colour142 colour184 colour214 colour208 colour202 colour196" 346 + # ;; 347 + # gradient*) 348 + # palette=${palette_style##gradient(} 349 + # while [ $# -gt 0 ]; do 350 + # palette="$palette${1+ }${1%%)}" 351 + # [ "$1" != "${1%%)}" ] && break 352 + # shift 353 + # done 354 + # ;; 355 + # esac 356 + # bg=${2:-none} 357 + # 358 + # palette=$(printf '%s' "$palette" | awk -v n="$bar_length" '{ for (i = 0; i < n - 1; ++i) printf "%s ", $(1 + i * NF / n); printf $NF }') 359 + # # shellcheck disable=SC2086 360 + # set -- $palette 361 + # 362 + # full=$(awk "BEGIN { printf \"%.0f\", ($bar_value) * $bar_length }") 363 + # bar="#[bg=$bg]" 364 + # if [ "$full" -gt 0 ]; then 365 + # # shellcheck disable=SC2046 366 + # bar="$bar$(printf "#[fg=%s]$bar_symbol_full" $(printf '%s' "$palette" | cut -d' ' -f1-"$full"))" 367 + # fi 368 + # empty=$((bar_length - full)) 369 + # if [ "$empty" -gt 0 ]; then 370 + # # shellcheck disable=SC2046 371 + # bar="$bar$(printf "#[fg=%s]$bar_symbol_empty" $(printf '%s' "$palette" | cut -d' ' -f$((full + 1))-$((full + empty))))" 372 + # fi 373 + # eval bar="$bar#[fg=\${$((full == 0 ? 1 : full))}]" 374 + # elif printf '%s' "$bar_palette" | grep -q -E '^(([#a-zA-Z0-9]{7,9}|none),?){3}$'; then 375 + # # shellcheck disable=SC2086 376 + # { set -f; IFS=,; set -- $bar_palette; unset IFS; set +f; } 377 + # full_fg=$1 378 + # empty_fg=$2 379 + # bg=${3:-none} 380 + # 381 + # full=$(awk "BEGIN { printf \"%.0f\", ($bar_value) * $bar_length }") 382 + # bar="#[bg=$bg]" 383 + # if [ "$full" -gt 0 ]; then 384 + # bar="$bar#[fg=$full_fg]$(printf "%0.s$bar_symbol_full" $(seq 1 "$full"))" 385 + # fi 386 + # empty=$((bar_length - full)) 387 + # if [ "$empty" -gt 0 ]; then 388 + # bar="$bar#[fg=$empty_fg]$(printf "%0.s$bar_symbol_empty" $(seq 1 "$empty"))#[fg=$empty_fg]" 389 + # fi 390 + # fi 391 + # 392 + # printf '%s' "$bar" 393 + # } 394 + # 395 + # _hbar() { 396 + # hbar_palette=$(printf '%s' "$1" | tr ';' ',') 397 + # hbar_value=$2 398 + # 399 + # 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 400 + # # shellcheck disable=SC2086 401 + # { set -f; IFS=', '; set -- $hbar_palette; unset IFS; set +f; } 402 + # palette_style=$1 403 + # shift 404 + # 405 + # case "$palette_style" in 406 + # gradient) 407 + # palette="colour196 colour202 colour208 colour214 colour220 colour226 colour190 colour154 colour118 colour82 colour46" 408 + # ;; 409 + # heat) 410 + # palette="colour243 colour245 colour247 colour144 colour143 colour142 colour184 colour214 colour208 colour202 colour196" 411 + # ;; 412 + # gradient*) 413 + # palette=${palette_style##gradient(} 414 + # while [ $# -gt 0 ]; do 415 + # palette="$palette${1+ }${1%%)}" 416 + # [ "$1" != "${1%%)}" ] && break 417 + # shift 418 + # done 419 + # ;; 420 + # esac 421 + # bg=${2:-none} 422 + # 423 + # palette=$(printf '%s' "$palette" | awk -v n=8 '{ for (i = 0; i < n - 1; ++i) printf "%s ", $(1 + i * NF / n); printf $NF }') 424 + # # shellcheck disable=SC2086 425 + # set -- $palette 426 + # 427 + # full=$(awk "BEGIN { printf \"%.0f\", ($hbar_value) * 8 }") 428 + # eval hbar_fg="\${$((full == 0 ? 1 : full))}" 429 + # elif printf '%s' "$hbar_palette" | grep -q -E '^([#a-zA-Z0-9]{7,9},?){3}$'; then 430 + # # shellcheck disable=SC2086 431 + # { set -f; IFS=,; set -- $hbar_palette; unset IFS; set +f; } 432 + # 433 + # # shellcheck disable=SC2046 434 + # eval $(awk "BEGIN { printf \"hbar_fg=$%d\", (($hbar_value) - 0.001) * $# + 1 }") 435 + # fi 436 + # 437 + # set -- ▏ ▎ ▍ ▌ ▋ ▊ ▉ █ 438 + # # shellcheck disable=SC2046 439 + # eval $(awk "BEGIN { printf \"hbar_symbol=$%d\", ($hbar_value) * ($# - 1) + 1 }") 440 + # hbar="#[bg=$bg]#[fg=${hbar_fg?}]${hbar_symbol?}" 441 + # 442 + # printf '%s' "$hbar" 443 + # } 444 + # 445 + # _vbar() { 446 + # vbar_palette=$(printf '%s' "$1" | tr ';' ',') 447 + # vbar_value=$2 448 + # 449 + # 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 450 + # # shellcheck disable=SC2086 451 + # { set -f; IFS=', '; set -- $vbar_palette; unset IFS; set +f; } 452 + # palette_style=$1 453 + # shift 454 + # 455 + # case "$palette_style" in 456 + # gradient) 457 + # palette="colour196 colour202 colour208 colour214 colour220 colour226 colour190 colour154 colour118 colour82 colour46" 458 + # ;; 459 + # heat) 460 + # palette="colour243 colour245 colour247 colour144 colour143 colour142 colour184 colour214 colour208 colour202 colour196" 461 + # ;; 462 + # gradient*) 463 + # palette=${palette_style##gradient(} 464 + # while [ $# -gt 0 ]; do 465 + # palette="$palette${1+ }${1%%)}" 466 + # [ "$1" != "${1%%)}" ] && break 467 + # shift 468 + # done 469 + # ;; 470 + # esac 471 + # bg=${2:-none} 472 + # 473 + # palette=$(printf '%s' "$palette" | awk -v n=8 '{ for (i = 0; i < n - 1; ++i) printf "%s ", $(1 + i * NF / n); printf $NF }') 474 + # # shellcheck disable=SC2086 475 + # set -- $palette 476 + # 477 + # full=$(awk "BEGIN { printf \"%.0f\", ($vbar_value) * 8 }") 478 + # eval vbar_fg="\${$((full == 0 ? 1 : full))}" 479 + # elif printf '%s' "$vbar_palette" | grep -q -E '^([#a-zA-Z0-9]{7,9},?){3}$'; then 480 + # # shellcheck disable=SC2086 481 + # { set -f; IFS=,; set -- $vbar_palette; unset IFS; set +f; } 482 + # 483 + # # shellcheck disable=SC2046 484 + # eval $(awk "BEGIN { printf \"vbar_fg=$%d\", (($vbar_value) - 0.001) * $# + 1 }") 485 + # fi 486 + # 487 + # set -- ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ 488 + # # shellcheck disable=SC2046 489 + # eval $(awk "BEGIN { printf \"vbar_symbol=$%d\", ($vbar_value) * ($# - 1) + 1 }") 490 + # vbar="#[bg=$bg]#[fg=${vbar_fg?}]${vbar_symbol?}" 491 + # 492 + # printf '%s' "$vbar" 493 + # } 494 + # 495 + # _maximize_pane() { 496 + # current_session=${1:-$(tmux display -p '#{session_name}')} 497 + # current_pane=${2:-$(tmux display -p '#{pane_id}')} 498 + # 499 + # dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -E -o '^1 %.+maximized.+$' || true) 500 + # 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"\ 501 + # -e "s/^1 (%[0-9]+) .+maximized.+'$current_pane'\"?$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t \1/p") 502 + # 503 + # if [ -z "$restore" ]; then 504 + # [ "$(tmux list-panes -t "$current_session:" | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return 505 + # 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'") 506 + # session_window=${info%.*} 507 + # new_pane=${info#*.} 508 + # 509 + # retry=20 510 + # 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 511 + # sleep 0.1 512 + # retry=$((retry - 1)) 513 + # done 514 + # if [ "$retry" -eq 0 ]; then 515 + # tmux display 'Unable to maximize pane' 516 + # fi 517 + # 518 + # tmux setw -t "$session_window" remain-on-exit off \; swap-pane -s "$current_pane" -t "$new_pane" 519 + # else 520 + # $restore || tmux kill-pane 521 + # fi 522 + # } 523 + # 524 + # _toggle_mouse() { 525 + # old=$(tmux show -gv mouse) 526 + # new="" 527 + # 528 + # if [ "$old" = "on" ]; then 529 + # new="off" 530 + # else 531 + # new="on" 532 + # fi 533 + # 534 + # tmux set -g mouse $new 535 + # } 536 + # 537 + # _battery_info() { 538 + # battery_count=0 539 + # battery_charge=0 540 + # case "$_uname_s" in 541 + # *Darwin*) 542 + # while IFS= read -r line; do 543 + # [ -z "$line" ] && continue 544 + # percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%' || echo "0%") 545 + # battery_charge=$(awk -v charge="$battery_charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }') 546 + # battery_count=$((battery_count + 1)) 547 + # done << EOF 548 + # $(pmset -g batt | grep 'InternalBattery') 549 + # EOF 550 + # ;; 551 + # *Linux*) 552 + # while IFS= read -r batpath; do 553 + # [ -z "$batpath" ] && continue 554 + # grep -i -q device "$batpath/scope" 2> /dev/null && continue 555 + # 556 + # bat_capacity="$batpath/capacity" 557 + # if [ -r "$bat_capacity" ]; then 558 + # battery_charge=$(awk -v charge="$battery_charge" -v capacity="$(cat "$bat_capacity")" 'BEGIN { print charge + (capacity > 100 ? 100 : capacity) / 100 }') 559 + # else 560 + # bat_energy_full="$batpath/energy_full" 561 + # bat_energy_now="$batpath/energy_now" 562 + # if [ -r "$bat_energy_full" ] && [ -r "$bat_energy_now" ]; then 563 + # 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 }') 564 + # fi 565 + # fi 566 + # battery_count=$((battery_count + 1)) 567 + # done << EOF 568 + # $(find /sys/class/power_supply -maxdepth 1 -iname '*bat*') 569 + # EOF 570 + # ;; 571 + # *CYGWIN*|*MSYS*|*MINGW*) 572 + # while IFS= read -r line; do 573 + # [ -z "$line" ] && continue 574 + # battery_charge=$(printf '%s' "$line" | awk -v charge="$battery_charge" '{ print charge + $2 / 100 }') 575 + # battery_count=$((battery_count + 1)) 576 + # done << EOF 577 + # $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining 2> /dev/null | tr -d '\r' | tail -n +2 || true) 578 + # EOF 579 + # ;; 580 + # *OpenBSD*) 581 + # for batid in 0 1 2; do 582 + # sysctl -n "hw.sensors.acpibat$batid.raw0" 2>&1 | grep -q 'not found' && continue 583 + # if sysctl -n "hw.sensors.acpibat$batid" | grep -q amphour; then 584 + # 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 }') 585 + # else 586 + # 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 }') 587 + # fi 588 + # battery_count=$((battery_count + 1)) 589 + # done 590 + # ;; 591 + # *FreeBSD*) 592 + # battery_charge=$(awk -v charge="$(sysctl -n 'hw.acpi.battery.life')" 'BEGIN { print charge / 100 }') 593 + # battery_count=1 594 + # ;; 595 + # esac 596 + # if [ "$battery_count" -ne 0 ]; then 597 + # battery_charge=$(awk -v charge="$battery_charge" -v count="$battery_count" 'BEGIN { print charge / count }') 598 + # fi 599 + # 600 + # if [ "$battery_charge" = 0 ]; then 601 + # tmux set -ug '@battery_percentage' \;\ 602 + # set -ug '@battery_charge' 603 + # else 604 + # battery_percentage="$(awk "BEGIN { printf \"%.0f%%\", ($battery_charge) * 100 }")" 605 + # 606 + # tmux set -g '@battery_percentage' "$battery_percentage" \;\ 607 + # set -g '@battery_charge' "$battery_charge" 608 + # fi 609 + # } 610 + # 611 + # _battery_status() { 612 + # battery_status_charging=$1 613 + # battery_status_discharging=$2 614 + # 615 + # case "$_uname_s" in 616 + # *Darwin*) 617 + # while IFS= read -r line; do 618 + # [ -z "$line" ] && continue 619 + # battery_discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false") 620 + # done << EOF 621 + # $(pmset -g batt | grep 'InternalBattery') 622 + # EOF 623 + # ;; 624 + # *Linux*) 625 + # while IFS= read -r batpath; do 626 + # [ -z "$batpath" ] && continue 627 + # grep -i -q device "$batpath/scope" 2> /dev/null && continue 628 + # 629 + # battery_discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false") 630 + # done << EOF 631 + # $(find /sys/class/power_supply -maxdepth 1 -iname '*bat*') 632 + # EOF 633 + # ;; 634 + # *CYGWIN*|*MSYS*|*MINGW*) 635 + # while IFS= read -r line; do 636 + # [ -z "$line" ] && continue 637 + # battery_discharging=$(printf '%s' "$line" | awk '{ s = ($1 == 1) ? "true" : "false"; print s }') 638 + # done << EOF 639 + # $(wmic path Win32_Battery get BatteryStatus, EstimatedChargeRemaining 2> /dev/null | tr -d '\r' | tail -n +2 || true) 640 + # EOF 641 + # ;; 642 + # *OpenBSD*) 643 + # for batid in 0 1 2; do 644 + # battery_discharging=$(sysctl -n "hw.sensors.acpibat$batid.raw0" | grep -q 1 && echo "true" || echo "false") 645 + # done 646 + # ;; 647 + # *FreeBSD*) 648 + # battery_discharging=$(sysctl -n 'hw.acpi.battery.state' | grep -q 1 && echo "true" || echo "false") 649 + # ;; 650 + # esac 651 + # 652 + # if [ -z "$battery_discharging" ]; then 653 + # tmux set -ug '@battery_status' 654 + # return 655 + # fi 656 + # 657 + # if [ "$battery_discharging" = "true" ]; then 658 + # battery_status="$battery_status_discharging" 659 + # else 660 + # battery_status="$battery_status_charging" 661 + # fi 662 + # 663 + # tmux set -g '@battery_status' "$battery_status" >/dev/null 2>/dev/null 664 + # } 665 + # 666 + # _pane_info() { 667 + # pane_pid="$1" 668 + # pane_tty="${2##/dev/}" 669 + # case "$_uname_s" in 670 + # *CYGWIN*) 671 + # ps -al | tail -n +2 | awk -v pane_pid="$pane_pid" -v tty="$pane_tty" -v ssh="$(command -v ssh)" ' 672 + # ((/ssh/ && !/-W/ && !/tsh proxy ssh/ && !/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ && $5 == tty { 673 + # user[$1] = $6; if (!child[$2]) child[$2] = $1 674 + # } 675 + # END { 676 + # pid = pane_pid 677 + # while (child[pid]) { 678 + # if (match(command[pid], "^" ssh " |^ssh ")) { 679 + # break 680 + # } 681 + # pid = child[pid] 682 + # } 683 + # 684 + # file = "/proc/" pid "/cmdline"; getline command < file; close(file) 685 + # gsub(/\0/, " ", command) 686 + # "id -un " user[pid] | getline username 687 + # print pid":"username":"command 688 + # } 689 + # ' 690 + # ;; 691 + # *Linux*) 692 + # 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)" ' 693 + # ((/ssh/ && !/-W/ && !/tsh proxy ssh/ && !/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ { 694 + # user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4) 695 + # } 696 + # END { 697 + # pid = pane_pid 698 + # while (child[pid]) { 699 + # if (match(command[pid], "^" ssh " |^ssh ")) { 700 + # break 701 + # } 702 + # pid = child[pid] 703 + # } 704 + # 705 + # print pid":"user[pid]":"command[pid] 706 + # } 707 + # ' 708 + # ;; 709 + # *) 710 + # 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)" ' 711 + # ((/ssh/ && !/-W/ && !/tsh proxy ssh/ && !/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ { 712 + # user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4) 713 + # } 714 + # END { 715 + # pid = pane_pid 716 + # while (child[pid]) { 717 + # if (match(command[pid], "^" ssh " |^ssh ")) { 718 + # break 719 + # } 720 + # pid = child[pid] 721 + # } 722 + # 723 + # print pid":"user[pid]":"command[pid] 724 + # } 725 + # ' 726 + # ;; 727 + # esac 728 + # } 729 + # 730 + # _ssh_or_mosh_args() { 731 + # case "$1" in 732 + # *ssh*) 733 + # args=$(printf '%s' "$1" | perl -n -e 'print if s/.*?\bssh[\w_-]*\s*(.*)/\1/') 734 + # ;; 735 + # *mosh-client*) 736 + # args=$(printf '%s' "$1" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g') 737 + # ;; 738 + # esac 739 + # 740 + # printf '%s' "$args" 741 + # } 742 + # 743 + # _username() { 744 + # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} 745 + # pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} 746 + # ssh_only=$3 747 + # 748 + # pane_info=$(_pane_info "$pane_pid" "$pane_tty") 749 + # command=${pane_info#*:} 750 + # command=${command#*:} 751 + # 752 + # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command") 753 + # if [ -n "$ssh_or_mosh_args" ]; then 754 + # # shellcheck disable=SC2086 755 + # username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^user / { print $2; exit }') 756 + # # shellcheck disable=SC2086 757 + # [ -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 }') 758 + # # shellcheck disable=SC2086 759 + # [ -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 }') 760 + # else 761 + # if ! _is_true "$ssh_only"; then 762 + # username=${pane_info#*:} 763 + # username=${username%%:*} 764 + # fi 765 + # fi 766 + # 767 + # printf '%s\n' "$username" 768 + # } 769 + # 770 + # _hostname() { 771 + # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} 772 + # pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} 773 + # ssh_only=$3 774 + # full=$4 775 + # h_or_H=$5 776 + # 777 + # pane_info=$(_pane_info "$pane_pid" "$pane_tty") 778 + # command=${pane_info#*:} 779 + # command=${command#*:} 780 + # 781 + # ssh_or_mosh_args=$(_ssh_or_mosh_args "$command") 782 + # if [ -n "$ssh_or_mosh_args" ]; then 783 + # # shellcheck disable=SC2086 784 + # hostname=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^hostname / { print $2; exit }') 785 + # # shellcheck disable=SC2086 786 + # [ -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 }') 787 + # 788 + # if ! _is_true "$full"; then 789 + # case "$hostname" in 790 + # *[a-z-].*) 791 + # hostname=${hostname%%.*} 792 + # ;; 793 + # 127.0.0.1) 794 + # hostname="localhost" 795 + # ;; 796 + # esac 797 + # fi 798 + # else 799 + # if ! _is_true "$ssh_only"; then 800 + # hostname="$h_or_H" 801 + # fi 802 + # fi 803 + # 804 + # printf '%s\n' "$hostname" 805 + # } 806 + # 807 + # _root() { 808 + # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} 809 + # pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} 810 + # root=$3 811 + # 812 + # username=$(_username "$pane_pid" "$pane_tty" false) 813 + # 814 + # [ "$username" = "root" ] && echo "$root" 815 + # } 816 + # 817 + # _uptime() { 818 + # case "$_uname_s" in 819 + # *Darwin*|*FreeBSD*) 820 + # boot=$(sysctl -n kern.boottime 2>/dev/null | awk -F'[ ,:]+' '{ print $4 }') 821 + # now=$(date +%s) 822 + # ;; 823 + # *Linux*|*CYGWIN*|*MSYS*|*MINGW*) 824 + # boot=0 825 + # now=$(cut -d' ' -f1 < /proc/uptime) 826 + # ;; 827 + # *OpenBSD*) 828 + # boot=$(sysctl -n kern.boottime) 829 + # now=$(date +%s) 830 + # esac 831 + # # shellcheck disable=SC1004 832 + # awk -v tmux="$TMUX_PROGRAM ${TMUX_SOCKET:+-S "$TMUX_SOCKET"}" -v boot="$boot" -v now="$now" ' 833 + # BEGIN { 834 + # uptime = now - boot 835 + # y = int(uptime / 31536000) 836 + # dy = int(uptime / 86400) % 365 837 + # d = int(uptime / 86400) 838 + # h = int(uptime / 3600) % 24 839 + # m = int(uptime / 60) % 60 840 + # s = int(uptime) % 60 841 + # 842 + # system(tmux " set -g @uptime_y " y + 0 " \\;" \ 843 + # " set -g @uptime_dy " dy + 0 " \\;" \ 844 + # " set -g @uptime_d " d + 0 " \\;" \ 845 + # " set -g @uptime_h " h + 0 " \\;" \ 846 + # " set -g @uptime_m " m + 0 " \\;" \ 847 + # " set -g @uptime_s " s + 0) 848 + # }' 849 + # } 850 + # 851 + # _loadavg() { 852 + # case "$_uname_s" in 853 + # *Darwin*|*FreeBSD*) 854 + # tmux set -g @loadavg "$(sysctl -n vm.loadavg 2>/dev/null | cut -d' ' -f2)" 855 + # ;; 856 + # *Linux*|*CYGWIN*) 857 + # tmux set -g @loadavg "$(cut -d' ' -f1 < /proc/loadavg)" 858 + # ;; 859 + # *OpenBSD*) 860 + # tmux set -g @loadavg "$(sysctl -n vm.loadavg 2>/dev/null | cut -d' ' -f1)" 861 + # ;; 862 + # esac 863 + # } 864 + # 865 + # _new_window_ssh() { 866 + # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} 867 + # pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} 868 + # shift 2 869 + # 870 + # pane_info=$(_pane_info "$pane_pid" "$pane_tty") 871 + # command=${pane_info#*:} 872 + # command=${command#*:} 873 + # 874 + # case "$command" in 875 + # *mosh-client*) 876 + # # shellcheck disable=SC2046 877 + # tmux new-window "$@" mosh $(echo "$command" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/') 878 + # ;; 879 + # *ssh*) 880 + # # shellcheck disable=SC2046 881 + # tmux new-window "$@" $(echo "$command" | sed -e 's/;/\\;/g') 882 + # ;; 883 + # *) 884 + # tmux new-window "$@" 885 + # esac 886 + # } 887 + # 888 + # _new_window() { 889 + # _new_window_ssh "$@" 890 + # } 891 + # 892 + # _split_window_ssh() { 893 + # pane_pid=${1:-$(tmux display -p '#{pane_pid}')} 894 + # pane_tty=${2:-$(tmux display -p '#{b:pane_tty}')} 895 + # shift 2 896 + # 897 + # pane_info=$(_pane_info "$pane_pid" "$pane_tty") 898 + # command=${pane_info#*:} 899 + # command=${command#*:} 900 + # 901 + # case "$command" in 902 + # *mosh-client*) 903 + # # shellcheck disable=SC2046 904 + # tmux split-window "$@" mosh $(echo "$command" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/') 905 + # ;; 906 + # *ssh*) 907 + # # shellcheck disable=SC2046 908 + # tmux split-window "$@" $(echo "$command" | sed -e 's/;/\\;/g') 909 + # ;; 910 + # *) 911 + # tmux split-window "$@" 912 + # esac 913 + # } 914 + # 915 + # _split_window() { 916 + # _split_window_ssh "$@" 917 + # } 918 + # 919 + # _apply_tmux_256color() { 920 + # case "$(tmux show -gv default-terminal)" in 921 + # tmux-256color|tmux-direct) 922 + # return 923 + # ;; 924 + # esac 925 + # 926 + # # when tmux-256color is available, use it 927 + # # on macOS though, make sure to use /usr/bin/infocmp to probe if it's availalbe system wide 928 + # case "$_uname_s" in 929 + # *Darwin*) 930 + # if /usr/bin/infocmp -x tmux-256color > /dev/null 2>&1; then 931 + # tmux set -g default-terminal 'tmux-256color' 932 + # fi 933 + # ;; 934 + # *) 935 + # if command infocmp -x tmux-256color > /dev/null 2>&1; then 936 + # tmux set -g default-terminal 'tmux-256color' 937 + # fi 938 + # ;; 939 + # esac 940 + # } 941 + # 942 + # _apply_24b() { 943 + # tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-auto} 944 + # tmux_conf_24b_colour=${tmux_conf_24b_colour:-$tmux_conf_theme_24b_colour} 945 + # if [ "$tmux_conf_24b_colour" = "auto" ]; then 946 + # case "$COLORTERM" in 947 + # truecolor|24bit) 948 + # apply_24b=true 949 + # ;; 950 + # esac 951 + # if [ "$apply_24b" = "" ] && [ "$(tput colors)" = "16777216" ]; then 952 + # apply_24b=true 953 + # fi 954 + # elif _is_true "$tmux_conf_24b_colour"; then 955 + # apply_24b=true 956 + # fi 957 + # if [ "$apply_24b" = "true" ]; then 958 + # case "$TERM" in 959 + # screen-*|tmux-*) 960 + # ;; 961 + # *) 962 + # tmux set-option -ga terminal-overrides ",*256col*:Tc" 963 + # ;; 964 + # esac 965 + # fi 966 + # } 967 + # 968 + # _apply_bindings() { 969 + # cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT 970 + # 971 + # tmux_conf_preserve_stock_bindings=${tmux_conf_preserve_stock_bindings:-false} 972 + # tmux list-keys | grep -vF 'TMUX_CONF_LOCAL' | grep -E 'new-window|split(-|_)window|new-session|copy-selection|copy-pipe' > "$cfg" 973 + # if _is_true "$tmux_conf_preserve_stock_bindings"; then 974 + # probe_socket="$(dirname "$TMUX_SOCKET")/tmux-stock-bindings-$$" 975 + # TMUX_SOCKET="$probe_socket" tmux -f /dev/null list-keys >> "$cfg" 976 + # rm -f "$probe_socket" 977 + # fi 978 + # 979 + # # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the 980 + # # output of list-keys can be truncated 981 + # perl -p -i -e "s/'#\{\?window_zoomed_flag,Unzoom,Zoom\}' 'z' \{resize-pane -$/'#{?window_zoomed_flag,Unzoom,Zoom}' 'z' {resize-pane -Z}\"/g" "$cfg" 982 + # 983 + # tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-true} 984 + # if ! _is_disabled "$tmux_conf_new_window_retain_current_path"; then 985 + # perl -p -i -e " 986 + # 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 987 + # ; 988 + # 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 989 + # ; 990 + # s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g" \ 991 + # "$cfg" 992 + # fi 993 + # 994 + # perl -p -i -e " 995 + # 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]+))*)?/"\ 996 + # "$cfg" 997 + # 998 + # tmux_conf_new_window_reconnect_ssh=${tmux_conf_new_window_reconnect_ssh:-false} 999 + # if ! _is_disabled "$tmux_conf_new_window_reconnect_ssh" && _is_true "$tmux_conf_new_window_reconnect_ssh"; then 1000 + # 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" 1001 + # fi 1002 + # 1003 + # tmux_conf_new_window_retain_current_path=${tmux_conf_new_window_retain_current_path:-false} 1004 + # if ! _is_disabled "$tmux_conf_new_window_retain_current_path" && _is_true "$tmux_conf_new_window_retain_current_path"; then 1005 + # perl -p -i -e " 1006 + # s/\bnew-window\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/ 1007 + # ; 1008 + # s/\bnew-window\b/new-window -c '#{pane_current_path}'/g 1009 + # ; 1010 + # 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/ 1011 + # ; 1012 + # 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" \ 1013 + # "$cfg" 1014 + # fi 1015 + # 1016 + # tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true} 1017 + # if ! _is_disabled "$tmux_conf_new_pane_retain_current_path"; then 1018 + # perl -p -i -e " 1019 + # 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 1020 + # ; 1021 + # 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 1022 + # ; 1023 + # s/\bsplit-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" \ 1024 + # "$cfg" 1025 + # fi 1026 + # 1027 + # perl -p -i -e " 1028 + # 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]+))*)?/"\ 1029 + # "$cfg" 1030 + # 1031 + # tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false} 1032 + # if ! _is_disabled "$tmux_conf_new_pane_reconnect_ssh" && _is_true "$tmux_conf_new_pane_reconnect_ssh"; then 1033 + # 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" 1034 + # fi 1035 + # 1036 + # if ! _is_disabled "$tmux_conf_new_pane_retain_current_path" && _is_true "$tmux_conf_new_pane_retain_current_path"; then 1037 + # perl -p -i -e " 1038 + # s/\bsplit-window\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/ 1039 + # ; 1040 + # s/\bsplit-window\b/split-window -c '#{pane_current_path}'\1/g 1041 + # ; 1042 + # 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/ 1043 + # ; 1044 + # 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" \ 1045 + # "$cfg" 1046 + # fi 1047 + # 1048 + # tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false} 1049 + # if ! _is_disabled "$tmux_conf_new_session_prompt" && _is_true "$tmux_conf_new_session_prompt"; then 1050 + # perl -p -i -e " 1051 + # s/(?<!command-prompt -p )\b(new-session)\b(?!\s+(?:-|}))/{$&}/g if /\bdisplay-menu\b/ 1052 + # ; 1053 + # s/(?<!\bcommand-prompt -p )\bnew-session\b(?! -s)/command-prompt -p new-session \"new-session -s '%%'\"/g" \ 1054 + # "$cfg" 1055 + # else 1056 + # perl -p -i -e "s/\bcommand-prompt\s+-p\s+new-session\s+\"new-session\s+-s\s+'%%'\"/new-session/g" "$cfg" 1057 + # fi 1058 + # 1059 + # tmux_conf_new_session_retain_current_path=${tmux_conf_new_session_retain_current_path:-false} 1060 + # if ! _is_disabled "$tmux_conf_new_session_retain_current_path" && _is_true "$tmux_conf_new_session_retain_current_path"; then 1061 + # perl -p -i -e " 1062 + # s/(?<!\bcommand-prompt -p )\bnew-session\b/new-session -c '#{pane_current_path}'/g" \ 1063 + # "$cfg" 1064 + # else 1065 + # perl -p -i -e " 1066 + # s/\bnew-session\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-session\1/g" \ 1067 + # "$cfg" 1068 + # fi 1069 + # 1070 + # tmux_conf_copy_to_os_clipboard=${tmux_conf_copy_to_os_clipboard:-false} 1071 + # command -v xsel > /dev/null 2>&1 && command='xsel -i -b' 1072 + # ! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1 && command='xclip -i -selection clipboard > \/dev\/null 2>\&1' 1073 + # [ "$XDG_SESSION_TYPE" = "wayland" ] && command -v wl-copy > /dev/null 2>&1 && command='wl-copy' 1074 + # command -v pbcopy > /dev/null 2>&1 && command='pbcopy' 1075 + # command -v clip.exe > /dev/null 2>&1 && command='clip\.exe' 1076 + # [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard' 1077 + # 1078 + # if [ -n "$command" ]; then 1079 + # if ! _is_disabled "$tmux_conf_copy_to_os_clipboard" && _is_true "$tmux_conf_copy_to_os_clipboard"; then 1080 + # 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" 1081 + # else 1082 + # if [ "$_tmux_version" -ge 3200 ]; then 1083 + # 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" 1084 + # else 1085 + # 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" 1086 + # fi 1087 + # fi 1088 + # fi 1089 + # 1090 + # # until tmux >= 3.0, output of tmux list-keys can't be consumed back by tmux source-file without applying some escapings 1091 + # awk < "$cfg" \ 1092 + # '{i = $2 == "-T" ? 4 : 5; gsub(/^[;]$/, "\\\\&", $i); gsub(/^[$"#~]$/, "'"'"'&'"'"'", $i); gsub(/^['"'"']$/, "\"&\"", $i); print}' > "$cfg.in" 1093 + # 1094 + # # ignore bindings with errors 1095 + # if ! tmux source-file "$cfg.in"; then 1096 + # if tmux source-file -v /dev/null 2> /dev/null; then 1097 + # verbose_flag='-v' 1098 + # fi 1099 + # while ! out=$(tmux source-file "${verbose_flag:+$verbose_flag}" "$cfg.in"); do 1100 + # line=$(printf "%s" "$out" | tail -1 | cut -d':' -f2) 1101 + # perl -n -i -e "if ($. != $line) { print }" "$cfg.in" 1102 + # done 1103 + # fi 1104 + # 1105 + # tmux_conf_urlscan_options=${tmux_conf_urlscan_options:---compact --dedupe} 1106 + # if command -v urlscan > /dev/null 2>&1; then 1107 + # tmux bind U run "cut -c3- '#{TMUX_CONF}' | sh -s _urlscan '#{pane_id}' $tmux_conf_urlscan_options" 1108 + # elif command -v urlview > /dev/null 2>&1; then 1109 + # tmux bind U run "cut -c3- '#{TMUX_CONF}' | sh -s _urlview '#{pane_id}'" 1110 + # fi 1111 + # } 1112 + # 1113 + # _apply_theme() { 1114 + # tmux_conf_theme=${tmux_conf_theme:-enabled} 1115 + # if ! _is_disabled "$tmux_conf_theme"; then 1116 + # 1117 + # # -- default theme ------------------------------------------------------- 1118 + # 1119 + # tmux_conf_theme_colour_1=${tmux_conf_theme_colour_1:-#080808} # dark gray 1120 + # tmux_conf_theme_colour_2=${tmux_conf_theme_colour_2:-#303030} # gray 1121 + # tmux_conf_theme_colour_3=${tmux_conf_theme_colour_3:-#8a8a8a} # light gray 1122 + # tmux_conf_theme_colour_4=${tmux_conf_theme_colour_4:-#00afff} # light blue 1123 + # tmux_conf_theme_colour_5=${tmux_conf_theme_colour_5:-#ffff00} # yellow 1124 + # tmux_conf_theme_colour_6=${tmux_conf_theme_colour_6:-#080808} # dark gray 1125 + # tmux_conf_theme_colour_7=${tmux_conf_theme_colour_7:-#e4e4e4} # white 1126 + # tmux_conf_theme_colour_8=${tmux_conf_theme_colour_8:-#080808} # dark gray 1127 + # tmux_conf_theme_colour_9=${tmux_conf_theme_colour_9:-#ffff00} # yellow 1128 + # tmux_conf_theme_colour_10=${tmux_conf_theme_colour_10:-#ff00af} # pink 1129 + # tmux_conf_theme_colour_11=${tmux_conf_theme_colour_11:-#5fff00} # green 1130 + # tmux_conf_theme_colour_12=${tmux_conf_theme_colour_12:-#8a8a8a} # light gray 1131 + # tmux_conf_theme_colour_13=${tmux_conf_theme_colour_13:-#e4e4e4} # white 1132 + # tmux_conf_theme_colour_14=${tmux_conf_theme_colour_14:-#080808} # dark gray 1133 + # tmux_conf_theme_colour_15=${tmux_conf_theme_colour_15:-#080808} # dark gray 1134 + # tmux_conf_theme_colour_16=${tmux_conf_theme_colour_16:-#d70000} # red 1135 + # tmux_conf_theme_colour_17=${tmux_conf_theme_colour_17:-#e4e4e4} # white 1136 + # 1137 + # # -- panes --------------------------------------------------------------- 1138 + # 1139 + # tmux_conf_theme_window_fg=${tmux_conf_theme_window_fg:-default} 1140 + # tmux_conf_theme_window_bg=${tmux_conf_theme_window_bg:-default} 1141 + # tmux_conf_theme_highlight_focused_pane=${tmux_conf_theme_highlight_focused_pane:-false} 1142 + # tmux_conf_theme_focused_pane_fg=${tmux_conf_theme_focused_pane_fg:-default} 1143 + # tmux_conf_theme_focused_pane_bg=${tmux_conf_theme_focused_pane_bg:-$tmux_conf_theme_colour_2} 1144 + # 1145 + # window_style="fg=$tmux_conf_theme_window_fg,bg=$tmux_conf_theme_window_bg" 1146 + # if _is_true "$tmux_conf_theme_highlight_focused_pane"; then 1147 + # window_active_style="fg=$tmux_conf_theme_focused_pane_fg,bg=$tmux_conf_theme_focused_pane_bg" 1148 + # else 1149 + # window_active_style="default" 1150 + # fi 1151 + # 1152 + # tmux_conf_theme_pane_border_style=${tmux_conf_theme_pane_border_style:-thin} 1153 + # tmux_conf_theme_pane_border=${tmux_conf_theme_pane_border:-$tmux_conf_theme_colour_2} 1154 + # tmux_conf_theme_pane_active_border=${tmux_conf_theme_pane_active_border:-$tmux_conf_theme_colour_4} 1155 + # tmux_conf_theme_pane_border_fg=${tmux_conf_theme_pane_border_fg:-$tmux_conf_theme_pane_border} 1156 + # tmux_conf_theme_pane_active_border_fg=${tmux_conf_theme_pane_active_border_fg:-$tmux_conf_theme_pane_active_border} 1157 + # case "$tmux_conf_theme_pane_border_style" in 1158 + # fat) 1159 + # tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-$tmux_conf_theme_pane_border_fg} 1160 + # tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-$tmux_conf_theme_pane_active_border_fg} 1161 + # ;; 1162 + # thin|*) 1163 + # tmux_conf_theme_pane_border_bg=${tmux_conf_theme_pane_border_bg:-default} 1164 + # tmux_conf_theme_pane_active_border_bg=${tmux_conf_theme_pane_active_border_bg:-default} 1165 + # ;; 1166 + # esac 1167 + # 1168 + # tmux_conf_theme_pane_indicator=${tmux_conf_theme_pane_indicator:-$tmux_conf_theme_colour_4} 1169 + # tmux_conf_theme_pane_active_indicator=${tmux_conf_theme_pane_active_indicator:-$tmux_conf_theme_colour_4} 1170 + # 1171 + # # -- status line --------------------------------------------------------- 1172 + # 1173 + # tmux_conf_theme_left_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_main-}") 1174 + # tmux_conf_theme_left_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_sub-|}") 1175 + # tmux_conf_theme_right_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_main-}") 1176 + # tmux_conf_theme_right_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_sub-|}") 1177 + # 1178 + # tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-$tmux_conf_theme_colour_1} 1179 + # tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-$tmux_conf_theme_colour_5} 1180 + # tmux_conf_theme_message_attr=${tmux_conf_theme_message_attr:-bold} 1181 + # 1182 + # tmux_conf_theme_message_command_fg=${tmux_conf_theme_message_command_fg:-$tmux_conf_theme_colour_5} 1183 + # tmux_conf_theme_message_command_bg=${tmux_conf_theme_message_command_bg:-$tmux_conf_theme_colour_1} 1184 + # tmux_conf_theme_message_command_attr=${tmux_conf_theme_message_command_attr:-bold} 1185 + # 1186 + # tmux_conf_theme_mode_fg=${tmux_conf_theme_mode_fg:-$tmux_conf_theme_colour_1} 1187 + # tmux_conf_theme_mode_bg=${tmux_conf_theme_mode_bg:-$tmux_conf_theme_colour_5} 1188 + # tmux_conf_theme_mode_attr=${tmux_conf_theme_mode_attr:-bold} 1189 + # 1190 + # tmux_conf_theme_status_fg=${tmux_conf_theme_status_fg:-$tmux_conf_theme_colour_3} 1191 + # tmux_conf_theme_status_bg=${tmux_conf_theme_status_bg:-$tmux_conf_theme_colour_1} 1192 + # tmux_conf_theme_status_attr=${tmux_conf_theme_status_attr:-none} 1193 + # 1194 + # tmux_conf_theme_terminal_title=${tmux_conf_theme_terminal_title:-#h ❐ #S ● #I #W} 1195 + # 1196 + # tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-$tmux_conf_theme_colour_3} 1197 + # tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-$tmux_conf_theme_colour_1} 1198 + # tmux_conf_theme_window_status_attr=${tmux_conf_theme_window_status_attr:-none} 1199 + # 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,}'} 1200 + # 1201 + # tmux_conf_theme_window_status_current_fg=${tmux_conf_theme_window_status_current_fg:-$tmux_conf_theme_colour_1} 1202 + # tmux_conf_theme_window_status_current_bg=${tmux_conf_theme_window_status_current_bg:-$tmux_conf_theme_colour_4} 1203 + # tmux_conf_theme_window_status_current_attr=${tmux_conf_theme_window_status_current_attr:-bold} 1204 + # 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,}'} 1205 + # 1206 + # tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-default} 1207 + # tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-default} 1208 + # tmux_conf_theme_window_status_activity_attr=${tmux_conf_theme_window_status_activity_attr:-underscore} 1209 + # 1210 + # tmux_conf_theme_window_status_bell_fg=${tmux_conf_theme_window_status_bell_fg:-$tmux_conf_theme_colour_5} 1211 + # tmux_conf_theme_window_status_bell_bg=${tmux_conf_theme_window_status_bell_bg:-default} 1212 + # tmux_conf_theme_window_status_bell_attr=${tmux_conf_theme_window_status_bell_attr:-blink,bold} 1213 + # 1214 + # tmux_conf_theme_window_status_last_fg=${tmux_conf_theme_window_status_last_fg:-$tmux_conf_theme_colour_4} 1215 + # tmux_conf_theme_window_status_last_bg=${tmux_conf_theme_window_status_last_bg:-default} 1216 + # tmux_conf_theme_window_status_last_attr=${tmux_conf_theme_window_status_last_attr:-none} 1217 + # 1218 + # if [ "$tmux_conf_theme_window_status_bg" = "$tmux_conf_theme_status_bg" ] || [ "$tmux_conf_theme_window_status_bg" = "default" ]; then 1219 + # spacer='' 1220 + # spacer_current=' ' 1221 + # else 1222 + # spacer=' ' 1223 + # spacer_current=' ' 1224 + # fi 1225 + # if [ "$tmux_conf_theme_window_status_last_bg" = "$tmux_conf_theme_status_bg" ] || [ "$tmux_conf_theme_window_status_last_bg" = "default" ] ; then 1226 + # spacer_last='' 1227 + # else 1228 + # spacer_last=' ' 1229 + # fi 1230 + # if [ "$tmux_conf_theme_window_status_activity_bg" = "$tmux_conf_theme_status_bg" ] || [ "$tmux_conf_theme_window_status_activity_bg" = "default" ] ; then 1231 + # spacer_activity='' 1232 + # spacer_last_activity="$spacer_last" 1233 + # else 1234 + # spacer_activity=' ' 1235 + # spacer_last_activity=' ' 1236 + # fi 1237 + # if [ "$tmux_conf_theme_window_status_bell_bg" = "$tmux_conf_theme_status_bg" ] || [ "$tmux_conf_theme_window_status_bell_bg" = "default" ] ; then 1238 + # spacer_bell='' 1239 + # spacer_last_bell="$spacer_last" 1240 + # spacer_activity_bell="$spacer_activity" 1241 + # spacer_last_activity_bell="$spacer_last_activity" 1242 + # else 1243 + # spacer_bell=' ' 1244 + # spacer_last_bell=' ' 1245 + # spacer_activity_bell=' ' 1246 + # spacer_last_activity_bell=' ' 1247 + # fi 1248 + # 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}}}" 1249 + # if [ "$(tmux show -g -v status-justify)" = "right" ]; then 1250 + # if [ -z "$tmux_conf_theme_right_separator_main" ]; then 1251 + # window_status_separator=' ' 1252 + # else 1253 + # window_status_separator='' 1254 + # fi 1255 + # 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" 1256 + # 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" 1257 + # else 1258 + # if [ -z "$tmux_conf_theme_left_separator_main" ]; then 1259 + # window_status_separator=' ' 1260 + # else 1261 + # window_status_separator='' 1262 + # fi 1263 + # 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" 1264 + # 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" 1265 + # fi 1266 + # 1267 + # # -- indicators 1268 + # 1269 + # tmux_conf_theme_pairing=${tmux_conf_theme_pairing:-⚇} # U+2687 1270 + # tmux_conf_theme_pairing_fg=${tmux_conf_theme_pairing_fg:-none} 1271 + # tmux_conf_theme_pairing_bg=${tmux_conf_theme_pairing_bg:-none} 1272 + # tmux_conf_theme_pairing_attr=${tmux_conf_theme_pairing_attr:-none} 1273 + # 1274 + # tmux_conf_theme_prefix=${tmux_conf_theme_prefix:-⌨} # U+2328 1275 + # tmux_conf_theme_prefix_fg=${tmux_conf_theme_prefix_fg:-none} 1276 + # tmux_conf_theme_prefix_bg=${tmux_conf_theme_prefix_bg:-none} 1277 + # tmux_conf_theme_prefix_attr=${tmux_conf_theme_prefix_attr:-none} 1278 + # 1279 + # tmux_conf_theme_mouse=${tmux_conf_theme_mouse:-↗} # U+2197 1280 + # tmux_conf_theme_mouse_fg=${tmux_conf_theme_mouse_fg:-none} 1281 + # tmux_conf_theme_mouse_bg=${tmux_conf_theme_mouse_bg:-none} 1282 + # tmux_conf_theme_mouse_attr=${tmux_conf_theme_mouse_attr:-none} 1283 + # 1284 + # tmux_conf_theme_root=${tmux_conf_theme_root:-!} 1285 + # tmux_conf_theme_root_fg=${tmux_conf_theme_root_fg:-none} 1286 + # tmux_conf_theme_root_bg=${tmux_conf_theme_root_bg:-none} 1287 + # tmux_conf_theme_root_attr=${tmux_conf_theme_root_attr:-bold,blink} 1288 + # 1289 + # tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-⚏} # U+268F 1290 + # tmux_conf_theme_synchronized_fg=${tmux_conf_theme_synchronized_fg:-none} 1291 + # tmux_conf_theme_synchronized_bg=${tmux_conf_theme_synchronized_bg:-none} 1292 + # tmux_conf_theme_synchronized_attr=${tmux_conf_theme_synchronized_attr:-none} 1293 + # 1294 + # # -- status-left style 1295 + # 1296 + # tmux_conf_theme_status_left=${tmux_conf_theme_status_left-' ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} '} 1297 + # tmux_conf_theme_status_left_fg=${tmux_conf_theme_status_left_fg:-$tmux_conf_theme_colour_6,$tmux_conf_theme_colour_7,$tmux_conf_theme_colour_8} 1298 + # tmux_conf_theme_status_left_bg=${tmux_conf_theme_status_left_bg:-$tmux_conf_theme_colour_9,$tmux_conf_theme_colour_10,$tmux_conf_theme_colour_11} 1299 + # tmux_conf_theme_status_left_attr=${tmux_conf_theme_status_left_attr:-bold,none,none} 1300 + # 1301 + # if [ -n "$tmux_conf_theme_status_left" ]; then 1302 + # status_left=$(echo "$tmux_conf_theme_status_left" | sed \ 1303 + # -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{pairing}#[inherit]/g" \ 1304 + # -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{prefix}#[inherit]/g" \ 1305 + # -e "s/#{mouse}/#[fg=$tmux_conf_theme_mouse_fg]#[bg=$tmux_conf_theme_mouse_bg]#[$tmux_conf_theme_mouse_attr]#{mouse}#[inherit]/g" \ 1306 + # -e "s/#{synchronized}/#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{synchronized}#[inherit]/g" \ 1307 + # -e "s/#{root}/#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{root}#[inherit]/g") 1308 + # 1309 + # status_left=$(printf '%s' "$status_left" | awk \ 1310 + # -v status_bg="$tmux_conf_theme_status_bg" \ 1311 + # -v fg_="$tmux_conf_theme_status_left_fg" \ 1312 + # -v bg_="$tmux_conf_theme_status_left_bg" \ 1313 + # -v attr_="$tmux_conf_theme_status_left_attr" \ 1314 + # -v mainsep="$tmux_conf_theme_left_separator_main" \ 1315 + # -v subsep="$tmux_conf_theme_left_separator_sub" ' 1316 + # function subsplit(s, l, i, a, r) 1317 + # { 1318 + # l = split(s, a, ",") 1319 + # for (i = 1; i <= l; ++i) 1320 + # { 1321 + # o = split(a[i], _, "(") - 1 1322 + # c = split(a[i], _, ")") - 1 1323 + # open += o - c 1324 + # o_ = split(a[i], _, "{") - 1 1325 + # c_ = split(a[i], _, "}") - 1 1326 + # open_ += o_ - c_ 1327 + # o__ = split(a[i], _, "[") - 1 1328 + # c__ = split(a[i], _, "]") - 1 1329 + # open__ += o__ - c__ 1330 + # 1331 + # if (i == l) 1332 + # r = sprintf("%s%s", r, a[i]) 1333 + # else if (open || open_ || open__) 1334 + # r = sprintf("%s%s,", r, a[i]) 1335 + # else 1336 + # r = sprintf("%s%s#[fg=%s,bg=%s,%s]%s", r, a[i], fg[j], bg[j], attr[j], subsep) 1337 + # } 1338 + # 1339 + # gsub(/#\[inherit\]/, sprintf("#[default]#[fg=%s,bg=%s,%s]", fg[j], bg[j], attr[j]), r) 1340 + # return r 1341 + # } 1342 + # BEGIN { 1343 + # FS = "|" 1344 + # l1 = split(fg_, fg, ",") 1345 + # l2 = split(bg_, bg, ",") 1346 + # l3 = split(attr_, attr, ",") 1347 + # l = l1 < l2 ? (l1 < l3 ? l1 : l3) : (l2 < l3 ? l2 : l3) 1348 + # } 1349 + # { 1350 + # for (i = j = 1; i <= NF; ++i) 1351 + # { 1352 + # if (open || open_ || open__) 1353 + # printf "|%s", subsplit($i) 1354 + # else 1355 + # { 1356 + # if (i > 1) 1357 + # printf "#[fg=%s,bg=%s,none]%s#[fg=%s,bg=%s,%s]%s", bg[j_], bg[j], mainsep, fg[j], bg[j], attr[j], subsplit($i) 1358 + # else 1359 + # printf "#[fg=%s,bg=%s,%s]%s", fg[j], bg[j], attr[j], subsplit($i) 1360 + # } 1361 + # 1362 + # if (!open && !open_ && !open__) 1363 + # { 1364 + # j_ = j 1365 + # j = j % l + 1 1366 + # } 1367 + # } 1368 + # printf "#[fg=%s,bg=%s,none]%s", bg[j_], status_bg, mainsep 1369 + # }') 1370 + # fi 1371 + # status_left="$status_left " 1372 + # 1373 + # # -- status-right style 1374 + # 1375 + # tmux_conf_theme_status_right=${tmux_conf_theme_status_right-' #{prefix}#{mouse}#{pairing}#{synchronized}#{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '} 1376 + # tmux_conf_theme_status_right_fg=${tmux_conf_theme_status_right_fg:-$tmux_conf_theme_colour_12,$tmux_conf_theme_colour_13,$tmux_conf_theme_colour_14} 1377 + # tmux_conf_theme_status_right_bg=${tmux_conf_theme_status_right_bg:-$tmux_conf_theme_colour_15,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_17} 1378 + # tmux_conf_theme_status_right_attr=${tmux_conf_theme_status_right_attr:-none,none,bold} 1379 + # 1380 + # if [ -n "$tmux_conf_theme_status_right" ]; then 1381 + # status_right=$(echo "$tmux_conf_theme_status_right" | sed \ 1382 + # -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{pairing}#[inherit]/g" \ 1383 + # -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{prefix}#[inherit]/g" \ 1384 + # -e "s/#{mouse}/#[fg=$tmux_conf_theme_mouse_fg]#[bg=$tmux_conf_theme_mouse_bg]#[$tmux_conf_theme_mouse_attr]#{mouse}#[inherit]/g" \ 1385 + # -e "s/#{synchronized}/#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{synchronized}#[inherit]/g" \ 1386 + # -e "s/#{root}/#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{root}#[inherit]/g") 1387 + # 1388 + # status_right=$(printf '%s' "$status_right" | awk \ 1389 + # -v status_bg="$tmux_conf_theme_status_bg" \ 1390 + # -v fg_="$tmux_conf_theme_status_right_fg" \ 1391 + # -v bg_="$tmux_conf_theme_status_right_bg" \ 1392 + # -v attr_="$tmux_conf_theme_status_right_attr" \ 1393 + # -v mainsep="$tmux_conf_theme_right_separator_main" \ 1394 + # -v subsep="$tmux_conf_theme_right_separator_sub" ' 1395 + # function subsplit(s, l, i, a, r) 1396 + # { 1397 + # l = split(s, a, ",") 1398 + # for (i = 1; i <= l; ++i) 1399 + # { 1400 + # o = split(a[i], _, "(") - 1 1401 + # c = split(a[i], _, ")") - 1 1402 + # open += o - c 1403 + # o_ = split(a[i], _, "{") - 1 1404 + # c_ = split(a[i], _, "}") - 1 1405 + # open_ += o_ - c_ 1406 + # o__ = split(a[i], _, "[") - 1 1407 + # c__ = split(a[i], _, "]") - 1 1408 + # open__ += o__ - c__ 1409 + # 1410 + # if (i == l) 1411 + # r = sprintf("%s%s", r, a[i]) 1412 + # else if (open || open_ || open__) 1413 + # r = sprintf("%s%s,", r, a[i]) 1414 + # else 1415 + # r = sprintf("%s%s#[fg=%s,bg=%s,%s]%s", r, a[i], fg[j], bg[j], attr[j], subsep) 1416 + # } 1417 + # 1418 + # gsub(/#\[inherit\]/, sprintf("#[default]#[fg=%s,bg=%s,%s]", fg[j], bg[j], attr[j]), r) 1419 + # return r 1420 + # } 1421 + # BEGIN { 1422 + # FS = "|" 1423 + # l1 = split(fg_, fg, ",") 1424 + # l2 = split(bg_, bg, ",") 1425 + # l3 = split(attr_, attr, ",") 1426 + # l = l1 < l2 ? (l1 < l3 ? l1 : l3) : (l2 < l3 ? l2 : l3) 1427 + # } 1428 + # { 1429 + # for (i = j = 1; i <= NF; ++i) 1430 + # { 1431 + # if (open_ || open || open__) 1432 + # printf "|%s", subsplit($i) 1433 + # else 1434 + # printf "#[fg=%s,bg=%s,none]%s#[fg=%s,bg=%s,%s]%s", bg[j], (i == 1) ? status_bg : bg[j_], mainsep, fg[j], bg[j], attr[j], subsplit($i) 1435 + # 1436 + # if (!open && !open_ && !open__) 1437 + # { 1438 + # j_ = j 1439 + # j = j % l + 1 1440 + # } 1441 + # } 1442 + # }') 1443 + # fi 1444 + # status_right=${status_right-} 1445 + # 1446 + # # -- clock --------------------------------------------------------------- 1447 + # 1448 + # tmux_conf_theme_clock_colour=${tmux_conf_theme_clock_colour:-$tmux_conf_theme_colour_4} 1449 + # tmux_conf_theme_clock_style=${tmux_conf_theme_clock_style:-24} 1450 + # 1451 + # tmux setw -g window-style "$window_style" \; setw -g window-active-style "$window_active_style" \;\ 1452 + # 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" \;\ 1453 + # set -g display-panes-colour "$tmux_conf_theme_pane_indicator" \; set -g display-panes-active-colour "$tmux_conf_theme_pane_active_indicator" \;\ 1454 + # set -g message-style "fg=$tmux_conf_theme_message_fg,bg=$tmux_conf_theme_message_bg,$tmux_conf_theme_message_attr" \;\ 1455 + # 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" \;\ 1456 + # setw -g mode-style "fg=$tmux_conf_theme_mode_fg,bg=$tmux_conf_theme_mode_bg,$tmux_conf_theme_mode_attr" \;\ 1457 + # set -g status-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ 1458 + # set -g status-left-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ 1459 + # set -g status-right-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\ 1460 + # 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" \;\ 1461 + # 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" \;\ 1462 + # 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" \;\ 1463 + # 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" \;\ 1464 + # 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" \;\ 1465 + # setw -g window-status-separator "$window_status_separator" \;\ 1466 + # setw -g clock-mode-colour "$tmux_conf_theme_clock_colour" \;\ 1467 + # setw -g clock-mode-style "$tmux_conf_theme_clock_style" 1468 + # fi 1469 + # 1470 + # # -- variables ------------------------------------------------------------- 1471 + # 1472 + # set_titles_string=$(printf '%s' "${tmux_conf_theme_terminal_title:-$(tmux show -gv set-titles-string)}" | sed \ 1473 + # -e "s%#{circled_window_index}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#I')%g" \ 1474 + # -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \ 1475 + # -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \ 1476 + # -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \ 1477 + # -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \ 1478 + # -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \ 1479 + # -e "s%#{username_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' true '#D')%g" \ 1480 + # -e "s%#{hostname_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true false '#h' '#D')%g" \ 1481 + # -e "s%#{hostname_full_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true true '#H' '#D')%g") 1482 + # 1483 + # window_status_format=$(printf '%s' "${window_status_format:-$(tmux show -gv window-status-format)}" | sed \ 1484 + # -e "s%#{circled_window_index}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#I')%g" \ 1485 + # -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \ 1486 + # -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \ 1487 + # -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \ 1488 + # -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \ 1489 + # -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \ 1490 + # -e "s%#{username_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' true '#D')%g" \ 1491 + # -e "s%#{hostname_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true false '#h' '#D')%g" \ 1492 + # -e "s%#{hostname_full_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true true '#H' '#D')%g") 1493 + # 1494 + # window_status_current_format=$(printf '%s' "${window_status_current_format:-$(tmux show -gv window-status-current-format)}" | sed \ 1495 + # -e "s%#{circled_window_index}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#I')%g" \ 1496 + # -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \ 1497 + # -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \ 1498 + # -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \ 1499 + # -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \ 1500 + # -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \ 1501 + # -e "s%#{username_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' true '#D')%g" \ 1502 + # -e "s%#{hostname_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true false '#h' '#D')%g" \ 1503 + # -e "s%#{hostname_full_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true true '#H' '#D')%g") 1504 + # 1505 + # status_left=$(printf '%s' "${status_left-$(tmux show -gv status-left)}" | sed \ 1506 + # -e "s/#{pairing}/#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ 1507 + # -e "s/#{prefix}/#{?client_prefix,$tmux_conf_theme_prefix ,$(printf '%s' "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ 1508 + # -e "s/#{mouse}/#{?mouse,$tmux_conf_theme_mouse ,$(printf '%s' "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \ 1509 + # -e "s%#{synchronized}%#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ 1510 + # -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \ 1511 + # -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \ 1512 + # -e "s%#{root}%#{?#{==:#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' '#D'),root},$tmux_conf_theme_root,}%g") 1513 + # 1514 + # status_right=$(printf '%s' "${status_right-$(tmux show -gv status-right)}" | sed \ 1515 + # -e "s/#{pairing}/#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ 1516 + # -e "s/#{prefix}/#{?client_prefix,$tmux_conf_theme_prefix ,$(printf '%s' "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ 1517 + # -e "s/#{mouse}/#{?mouse,$tmux_conf_theme_mouse ,$(printf '%s' "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \ 1518 + # -e "s%#{synchronized}%#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ 1519 + # -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \ 1520 + # -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \ 1521 + # -e "s%#{root}%#{?#{==:#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' '#D'),root},$tmux_conf_theme_root,}%g") 1522 + # 1523 + # tmux_conf_battery_bar_symbol_full=$(_decode_unicode_escapes "${tmux_conf_battery_bar_symbol_full:-◼}") 1524 + # tmux_conf_battery_bar_symbol_empty=$(_decode_unicode_escapes "${tmux_conf_battery_bar_symbol_empty:-◻}") 1525 + # tmux_conf_battery_bar_length=${tmux_conf_battery_bar_length:-auto} 1526 + # tmux_conf_battery_bar_palette=${tmux_conf_battery_bar_palette:-gradient} 1527 + # tmux_conf_battery_hbar_palette=${tmux_conf_battery_hbar_palette:-gradient} 1528 + # tmux_conf_battery_vbar_palette=${tmux_conf_battery_vbar_palette:-gradient} 1529 + # tmux_conf_battery_status_charging=$(_decode_unicode_escapes "${tmux_conf_battery_status_charging:-↑}") # U+2191 1530 + # tmux_conf_battery_status_discharging=$(_decode_unicode_escapes "${tmux_conf_battery_status_discharging:-↓}") # U+2193 1531 + # 1532 + # _pkillf 'sh -s _battery_info' 1533 + # _battery_info 1534 + # if [ "$battery_charge" != 0 ]; then 1535 + # case "$status_left $status_right" in 1536 + # *'#{battery_'*|*'#{?battery_'*) 1537 + # status_left=$(echo "$status_left" | sed -E \ 1538 + # -e 's%#\{\?battery_bar%#\{?@battery_percentage%g' \ 1539 + # -e 's%#\{\?battery_hbar%#\{?@battery_percentage%g' \ 1540 + # -e 's%#\{\?battery_vbar%#\{?@battery_percentage%g' \ 1541 + # -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" \ 1542 + # -e "s%#\{battery_hbar\}%#(nice cut -c3- '$TMUX_CONF' | sh -s _hbar '$(printf '%s' "$tmux_conf_battery_hbar_palette" | tr ',' ';')' '#{@battery_charge}')%g" \ 1543 + # -e "s%#\{battery_vbar\}%#(nice cut -c3- '$TMUX_CONF' | sh -s _vbar '$(printf '%s' "$tmux_conf_battery_vbar_palette" | tr ',' ';')' '#{@battery_charge}')%g" \ 1544 + # -e 's%#\{(\?)?battery_status%#\{\1@battery_status%g' \ 1545 + # -e 's%#\{(\?)?battery_percentage%#\{\1@battery_percentage%g') 1546 + # status_right=$(echo "$status_right" | sed -E \ 1547 + # -e 's%#\{\?battery_bar%#\{?@battery_percentage%g' \ 1548 + # -e 's%#\{\?battery_hbar%#\{?@battery_percentage%g' \ 1549 + # -e 's%#\{\?battery_vbar%#\{?@battery_percentage%g' \ 1550 + # -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" \ 1551 + # -e "s%#\{battery_hbar\}%#(nice cut -c3- '$TMUX_CONF' | sh -s _hbar '$(printf '%s' "$tmux_conf_battery_hbar_palette" | tr ',' ';')' '#{@battery_charge}')%g" \ 1552 + # -e "s%#\{battery_vbar\}%#(nice cut -c3- '$TMUX_CONF' | sh -s _vbar '$(printf '%s' "$tmux_conf_battery_vbar_palette" | tr ',' ';')' '#{@battery_charge}')%g" \ 1553 + # -e 's%#\{(\?)?battery_status%#\{\1@battery_status%g' \ 1554 + # -e 's%#\{(\?)?battery_percentage%#\{\1@battery_percentage%g') 1555 + # status_right="#(echo; nice cut -c3- '$TMUX_CONF' | sh -s _battery_status '$tmux_conf_battery_status_charging' '$tmux_conf_battery_status_discharging')$status_right" 1556 + # interval=60 1557 + # if [ "$_tmux_version" -eq 3500 ]; then 1558 + # 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'" 1559 + # elif [ "$_tmux_version" -ge 3200 ]; then 1560 + # 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" 1561 + # elif [ "$_tmux_version" -ge 2800 ]; then 1562 + # 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" 1563 + # elif [ "$_tmux_version" -gt 2400 ]; then 1564 + # status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; sleep $interval; done)$status_right" 1565 + # else 1566 + # status_right="#(nice cut -c3- '$TMUX_CONF' | sh -s _battery_info)$status_right" 1567 + # fi 1568 + # ;; 1569 + # esac 1570 + # fi 1571 + # 1572 + # case "$status_left $status_right" in 1573 + # *'#{username}'*|*'#{hostname}'*|*'#{hostname_full}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*|*'#{hostname_full_ssh}'*) 1574 + # status_left=$(echo "$status_left" | sed \ 1575 + # -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \ 1576 + # -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \ 1577 + # -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \ 1578 + # -e "s%#{username_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' true '#D')%g" \ 1579 + # -e "s%#{hostname_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true false '#h' '#D')%g" \ 1580 + # -e "s%#{hostname_full_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true true '#H' '#D')%g") 1581 + # status_right=$(echo "$status_right" | sed \ 1582 + # -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \ 1583 + # -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \ 1584 + # -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \ 1585 + # -e "s%#{username_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' true '#D')%g" \ 1586 + # -e "s%#{hostname_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true false '#h' '#D')%g" \ 1587 + # -e "s%#{hostname_full_ssh}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' true true '#H' '#D')%g") 1588 + # ;; 1589 + # esac 1590 + # 1591 + # _pkillf 'sh -s _uptime' 1592 + # case "$status_left $status_right" in 1593 + # *'#{uptime_'*|*'#{?uptime_'*) 1594 + # status_left=$(echo "$status_left" | perl -p -e ' 1595 + # ; s/#\{(\?)?uptime_y\b/#\{\1\@uptime_y/g 1596 + # ; s/#\{(\?)?uptime_d\b/#\{\1\@uptime_d/g 1597 + # ; s/\@uptime_d\b/\@uptime_dy/g if /\@uptime_y\b/ 1598 + # ; s/#\{(\?)?uptime_h\b/#\{\1\@uptime_h/g 1599 + # ; s/#\{(\?)?uptime_m\b/#\{\1\@uptime_m/g 1600 + # ; s/#\{(\?)?uptime_s\b/#\{\1\@uptime_s/g') 1601 + # status_right=$(echo "$status_right" | perl -p -e ' 1602 + # ; s/#\{(\?)?uptime_y\b/#\{\1\@uptime_y/g 1603 + # ; s/#\{(\?)?uptime_d\b/#\{\1\@uptime_d/g 1604 + # ; s/\@uptime_d\b/\@uptime_dy/g if /\@uptime_y\b/ 1605 + # ; s/#\{(\?)?uptime_h\b/#\{\1\@uptime_h/g 1606 + # ; s/#\{(\?)?uptime_m\b/#\{\1\@uptime_m/g 1607 + # ; s/#\{(\?)?uptime_s\b/#\{\1\@uptime_s/g') 1608 + # interval=60 1609 + # case "$status_left $status_right" in 1610 + # *'#{@uptime_s}'*) 1611 + # interval=$(tmux show -gv status-interval) 1612 + # ;; 1613 + # esac 1614 + # if [ "$_tmux_version" -eq 3500 ]; then 1615 + # 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'" 1616 + # elif [ "$_tmux_version" -ge 3200 ]; then 1617 + # 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" 1618 + # elif [ "$_tmux_version" -ge 2800 ]; then 1619 + # 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" 1620 + # elif [ "$_tmux_version" -gt 2400 ]; then 1621 + # status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval; done)$status_right" 1622 + # else 1623 + # status_right="#(nice cut -c3- '$TMUX_CONF' | sh -s _uptime)$status_right" 1624 + # fi 1625 + # ;; 1626 + # esac 1627 + # 1628 + # _pkillf 'sh -s _loadavg' 1629 + # case "$status_left $status_right" in 1630 + # *'#{loadavg'*|*'#{?loadavg'*) 1631 + # status_left=$(echo "$status_left" | sed -E \ 1632 + # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') 1633 + # status_right=$(echo "$status_right" | sed -E \ 1634 + # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') 1635 + # interval=$(tmux show -gv status-interval) 1636 + # if [ "$_tmux_version" -eq 3500 ]; then 1637 + # 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'" 1638 + # elif [ "$_tmux_version" -ge 3200 ]; then 1639 + # 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" 1640 + # elif [ "$_tmux_version" -ge 2800 ]; then 1641 + # 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" 1642 + # elif [ "$_tmux_version" -gt 2400 ]; then 1643 + # status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval; done)$status_right" 1644 + # else 1645 + # status_right="#(nice cut -c3- '$TMUX_CONF' | sh -s _loadavg)$status_right" 1646 + # fi 1647 + # ;; 1648 + # esac 1649 + # 1650 + # # -- custom variables ------------------------------------------------------ 1651 + # 1652 + # if [ -f "$TMUX_CONF_LOCAL" ] && [ "$(cut -c3- "$TMUX_CONF_LOCAL" | sh 2>/dev/null -s printf probe)" = "probe" ]; then 1653 + # 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") 1654 + # status_left=$(echo "$status_left" | perl -p -e "$replacements" || echo "$status_left") 1655 + # status_right=$(echo "$status_right" | perl -p -e "$replacements" || echo "$status_right") 1656 + # fi 1657 + # 1658 + # # -------------------------------------------------------------------------- 1659 + # 1660 + # tmux set -g set-titles-string "$(_decode_unicode_escapes "$set_titles_string")" \;\ 1661 + # setw -g window-status-format "$(_decode_unicode_escapes "$window_status_format")" \;\ 1662 + # setw -g window-status-current-format "$(_decode_unicode_escapes "$window_status_current_format")" \;\ 1663 + # set -g status-left-length 1000 \; set -g status-left "$(_decode_unicode_escapes "$status_left")" \;\ 1664 + # set -g status-right-length 1000 \; set -g status-right "$(_decode_unicode_escapes "$status_right")" 1665 + # } 1666 + # 1667 + # __apply_plugins() { 1668 + # TMUX_PLUGIN_MANAGER_PATH="$1" 1669 + # window_active="$2" 1670 + # tmux_conf_update_plugins_on_launch="$3" 1671 + # tmux_conf_update_plugins_on_reload="$4" 1672 + # tmux_conf_uninstall_plugins_on_reload="$5" 1673 + # 1674 + # if [ -z "$TMUX_PLUGIN_MANAGER_PATH" ]; then 1675 + # return 255 1676 + # fi 1677 + # mkdir -p "$TMUX_PLUGIN_MANAGER_PATH" 1678 + # 1679 + # __discover_plugins() ( 1680 + # probe_socket="$(dirname "$TMUX_SOCKET")/tmux-discover-plugins-$$" 1681 + # TMUX_SOCKET="$probe_socket" tmux -f /dev/null start-server \; set-option exit-empty off 1682 + # ___discover_plugins() { 1683 + # depth=$((${depth:-0} + 1)) 1684 + # IFS=${_IFS:-$IFS} 1685 + # [ "$depth" -le 100 ] || return 1686 + # for current_file in "$@"; do 1687 + # current_file="$(cd "${current_file%/*}" 2>/dev/null && pwd)/${current_file##*/}" || continue 1688 + # while IFS= read -r line; do 1689 + # 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 1690 + # discovered_plugins="${discovered_plugins}${discovered_plugins:+ }${plugin}" 1691 + # 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 1692 + # next_files=$(TMUX_SOCKET="$probe_socket" tmux -f /dev/null \ 1693 + # set -g @current_file "$current_file" \; \ 1694 + # display -pF "$next_files") 1695 + # 1696 + # _IFS="$IFS" 1697 + # IFS=$(printf '\n\nx') 1698 + # IFS=${IFS%?} 1699 + # # we don't want quoting here as we want wildcard expansion 1700 + # # shellcheck disable=SC2046 1701 + # ___discover_plugins $(printf '%s\n' "$next_files" | xargs printf '%s\n\n') 1702 + # fi 1703 + # done << EOF 1704 + # $(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") 1705 + # EOF 1706 + # done 1707 + # } 1708 + # ___discover_plugins "$@" 1709 + # TMUX_SOCKET="$probe_socket" tmux -f /dev/null kill-server 1710 + # rm -rf "$probe_socket" 1711 + # printf '%s\n' "$discovered_plugins" 1712 + # ) 1713 + # 1714 + # tpm_plugins=$(tmux show -gvq '@tpm_plugins' 2>/dev/null) 1715 + # tpm_plugins=$(cat << EOF | tr ' ' '\n' | awk '/^\s*$/ {next;}; !seen[$0]++ { gsub(/^[ \t]+/,"",$0); gsub(/[ \t]+$/,"",$0); print $0 }' 1716 + # $tpm_plugins 1717 + # $(__discover_plugins "$TMUX_CONF_LOCAL") 1718 + # EOF 1719 + # ) 1720 + # if [ -z "$tpm_plugins" ]; then 1721 + # if _is_true "$tmux_conf_uninstall_plugins_on_reload" && [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then 1722 + # tmux display 'Uninstalling tpm and plugins...' 1723 + # tmux set-environment -gu TMUX_PLUGIN_MANAGER_PATH 1724 + # rm -rf "$TMUX_PLUGIN_MANAGER_PATH" 1725 + # tmux display 'Done uninstalling tpm and plugins...' 1726 + # fi 1727 + # else 1728 + # if [ "$(command tmux display -p '#{pid} #{version} #{socket_path}')" = "$("$TMUX_PROGRAM" display -p '#{pid} #{version} #{socket_path}')" ]; then 1729 + # tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH" 1730 + # tmux set -g '@tpm_plugins' "$tpm_plugins" 1731 + # 1732 + # if [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then 1733 + # [ -z "$(tmux show -gqv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I' 1734 + # [ -z "$(tmux show -gqv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u' 1735 + # [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u' 1736 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" || tmux display "One or more tpm plugin(s) failed" 1737 + # fi 1738 + # 1739 + # if git ls-remote -hq https://github.com/gpakosz/.tmux.git master > /dev/null; then 1740 + # if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then 1741 + # install_tpm=true 1742 + # tmux display 'Installing tpm and plugins...' 1743 + # git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm" 1744 + # elif { [ -z "$window_active" ] && _is_true "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_true "$tmux_conf_update_plugins_on_reload"; }; then 1745 + # update_tpm=true 1746 + # tmux display 'Updating tpm and plugins...' 1747 + # (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git fetch -q -p && git checkout -q master && git reset -q --hard origin/master) 1748 + # fi 1749 + # if [ "$install_tpm" = "true" ] || [ "$update_tpm" = "true" ]; then 1750 + # perl -0777 -p -i -e 's/git clone(?!\s+--depth\s+1)/git clone --depth 1/g 1751 + # ;s/(install_plugin(.(?!&))*)\n(\s+)done/\1&\n\3done\n\3wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh" 1752 + # 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" 1753 + # 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" 1754 + # fi 1755 + # if [ "$update_tpm" = "true" ]; then 1756 + # { 1757 + # { 1758 + # printf 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | _timestamp 1759 + # printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | _timestamp 1760 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | _timestamp 1761 + # printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins all" | _timestamp 1762 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all 2>&1 | _timestamp 1763 + # printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins all" | _timestamp 1764 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all 2>&1 | _timestamp 1765 + # printf 'Done.\n' | _timestamp 1766 + # printf '\n' 1767 + # } >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 1768 + # 1769 + # tmux display 'Done updating tpm and plugins...' 1770 + # } || tmux display 'Failed updating tpm and plugins...' 1771 + # elif [ "$install_tpm" = "true" ]; then 1772 + # { 1773 + # { 1774 + # printf 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | _timestamp 1775 + # printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | _timestamp 1776 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | _timestamp 1777 + # printf 'Done.\n' | _timestamp 1778 + # printf '\n' >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 1779 + # } >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 1780 + # 1781 + # tmux display 'Done installing tpm and plugins...' 1782 + # 1783 + # [ -z "$(tmux show -gqv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I' 1784 + # [ -z "$(tmux show -gqv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u' 1785 + # [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u' 1786 + # "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" || tmux display "One or more tpm plugin(s) failed" 1787 + # } || tmux display 'Failed installing tpm and plugins...' 1788 + # fi 1789 + # else 1790 + # tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..." 1791 + # fi 1792 + # else 1793 + # if [ "$_tmux_version" -ge 3200 ]; then 1794 + # 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\"'" 1795 + # else 1796 + # 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'" 1797 + # fi 1798 + # fi 1799 + # 1800 + # if [ "$_tmux_version" -gt 2600 ]; then 1801 + # tmux set -gu '@tpm-install' \; set -gu '@tpm-update' \; set -gu '@tpm-clean' \; set -gu '@plugin' \; set -gu '@tpm_plugins' 1802 + # else 1803 + # tmux set -g '@tpm-install' '' \; set -g '@tpm-update' '' \; set -g '@tpm-clean' '' \; set -g '@plugin' '' \; set-gu '@tpm_plugins' '' 1804 + # fi 1805 + # fi 1806 + # } 1807 + # 1808 + # _apply_plugins() { 1809 + # tmux_conf_update_plugins_on_launch=${tmux_conf_update_plugins_on_launch:-true} 1810 + # tmux_conf_update_plugins_on_reload=${tmux_conf_update_plugins_on_reload:-true} 1811 + # tmux_conf_uninstall_plugins_on_reload=${tmux_conf_uninstall_plugins_on_reload:-true} 1812 + # 1813 + # if [ -z "$TMUX_PLUGIN_MANAGER_PATH" ]; then 1814 + # if [ "$(dirname "$TMUX_CONF")" = "$HOME" ]; then 1815 + # TMUX_PLUGIN_MANAGER_PATH="$HOME/.tmux/plugins" 1816 + # else 1817 + # TMUX_PLUGIN_MANAGER_PATH="$(dirname "$TMUX_CONF")/plugins" 1818 + # fi 1819 + # fi 1820 + # 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'" 1821 + # } 1822 + # 1823 + # _apply_important() { 1824 + # cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT 1825 + # 1826 + # if perl -n -e 'print if /^\s*(?:set|bind|unbind).+?#!important\s*$/' "$TMUX_CONF_LOCAL" 2>/dev/null > "$cfg.local"; then 1827 + # if ! tmux source-file "$cfg.local"; then 1828 + # if tmux source-file -v /dev/null 2> /dev/null; then 1829 + # verbose_flag='-v' 1830 + # fi 1831 + # while ! out=$(tmux source-file "${verbose_flag:+$verbose_flag}" "$cfg.local"); do 1832 + # line=$(printf "%s" "$out" | tail -1 | cut -d':' -f2) 1833 + # perl -n -i -e "if ($. != $line) { print }" "$cfg.local" 1834 + # done 1835 + # fi 1836 + # fi 1837 + # } 1838 + # 1839 + # _apply_configuration() { 1840 + # window_active="$(tmux display -p '#{window_active}' 2>/dev/null || true)" 1841 + # if [ -z "$window_active" ]; then 1842 + # if [ "$_tmux_version" -lt 2600 ]; then 1843 + # tmux run -b 'tmux set display-time 3000 \; display "This configuration requires tmux 2.6+" \; set -u display-time \; run "sleep 3" \; kill-server' 1844 + # return 1845 + # fi 1846 + # if [ "$_tmux_version" -ge 3200 ]; then 1847 + # for cmd in perl sed awk; do 1848 + # if ! command -v "$cmd" > /dev/null 2>&1; then 1849 + # tmux run -b "tmux display -N -d 3000 'This configuration requires $cmd' \; run 'sleep 3' \; kill-server" 1850 + # return 1851 + # fi 1852 + # done 1853 + # else 1854 + # for cmd in perl sed awk; do 1855 + # if ! command -v "$cmd" > /dev/null 2>&1; then 1856 + # tmux run -b "tmux set display-time 3000 \; display 'This configuration requires $cmd' \; set -u display-time \; run 'sleep 3' \; kill-server" 1857 + # return 1858 + # fi 1859 + # done 1860 + # fi 1861 + # fi 1862 + # 1863 + # case "$_uname_s" in 1864 + # *CYGWIN*|*MSYS*) 1865 + # # prevent Cygwin and MSYS2 from cd-ing into home directory when evaluating /etc/profile 1866 + # tmux setenv -g CHERE_INVOKING 1 1867 + # ;; 1868 + # esac 1869 + # 1870 + # _apply_tmux_256color 1871 + # _apply_24b& 1872 + # _apply_theme& 1873 + # _apply_bindings& 1874 + # wait 1875 + # 1876 + # _apply_plugins 1877 + # _apply_important 1878 + # 1879 + # # shellcheck disable=SC2046 1880 + # tmux setenv -gu tmux_conf_dummy $(printenv | grep -E -o '^tmux_conf_[^=]+' | awk '{printf "; setenv -gu %s", $0}') 1881 + # } 1882 + # 1883 + # _urlview() { 1884 + # pane_id="$1"; shift 1885 + # tmux capture-pane -J -S - -E - -b "urlview-$pane_id" -t "$pane_id" 1886 + # 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'" 1887 + # } 1888 + # 1889 + # _urlscan() { 1890 + # pane_id="$1"; shift 1891 + # tmux capture-pane -J -S - -E - -b "urlscan-$pane_id" -t "$pane_id" 1892 + # 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'" 1893 + # } 1894 + # 1895 + # _fpp() { 1896 + # tmux capture-pane -J -S - -E - -b "fpp-$1" -t "$1" 1897 + # 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'" 1898 + # } 1899 + # 1900 + # "$@"
+1
.tmux.conf
··· 1 + .oh-my-tmux/.tmux.conf
+513
.tmux.conf.local
··· 1 + # : << EOF 2 + # Oh my tmux! 3 + # 💛🩷💙🖤❤️🤍 4 + # https://github.com/gpakosz/.tmux 5 + # (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, 6 + # without any warranty. 7 + # Copyright 2012— Gregory Pakosz (@gpakosz). 8 + 9 + 10 + # -- Backup/Restore sessions 11 + 12 + set -g @plugin 'tmux-plugins/tmux-resurrect' 13 + set -g @plugin 'tmux-plugins/tmux-continuum' 14 + set -g @continuum-restore 'on' # Auto-restore on tmux start 15 + 16 + 17 + 18 + # -- bindings ------------------------------------------------------------------ 19 + 20 + # preserve tmux stock bindings, 21 + # while adding bindings that don't conflict with these stock bindings 22 + # /!\ this disables some of Oh my tmux! bindings described in README.md 23 + # - true 24 + # - false (default) 25 + tmux_conf_preserve_stock_bindings=false 26 + 27 + 28 + # -- session creation ---------------------------------------------------------- 29 + 30 + # prompt for session name when creating a new session, possible values are: 31 + # - true 32 + # - false (default) 33 + # - disabled (do not modify new-session bindings) 34 + tmux_conf_new_session_prompt=false 35 + 36 + # new session retains current path, possible values are: 37 + # - true 38 + # - false (default) 39 + # - disabled (do not modify new-session bindings) 40 + tmux_conf_new_session_retain_current_path=false 41 + 42 + 43 + # -- windows & pane creation --------------------------------------------------- 44 + 45 + # new window retains current path, possible values are: 46 + # - true 47 + # - false (default) 48 + # - disabled (do not modify new-window bindings) 49 + tmux_conf_new_window_retain_current_path=false 50 + 51 + # new window tries to reconnect ssh sessions, possible values are: 52 + # - true 53 + # - false (default) 54 + # - disabled (do not modify new-window bindings) 55 + tmux_conf_new_window_reconnect_ssh=false 56 + 57 + # new pane retains current path, possible values are: 58 + # - true (default) 59 + # - false 60 + # - disabled (do not modify split-window bindings) 61 + tmux_conf_new_pane_retain_current_path=true 62 + 63 + # new pane tries to reconnect ssh sessions, possible values are: 64 + # - true 65 + # - false (default) 66 + # - disabled (do not modify split-window bindings) 67 + tmux_conf_new_pane_reconnect_ssh=false 68 + 69 + 70 + # -- display ------------------------------------------------------------------- 71 + 72 + # RGB 24-bit colour support, possible values are: 73 + # - true 74 + # - false 75 + # - auto (default) 76 + # 77 + # automatic detection relies on the COLORTERM environment variable being defined 78 + # to 'truecolor' or '24bit' or '$ tput colors' answering '16777216' 79 + # see https://github.com/termstandard/colors 80 + tmux_conf_24b_colour=auto 81 + 82 + 83 + # -- theming ------------------------------------------------------------------- 84 + 85 + # enable or disable theming: 86 + # - enabled (default) 87 + # - disabled 88 + # when disabled, all tmux_conf_theme_xxx variables are ignored except: 89 + # - tmux_conf_theme_pairing 90 + # - tmux_conf_theme_prefix 91 + # - tmux_conf_theme_mouse 92 + # - tmux_conf_theme_root 93 + # - tmux_conf_theme_synchronized 94 + tmux_conf_theme=enabled 95 + 96 + # default theme 97 + tmux_conf_theme_colour_1="#080808" # dark gray 98 + tmux_conf_theme_colour_2="#303030" # gray 99 + tmux_conf_theme_colour_3="#8a8a8a" # light gray 100 + tmux_conf_theme_colour_4="#00afff" # light blue 101 + tmux_conf_theme_colour_5="#ffff00" # yellow 102 + tmux_conf_theme_colour_6="#080808" # dark gray 103 + tmux_conf_theme_colour_7="#e4e4e4" # white 104 + tmux_conf_theme_colour_8="#080808" # dark gray 105 + tmux_conf_theme_colour_9="#ffff00" # yellow 106 + tmux_conf_theme_colour_10="#ff00af" # pink 107 + tmux_conf_theme_colour_11="#5fff00" # green 108 + tmux_conf_theme_colour_12="#8a8a8a" # light gray 109 + tmux_conf_theme_colour_13="#e4e4e4" # white 110 + tmux_conf_theme_colour_14="#080808" # dark gray 111 + tmux_conf_theme_colour_15="#080808" # dark gray 112 + tmux_conf_theme_colour_16="#d70000" # red 113 + tmux_conf_theme_colour_17="#e4e4e4" # white 114 + 115 + # default theme (ansi) 116 + #tmux_conf_theme_colour_1="colour0" 117 + #tmux_conf_theme_colour_2="colour8" 118 + #tmux_conf_theme_colour_3="colour8" 119 + #tmux_conf_theme_colour_4="colour14" 120 + #tmux_conf_theme_colour_5="colour11" 121 + #tmux_conf_theme_colour_6="colour0" 122 + #tmux_conf_theme_colour_7="colour15" 123 + #tmux_conf_theme_colour_8="colour0" 124 + #tmux_conf_theme_colour_9="colour11" 125 + #tmux_conf_theme_colour_10="colour13" 126 + #tmux_conf_theme_colour_11="colour10" 127 + #tmux_conf_theme_colour_12="colour8" 128 + #tmux_conf_theme_colour_13="colour15" 129 + #tmux_conf_theme_colour_14="colour0" 130 + #tmux_conf_theme_colour_15="colour0" 131 + #tmux_conf_theme_colour_16="colour1" 132 + #tmux_conf_theme_colour_17="colour15" 133 + 134 + # window style 135 + tmux_conf_theme_window_fg="default" 136 + tmux_conf_theme_window_bg="default" 137 + 138 + # highlight focused pane, possible values are: 139 + # - true 140 + # - false (default) 141 + tmux_conf_theme_highlight_focused_pane=false 142 + 143 + # focused pane colours: 144 + tmux_conf_theme_focused_pane_bg="$tmux_conf_theme_colour_2" 145 + 146 + # pane border style, possible values are: 147 + # - thin (default) 148 + # - fat 149 + tmux_conf_theme_pane_border_style=thin 150 + 151 + # pane borders colours: 152 + tmux_conf_theme_pane_border="$tmux_conf_theme_colour_2" 153 + tmux_conf_theme_pane_active_border="$tmux_conf_theme_colour_4" 154 + %if #{>=:#{version},3.2} 155 + tmux_conf_theme_pane_active_border="#{?pane_in_mode,$tmux_conf_theme_colour_9,#{?synchronize-panes,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_4}}" 156 + %endif 157 + 158 + # pane indicator colours (when you hit <prefix> + q) 159 + tmux_conf_theme_pane_indicator="$tmux_conf_theme_colour_4" 160 + tmux_conf_theme_pane_active_indicator="$tmux_conf_theme_colour_4" 161 + 162 + # status line style 163 + tmux_conf_theme_message_fg="$tmux_conf_theme_colour_1" 164 + tmux_conf_theme_message_bg="$tmux_conf_theme_colour_5" 165 + tmux_conf_theme_message_attr="bold" 166 + 167 + # status line command style (<prefix> : Escape) 168 + tmux_conf_theme_message_command_fg="$tmux_conf_theme_colour_5" 169 + tmux_conf_theme_message_command_bg="$tmux_conf_theme_colour_1" 170 + tmux_conf_theme_message_command_attr="bold" 171 + 172 + # window modes style 173 + tmux_conf_theme_mode_fg="$tmux_conf_theme_colour_1" 174 + tmux_conf_theme_mode_bg="$tmux_conf_theme_colour_5" 175 + tmux_conf_theme_mode_attr="bold" 176 + 177 + # status line style 178 + tmux_conf_theme_status_fg="$tmux_conf_theme_colour_3" 179 + tmux_conf_theme_status_bg="$tmux_conf_theme_colour_1" 180 + tmux_conf_theme_status_attr="none" 181 + 182 + # terminal title 183 + # - built-in variables are: 184 + # - #{circled_window_index} 185 + # - #{circled_session_name} 186 + # - #{hostname} 187 + # - #{hostname_ssh} 188 + # - #{hostname_full} 189 + # - #{hostname_full_ssh} 190 + # - #{username} 191 + # - #{username_ssh} 192 + tmux_conf_theme_terminal_title="#h ❐ #S ● #I #W" 193 + 194 + # window status style 195 + # - built-in variables are: 196 + # - #{circled_window_index} 197 + # - #{circled_session_name} 198 + # - #{hostname} 199 + # - #{hostname_ssh} 200 + # - #{hostname_full} 201 + # - #{hostname_full_ssh} 202 + # - #{username} 203 + # - #{username_ssh} 204 + tmux_conf_theme_window_status_fg="$tmux_conf_theme_colour_3" 205 + tmux_conf_theme_window_status_bg="$tmux_conf_theme_colour_1" 206 + tmux_conf_theme_window_status_attr="none" 207 + tmux_conf_theme_window_status_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}" 208 + #tmux_conf_theme_window_status_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}" 209 + #tmux_conf_theme_window_status_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}" 210 + 211 + # window current status style 212 + # - built-in variables are: 213 + # - #{circled_window_index} 214 + # - #{circled_session_name} 215 + # - #{hostname} 216 + # - #{hostname_ssh} 217 + # - #{hostname_full} 218 + # - #{hostname_full_ssh} 219 + # - #{username} 220 + # - #{username_ssh} 221 + tmux_conf_theme_window_status_current_fg="$tmux_conf_theme_colour_1" 222 + tmux_conf_theme_window_status_current_bg="$tmux_conf_theme_colour_4" 223 + tmux_conf_theme_window_status_current_attr="bold" 224 + tmux_conf_theme_window_status_current_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}" 225 + #tmux_conf_theme_window_status_current_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}" 226 + #tmux_conf_theme_window_status_current_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}" 227 + 228 + # window activity status style 229 + tmux_conf_theme_window_status_activity_fg="default" 230 + tmux_conf_theme_window_status_activity_bg="default" 231 + tmux_conf_theme_window_status_activity_attr="underscore" 232 + 233 + # window bell status style 234 + tmux_conf_theme_window_status_bell_fg="$tmux_conf_theme_colour_5" 235 + tmux_conf_theme_window_status_bell_bg="default" 236 + tmux_conf_theme_window_status_bell_attr="blink,bold" 237 + 238 + # window last status style 239 + tmux_conf_theme_window_status_last_fg="$tmux_conf_theme_colour_4" 240 + tmux_conf_theme_window_status_last_bg="$tmux_conf_theme_colour_2" 241 + tmux_conf_theme_window_status_last_attr="none" 242 + 243 + # status left/right sections separators 244 + tmux_conf_theme_left_separator_main="" 245 + tmux_conf_theme_left_separator_sub="|" 246 + tmux_conf_theme_right_separator_main="" 247 + tmux_conf_theme_right_separator_sub="|" 248 + #tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline 249 + #tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with 250 + #tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone 251 + #tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md 252 + 253 + # status left/right content: 254 + # - separate main sections with "|" 255 + # - separate subsections with "," 256 + # - built-in variables are: 257 + # - #{battery_bar} 258 + # - #{battery_hbar} 259 + # - #{battery_percentage} 260 + # - #{battery_status} 261 + # - #{battery_vbar} 262 + # - #{circled_session_name} 263 + # - #{hostname_ssh} 264 + # - #{hostname} 265 + # - #{hostname_full} 266 + # - #{hostname_full_ssh} 267 + # - #{loadavg} 268 + # - #{mouse} 269 + # - #{pairing} 270 + # - #{prefix} 271 + # - #{root} 272 + # - #{synchronized} 273 + # - #{uptime_y} 274 + # - #{uptime_d} (modulo 365 when #{uptime_y} is used) 275 + # - #{uptime_h} 276 + # - #{uptime_m} 277 + # - #{uptime_s} 278 + # - #{username} 279 + # - #{username_ssh} 280 + tmux_conf_theme_status_left=" ❐ #S | #{pretty_pane_current_path} " 281 + #tmux_conf_theme_status_left=" ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} | #{pretty_pane_current_path} " 282 + tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized} , %R , %d %b | #{username}#{root} | #{hostname} " 283 + 284 + # status left style 285 + tmux_conf_theme_status_left_fg="$tmux_conf_theme_colour_6,$tmux_conf_theme_colour_7,$tmux_conf_theme_colour_8" 286 + tmux_conf_theme_status_left_bg="$tmux_conf_theme_colour_9,$tmux_conf_theme_colour_10,$tmux_conf_theme_colour_11" 287 + tmux_conf_theme_status_left_attr="bold,none,none" 288 + 289 + # status right style 290 + tmux_conf_theme_status_right_fg="$tmux_conf_theme_colour_12,$tmux_conf_theme_colour_13,$tmux_conf_theme_colour_14" 291 + tmux_conf_theme_status_right_bg="$tmux_conf_theme_colour_15,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_17" 292 + tmux_conf_theme_status_right_attr="none,none,bold" 293 + 294 + # pairing indicator 295 + tmux_conf_theme_pairing="⚇" # U+2687 296 + tmux_conf_theme_pairing_fg="none" 297 + tmux_conf_theme_pairing_bg="none" 298 + tmux_conf_theme_pairing_attr="none" 299 + 300 + # prefix indicator 301 + tmux_conf_theme_prefix="⌨" # U+2328 302 + tmux_conf_theme_prefix_fg="none" 303 + tmux_conf_theme_prefix_bg="none" 304 + tmux_conf_theme_prefix_attr="none" 305 + 306 + # mouse indicator 307 + tmux_conf_theme_mouse="↗" # U+2197 308 + tmux_conf_theme_mouse_fg="none" 309 + tmux_conf_theme_mouse_bg="none" 310 + tmux_conf_theme_mouse_attr="none" 311 + 312 + # root indicator 313 + tmux_conf_theme_root="!" 314 + tmux_conf_theme_root_fg="none" 315 + tmux_conf_theme_root_bg="none" 316 + tmux_conf_theme_root_attr="bold,blink" 317 + 318 + # synchronized indicator 319 + tmux_conf_theme_synchronized="⚏" # U+268F 320 + tmux_conf_theme_synchronized_fg="none" 321 + tmux_conf_theme_synchronized_bg="none" 322 + tmux_conf_theme_synchronized_attr="none" 323 + 324 + # battery bar symbols 325 + tmux_conf_battery_bar_symbol_full="◼" 326 + tmux_conf_battery_bar_symbol_empty="◻" 327 + #tmux_conf_battery_bar_symbol_full="♥" 328 + #tmux_conf_battery_bar_symbol_empty="·" 329 + 330 + # battery bar length (in number of symbols), possible values are: 331 + # - auto 332 + # - a number, e.g. 5 333 + tmux_conf_battery_bar_length="auto" 334 + 335 + # battery bar palette, possible values are: 336 + # - gradient (default) 337 + # - heat 338 + # - "colour_full_fg,colour_empty_fg,colour_bg" 339 + # - gradient(colour_fg_1,colour_fg_2,...,colour_fg_n) 340 + tmux_conf_battery_bar_palette="gradient" 341 + #tmux_conf_battery_bar_palette="#d70000,#e4e4e4,#000000" # red, white, black 342 + #tmux_conf_battery_bar_palette="gradient(#00afff,#47a2ff,#7c91ff,#ac7afb,#d65be2,#e163df,#eb6cdd,#f475db,#ec9ff1,#eac3fe,#efe2ff,#ffffff)" 343 + 344 + # battery hbar palette, possible values are: 345 + # - gradient (default) 346 + # - heat 347 + # - "colour_low,colour_half,colour_full" 348 + # - gradient(colour_fg_1,colour_fg_2,...,colour_fg_n) 349 + tmux_conf_battery_hbar_palette="gradient" 350 + #tmux_conf_battery_hbar_palette="#d70000,#ff5f00,#5fff00" # red, orange, green 351 + #tmux_conf_battery_hbar_palette="gradient(#00afff,#47a2ff,#7c91ff,#ac7afb,#d65be2,#e163df,#eb6cdd,#f475db,#ec9ff1,#eac3fe,#efe2ff,#ffffff)" 352 + 353 + # battery vbar palette, possible values are: 354 + # - gradient (default) 355 + # - heat 356 + # - "colour_low,colour_half,colour_full" 357 + # - gradient(colour_fg_1,colour_fg_2,...,colour_fg_n) 358 + tmux_conf_battery_vbar_palette="gradient" 359 + #tmux_conf_battery_vbar_palette="#d70000,#ff5f00,#5fff00" # red, orange, green 360 + #tmux_conf_battery_vbar_palette="gradient(#00afff,#47a2ff,#7c91ff,#ac7afb,#d65be2,#e163df,#eb6cdd,#f475db,#ec9ff1,#eac3fe,#efe2ff,#ffffff)" 361 + 362 + # symbols used to indicate whether battery is charging or discharging 363 + tmux_conf_battery_status_charging="↑" # U+2191 364 + tmux_conf_battery_status_discharging="↓" # U+2193 365 + #tmux_conf_battery_status_charging="🔌" # U+1F50C 366 + #tmux_conf_battery_status_discharging="🔋" # U+1F50B 367 + 368 + # clock style (when you hit <prefix> + t) 369 + # you may want to use %I:%M %p in place of %R in tmux_conf_theme_status_right 370 + tmux_conf_theme_clock_colour="$tmux_conf_theme_colour_4" 371 + tmux_conf_theme_clock_style="24" 372 + 373 + 374 + # -- clipboard ----------------------------------------------------------------- 375 + 376 + # in copy mode, copying selection also copies to the OS clipboard 377 + # - true 378 + # - false (default) 379 + # - disabled 380 + # on Linux, this requires xsel, xclip or wl-copy 381 + tmux_conf_copy_to_os_clipboard=false 382 + 383 + 384 + # -- urlscan ------------------------------------------------------------------- 385 + 386 + # options passed to urlscan 387 + tmux_conf_urlscan_options="--compact --dedupe" 388 + 389 + 390 + # -- user customizations ------------------------------------------------------- 391 + 392 + # this is the place to override or undo settings 393 + 394 + # increase history size 395 + #set -g history-limit 10000 396 + 397 + # start with mouse mode enabled 398 + #set -g mouse on 399 + 400 + # force Vi mode 401 + # really you should export VISUAL or EDITOR environment variable, see manual 402 + #set -g status-keys vi 403 + #set -g mode-keys vi 404 + 405 + # replace C-b by C-a instead of using both prefixes 406 + # set -gu prefix2 407 + # unbind C-a 408 + # unbind C-b 409 + # set -g prefix C-a 410 + # bind C-a send-prefix 411 + 412 + # if you don't want Oh my tmux! to alter a binding or a setting, use #!important 413 + # bind c new-window -c '#{pane_current_path}' #!important 414 + 415 + # move status line to top 416 + #set -g status-position top 417 + 418 + 419 + # -- tpm ----------------------------------------------------------------------- 420 + 421 + # while I don't use tpm myself, many people requested official support so here 422 + # is a seamless integration that automatically installs plugins in parallel 423 + 424 + # whenever a plugin introduces a variable to be used in 'status-left' or 425 + # 'status-right', you can use it in 'tmux_conf_theme_status_left' and 426 + # 'tmux_conf_theme_status_right' variables. 427 + 428 + # by default, launching tmux will update tpm and all plugins 429 + # - true (default) 430 + # - false 431 + tmux_conf_update_plugins_on_launch=true 432 + 433 + # by default, reloading the configuration will update tpm and all plugins 434 + # - true (default) 435 + # - false 436 + tmux_conf_update_plugins_on_reload=true 437 + 438 + # by default, reloading the configuration will uninstall tpm and plugins when no 439 + # plugins are enabled 440 + # - true (default) 441 + # - false 442 + tmux_conf_uninstall_plugins_on_reload=true 443 + 444 + # /!\ the tpm bindings differ slightly from upstream: 445 + # - installing plugins: <prefix> + I 446 + # - uninstalling plugins: <prefix> + Alt + u 447 + # - updating plugins: <prefix> + u 448 + 449 + # /!\ do not add set -g @plugin 'tmux-plugins/tpm' 450 + # /!\ do not add run '~/.tmux/plugins/tpm/tpm' 451 + 452 + # to enable a plugin, use the 'set -g @plugin' syntax: 453 + # visit https://github.com/tmux-plugins for available plugins 454 + #set -g @plugin 'tmux-plugins/tmux-copycat' 455 + #set -g @plugin 'tmux-plugins/tmux-cpu' 456 + #set -g @plugin 'tmux-plugins/tmux-resurrect' 457 + #set -g @plugin 'tmux-plugins/tmux-continuum' 458 + #set -g @continuum-restore 'on' 459 + 460 + 461 + # -- custom variables ---------------------------------------------------------- 462 + 463 + # to define a custom #{foo} variable, define a POSIX shell function between the 464 + # '# EOF' and the '# "$@"' lines. Please note that the opening brace { character 465 + # must be on the same line as the function name otherwise the parse won't detect 466 + # it. 467 + # 468 + # then, use #{foo} in e.g. the 'tmux_conf_theme_status_left' or the 469 + # 'tmux_conf_theme_status_right' variables. 470 + 471 + # ------------------------------------------------------------------------------ 472 + 473 + # # /!\ do not remove the following line 474 + # EOF 475 + # 476 + # # /!\ do not "uncomment" the functions: the leading "# " characters are needed 477 + # 478 + # # usage: #{weather} 479 + # weather() { # see https://github.com/chubin/wttr.in#one-line-output 480 + # curl -f -s -m 2 'wttr.in?format=3' || printf '\n' # /!\ make sure curl is installed 481 + # sleep 900 # sleep for 15 minutes, throttle network requests whatever the value of status-interval 482 + # } 483 + # 484 + # # usage: #{online} 485 + # online() { 486 + # ping -c 1 1.1.1.1 >/dev/null 2>&1 && printf '✔' || printf '✘' 487 + # } 488 + # 489 + # # usage: #{wan_ip_v4} 490 + # wan_ip_v4() { 491 + # curl -f -s -m 2 -4 ifconfig.me 492 + # sleep 300 # sleep for 5 minutes, throttle network requests whatever the value of status-interval 493 + # } 494 + # 495 + # # usage: #{wan_ip_v6} 496 + # wan_ip_v6() { 497 + # curl -f -s -m 2 -6 ifconfig.me 498 + # sleep 300 # sleep for 5 minutes, throttle network requests whatever the value of status-interval 499 + # } 500 + # 501 + # # usage: #{github_stars}, #{github_stars tmux/tmux}, ... 502 + # github_stars() { 503 + # repository=${1##*https://github.com/} 504 + # repository=${repository%% *} 505 + # repository=${repository%%.git} 506 + # url="https://api.github.com/repos/${repository:-gpakosz/.tmux}" 507 + # curl -s "$url" | perl -MJSON::PP=decode_json -CO -0777 -E '$response = decode_json(readline *STDIN); say ($response->{stargazers_count})' 508 + # sleep 300 # sleep for 5 minutes, throttle network requests whatever the value of status-interval 509 + # } 510 + # 511 + # "$@" 512 + # # /!\ do not remove the previous line 513 + # # do not write below this line
+188
.zshrc
··· 1 + # Add deno completions to search path 2 + if [[ ":$FPATH:" != *":/Users/finxol/.zsh/completions:"* ]]; then export FPATH="/Users/finxol/.zsh/completions:$FPATH"; fi 3 + # If you come from bash you might have to change your $PATH. 4 + # export PATH=$HOME/bin:/usr/local/bin:$PATH 5 + 6 + # Path to your oh-my-zsh installation. 7 + export ZSH="$HOME/.oh-my-zsh" 8 + 9 + # Set name of the theme to load --- if set to "random", it will 10 + # load a random theme each time oh-my-zsh is loaded, in which case, 11 + # to know which specific one was loaded, run: echo $RANDOM_THEME 12 + # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes 13 + ZSH_THEME="gallifrey" 14 + 15 + # Set list of themes to pick from when loading at random 16 + # Setting this variable when ZSH_THEME=random will cause zsh to load 17 + # a theme from this variable instead of looking in $ZSH/themes/ 18 + # If set to an empty array, this variable will have no effect. 19 + # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) 20 + 21 + # Uncomment the following line to use case-sensitive completion. 22 + # CASE_SENSITIVE="true" 23 + 24 + # Uncomment the following line to use hyphen-insensitive completion. 25 + # Case-sensitive completion must be off. _ and - will be interchangeable. 26 + # HYPHEN_INSENSITIVE="true" 27 + 28 + # Uncomment one of the following lines to change the auto-update behavior 29 + # zstyle ':omz:update' mode disabled # disable automatic updates 30 + # zstyle ':omz:update' mode auto # update automatically without asking 31 + # zstyle ':omz:update' mode reminder # just remind me to update when it's time 32 + 33 + # Uncomment the following line to change how often to auto-update (in days). 34 + # zstyle ':omz:update' frequency 13 35 + 36 + # Uncomment the following line if pasting URLs and other text is messed up. 37 + # DISABLE_MAGIC_FUNCTIONS="true" 38 + 39 + # Uncomment the following line to disable colors in ls. 40 + # DISABLE_LS_COLORS="true" 41 + 42 + # Uncomment the following line to disable auto-setting terminal title. 43 + # DISABLE_AUTO_TITLE="true" 44 + 45 + # Uncomment the following line to enable command auto-correction. 46 + # ENABLE_CORRECTION="true" 47 + 48 + # Uncomment the following line to display red dots whilst waiting for completion. 49 + # You can also set it to another string to have that shown instead of the default red dots. 50 + # e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" 51 + # Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) 52 + # COMPLETION_WAITING_DOTS="true" 53 + 54 + # Uncomment the following line if you want to disable marking untracked files 55 + # under VCS as dirty. This makes repository status check for large repositories 56 + # much, much faster. 57 + # DISABLE_UNTRACKED_FILES_DIRTY="true" 58 + 59 + # Uncomment the following line if you want to change the command execution time 60 + # stamp shown in the history command output. 61 + # You can set one of the optional three formats: 62 + # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 63 + # or set a custom format using the strftime function format specifications, 64 + # see 'man strftime' for details. 65 + # HIST_STAMPS="mm/dd/yyyy" 66 + 67 + # Would you like to use another custom folder than $ZSH/custom? 68 + # ZSH_CUSTOM=/path/to/new-custom-folder 69 + 70 + # Which plugins would you like to load? 71 + # Standard plugins can be found in $ZSH/plugins/ 72 + # Custom plugins may be added to $ZSH_CUSTOM/plugins/ 73 + # Example format: plugins=(rails git textmate ruby lighthouse) 74 + # Add wisely, as too many plugins slow down shell startup. 75 + plugins=(git) 76 + 77 + source $ZSH/oh-my-zsh.sh 78 + 79 + # User configuration 80 + 81 + # export MANPATH="/usr/local/man:$MANPATH" 82 + 83 + # You may need to manually set your language environment 84 + # export LANG=en_US.UTF-8 85 + 86 + # Preferred editor for local and remote sessions 87 + # if [[ -n $SSH_CONNECTION ]]; then 88 + # export EDITOR='vim' 89 + # else 90 + # export EDITOR='mvim' 91 + # fi 92 + 93 + # Compilation flags 94 + # export ARCHFLAGS="-arch x86_64" 95 + 96 + # Set personal aliases, overriding those provided by oh-my-zsh libs, 97 + # plugins, and themes. Aliases can be placed here, though oh-my-zsh 98 + # users are encouraged to define aliases within the ZSH_CUSTOM folder. 99 + # For a full list of active aliases, run `alias`. 100 + # 101 + # Example aliases 102 + # alias zshconfig="mate ~/.zshrc" 103 + # alias ohmyzsh="mate ~/.oh-my-zsh" 104 + 105 + 106 + 107 + 108 + alias ll="eza -la --icons --group-directories-first --git" 109 + 110 + export PATH="/opt/homebrew/opt/node@20/bin:$PATH" 111 + 112 + 113 + ############### 114 + # SSH Aliases # 115 + ############### 116 + 117 + # Connect to VM 118 + alias ssh-vm="ssh 'finxol@fdfa:6c9d:d516:7dda:78b0:39ff:fe3d:e285'" 119 + 120 + # Connect to DigitalOcean droplet 121 + alias dopers="ssh finxol@157.230.116.140" 122 + 123 + # Connect to local Raspberry Pi 124 + raspi() { 125 + ip=`curl -s https://am.i.mullvad.net/ip` 126 + 127 + if [ "$ip" = "82.67.127.125" ]; then 128 + ssh finxol@192.168.1.158 129 + else 130 + echo "Not connected to home network" 131 + echo "Please connect to Wireguard VPN" 132 + fi 133 + } 134 + 135 + ############### 136 + 137 + # bun completions 138 + [ -s "/Users/finxol/.bun/_bun" ] && source "/Users/finxol/.bun/_bun" 139 + 140 + # bun 141 + export BUN_INSTALL="$HOME/.bun" 142 + export PATH="$BUN_INSTALL/bin:$PATH" 143 + 144 + # Deno global packages 145 + export PATH="$PATH:$HOME/.deno/bin" 146 + 147 + export EDITOR="vim" 148 + 149 + alias c="clear -x" 150 + export PATH="/opt/homebrew/opt/node@22/bin:$PATH" 151 + 152 + # pnpm 153 + export PNPM_HOME="/Users/finxol/Library/pnpm" 154 + case ":$PATH:" in 155 + *":$PNPM_HOME:"*) ;; 156 + *) export PATH="$PNPM_HOME:$PATH" ;; 157 + esac 158 + # pnpm end 159 + 160 + # bit 161 + case ":$PATH:" in 162 + *":/Users/finxol/bin:"*) ;; 163 + *) export PATH="$PATH:/Users/finxol/bin" ;; 164 + esac 165 + # bit end 166 + 167 + 168 + eval "$(zoxide init zsh)" 169 + 170 + # Automatically attach to or create tmux session named 'default' 171 + # only when running inside Ghostty and not already in tmux. 172 + if [[ -z "$TMUX" && "$TERM_PROGRAM" = "ghostty" ]]; then 173 + exec tmux new -A -s default 174 + fi 175 + 176 + # Deploy Jester's stock website 177 + deploy-stock() { 178 + dopers "pm2 stop stock-stats && rm -rf /srv/http/stock-stats/*" && rsync -av --exclude=node_modules -e "ssh -i ~/.ssh/id_rsa" ~/Projects/dev/web/stock-stats/* finxol@157.230.116.140:/srv/http/stock-stats && dopers "cd /srv/http/stock-stats && ~/.bun/bin/bun install && ~/.bun/bin/bun run build && NODE_ENVIRONMENT=production pm2 start .output/server/index.mjs --name stock-stats" 179 + } 180 + 181 + # Unquarantine app 182 + fix-app() { 183 + xattr -d com.apple.quarantine $1 184 + } 185 + . "/Users/finxol/.deno/env" 186 + # Initialize zsh completions (added by deno install script) 187 + autoload -Uz compinit 188 + compinit
+159
setup.sh
··· 1 + #!/bin/bash 2 + 3 + # This script automates the initial setup and hardening of a new Debian-based server. 4 + # It must be run as root. 5 + # 6 + # The script will: 7 + # 1. Create a new sudo user. 8 + # 2. Move the root SSH key to the new user. 9 + # 3. Harden the SSH server configuration. 10 + # 4. Install bat, eza, and Docker. 11 + 12 + # --- Configuration --- 13 + readonly USERNAME="finxol" 14 + # Define a temporary password. This will be immediately expired. 15 + # WARNING: This password will be stored in the script file and potentially 16 + # in your shell history. This is an acceptable risk for a brand new server 17 + # where the password will be changed upon first login. 18 + readonly TEMP_PASS="password" 19 + 20 + # --- Script Execution --- 21 + 22 + # Exit immediately if a command exits with a non-zero status. 23 + set -e 24 + # Treat unset variables as an error. 25 + set -u 26 + # Ensure that pipelines return the exit status of the last command to fail. 27 + set -o pipefail 28 + 29 + # --- Helper Functions --- 30 + log() { 31 + echo 32 + echo "▶ $1" 33 + echo "--------------------------------------------------" 34 + } 35 + 36 + # --- Pre-flight Checks --- 37 + if [ "$(id -u)" -ne 0 ]; then 38 + echo "This script must be run as root." >&2 39 + exit 1 40 + fi 41 + 42 + # --- User and Sudo Setup --- 43 + log "Creating user '$USERNAME' and granting sudo privileges" 44 + 45 + # Create a new user without an interactive password prompt. 46 + adduser --disabled-password --gecos "" "$USERNAME" 47 + 48 + # Programmatically set the temporary password for the new user. 49 + echo "$USERNAME:$TEMP_PASS" | chpasswd 50 + echo "Temporary password has been set for '$USERNAME'." 51 + 52 + # Force the user to change their password on the next login. 53 + chage -d 0 "$USERNAME" 54 + 55 + # Add the new user to the 'sudo' group to grant administrative privileges. 56 + usermod -aG sudo "$USERNAME" 57 + echo "User '$USERNAME' created and added to the sudo group." 58 + # --- SSH Key Migration --- 59 + log "Migrating SSH key from root to '$USERNAME'" 60 + # Create the .ssh directory for the new user if it doesn't exist. 61 + mkdir -p "/home/$USERNAME/.ssh" 62 + 63 + # Move the root user's authorized_keys file to the new user's .ssh directory. 64 + mv /root/.ssh/authorized_keys "/home/$USERNAME/.ssh/authorized_keys" 65 + 66 + # Set the correct ownership and permissions for the .ssh directory and its contents. 67 + chown -R "$USERNAME:$USERNAME" "/home/$USERNAME/.ssh" 68 + chmod 700 "/home/$USERNAME/.ssh" 69 + chmod 600 "/home/$USERNAME/.ssh/authorized_keys" 70 + echo "SSH key successfully migrated." 71 + 72 + # --- SSH Server Hardening --- 73 + log "Hardening SSH server configuration" 74 + readonly SSHD_CONFIG="/etc/ssh/sshd_config" 75 + 76 + # A function to safely set a parameter in sshd_config. 77 + # It comments out any existing instance of the key and appends the new setting. 78 + set_ssh_config() { 79 + local key="$1" 80 + local value="$2" 81 + 82 + # Comment out any existing lines with the key to deactivate them. 83 + # The -E flag enables extended regular expressions for the '+' quantifier. 84 + sed -i -E "s/^[[:space:]]*#?[[:space:]]*($key)([[:space:]]+.*)?$/#\1\2/g" "$SSHD_CONFIG" 85 + 86 + # Append the new, correct setting to the end of the file. 87 + echo "$key $value" >> "$SSHD_CONFIG" 88 + } 89 + 90 + # --- Apply Hardening Rules --- 91 + # Note: We are now using a function to ensure settings are applied correctly, 92 + # preventing issues with duplicate or conflicting rules. 93 + 94 + set_ssh_config "UsePAM" "yes" 95 + set_ssh_config "PasswordAuthentication" "no" 96 + set_ssh_config "KbdInteractiveAuthentication" "no" 97 + 98 + set_ssh_config "PermitRootLogin" "no" 99 + set_ssh_config "PermitEmptyPasswords" "no" 100 + set_ssh_config "X11Forwarding" "no" 101 + set_ssh_config "AllowAgentForwarding" "no" 102 + 103 + # --- Custom Hardening Settings --- 104 + set_ssh_config "ClientAliveInterval" "300" 105 + set_ssh_config "ClientAliveCountMax" "2" 106 + set_ssh_config "LoginGraceTime" "60" 107 + set_ssh_config "MaxAuthTries" "3" 108 + set_ssh_config "MaxSessions" "4" 109 + 110 + # Validate the new sshd_config and restart the SSH service to apply changes. 111 + sshd -t && systemctl restart sshd 112 + echo "SSH server hardened and restarted." 113 + 114 + # --- Package Installation --- 115 + log "Updating package lists and installing applications" 116 + apt-get update 117 + 118 + # Install bat (a cat clone with syntax highlighting) 119 + apt-get install -y bat 120 + # On Debian/Ubuntu, the binary can be named 'batcat'. Create a symlink if needed. 121 + if ! command -v bat &>/dev/null && command -v batcat &>/dev/null; then 122 + ln -s /usr/bin/batcat /usr/bin/bat 123 + fi 124 + 125 + # Install eza (a modern replacement for ls) 126 + apt-get install -y gpg 127 + mkdir -p /etc/apt/keyrings 128 + wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | 129 + gpg --dearmor -o /etc/apt/keyrings/gierens.gpg 130 + echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | 131 + tee /etc/apt/sources.list.d/gierens.list 132 + chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list 133 + apt-get update 134 + apt-get install -y eza 135 + 136 + # Install Docker Engine 137 + apt-get install -y ca-certificates curl 138 + install -m 0755 -d /etc/apt/keyrings 139 + curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc 140 + chmod a+r /etc/apt/keyrings/docker.asc 141 + 142 + echo \ 143 + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ 144 + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | 145 + tee /etc/apt/sources.list.d/docker.list >/dev/null 146 + apt-get update 147 + apt-get install -y docker-ce docker-ce-cli containerd.io \ 148 + docker-buildx-plugin docker-compose-plugin 149 + 150 + # Add the new user to the 'docker' group to allow running Docker without sudo. 151 + # The '|| true' prevents the script from failing if the group already exists. 152 + groupadd docker || true 153 + usermod -aG docker "$USERNAME" 154 + echo "Docker installed and '$USERNAME' added to the docker group." 155 + 156 + # --- Finalization --- 157 + log "Server setup complete!" 158 + echo "You can now log out and reconnect as '$USERNAME' using your SSH key." 159 + echo "Root login and password authentication have been disabled."