mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 19:32:43 +00:00
chore(config): update terminal, tmux, and starship configurations
This commit is contained in:
1 parent
f2802b3cd8
commit
ce9886c2e7
10 files changed
+236
-50
No files matched your search
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
# ~/.config/tmux/tab-label.sh — the non-editor tab label, kitty tab_bar.py's
|
||||
# rule: the repo the pane's cwd belongs to (dir name if no repo, ~ at home).
|
||||
# Editors (the open file) are handled in tmux.conf's automatic-rename-format.
|
||||
# Args: $1 pane_current_path $2 window_id
|
||||
|
||||
path=$1 window=$2
|
||||
|
||||
if [[ $path == "$HOME" ]]; then
|
||||
label='~'
|
||||
else
|
||||
dir=$path
|
||||
while [[ -n $dir && ! -e $dir/.git ]]; do dir=${dir%/*}; done
|
||||
root=${dir:-$path}
|
||||
label=${root##*/}
|
||||
fi
|
||||
printf '%s' "$label"
|
||||
|
||||
# tmux runs #() jobs async and only re-checks a window's name on pane output,
|
||||
# so after a `cd` the tab would keep the old label until the next keystroke.
|
||||
# Re-arming automatic-rename makes tmux re-check now and pick up this output.
|
||||
if [[ -n $window && $(tmux display -p -t "$window" '#W' 2>/dev/null) != *"${label:0:26}"* ]]; then
|
||||
tmux set -w -t "$window" automatic-rename on >/dev/null 2>&1 &
|
||||
fi
|
||||
Reference in new issue
Block a user