mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 11:32:42 +00:00
Split niri, hypr, fish into submodules; tmux, tmux-palette, television, yazi into externals
This commit is contained in:
1 parent
ab29365a3d
commit
954e1e1ae0
216 files changed
+138
-9708
No files matched your search
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
# ~/.local/bin/tmux-niri-title — POSIX sh, runs on Linux and macOS.
|
||||
# Builds the context segment for tmux set-titles-string (e.g. a Niri title).
|
||||
# Priority: ssh target > nvim file > git branch > cwd basename
|
||||
# Args: $1 pane_current_command $2 pane_current_path $3 pane_tty $4 pane_title
|
||||
|
||||
cmd=$1 path=$2 tty=$3 title=$4
|
||||
|
||||
# 1) Remote session → " user@host"
|
||||
case "$cmd" in
|
||||
ssh | mosh-client | autossh | et)
|
||||
target=$(ps -o args= -t "$tty" 2>/dev/null | awk '
|
||||
/(^|\/)((auto)?ssh|mosh-client|et) / {
|
||||
for (i = 2; i <= NF; i++)
|
||||
if ($i !~ /^-/) { print $i; exit }
|
||||
}')
|
||||
printf ' %s' "${target:-remote}"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# 2) Editor → pane title (nvim sets "file – NVIM" when vim.opt.title = true)
|
||||
case "$cmd" in
|
||||
nvim | vim)
|
||||
if [ -n "$title" ] && [ "$title" != "$(hostname)" ]; then
|
||||
printf ' %s' "$title"
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# 3) Git repo → "dir branch"
|
||||
branch=$(git -C "$path" branch --show-current 2>/dev/null)
|
||||
if [ -n "$branch" ]; then
|
||||
printf '%s %s' "$(basename "$path")" "$branch"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 4) Fallback → cwd basename
|
||||
basename "$path"
|
||||
Reference in new issue
Block a user