forked from ofirgall/tmux-window-name
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux_window_name.tmux
executable file
·22 lines (16 loc) · 1.06 KB
/
tmux_window_name.tmux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pip_list=$(python3 -m pip list 2> /dev/null)
if ! echo "$pip_list" | grep libtmux -q; then
tmux display "ERROR: tmux-window-name - Python dependency libtmux not found (Check the README)"
exit 0
fi
tmux set -g automatic-rename off
tmux set-hook -g 'after-select-window[8921]' "run-shell -b ""$CURRENT_DIR""/scripts/rename_session_windows.py"
############################################################################################
### Hacks for preserving users custom window names, read more at enable_user_rename_hook ###
############################################################################################
"$CURRENT_DIR"/scripts/rename_session_windows.py --enable_rename_hook
# Disabling rename hooks when tmux-ressurect restores the sessions
tmux set -g @resurrect-hook-pre-restore-all ""$CURRENT_DIR"/scripts/rename_session_windows.py --disable_rename_hook"
tmux set -g @resurrect-hook-post-restore-all ""$CURRENT_DIR"/scripts/rename_session_windows.py --enable_rename_hook"