mirror of
https://github.com/theniceboy/.config.git
synced 2026-01-07 07:37:23 +08:00
tmux custom window activate script hook
This commit is contained in:
parent
04c174c8ef
commit
8d13a7a39a
2 changed files with 23 additions and 0 deletions
|
|
@ -4,6 +4,7 @@
|
|||
# set-option default-path "$PWD" # deprecated in tmux 1.9
|
||||
|
||||
setw -g xterm-keys on
|
||||
set-window-option -g xterm-keys on
|
||||
set -s escape-time 0
|
||||
set -sg repeat-time 300
|
||||
set -s focus-events on
|
||||
|
|
@ -51,6 +52,11 @@ set-hook -ag client-attached 'run -b "tmux refresh-client -S"'
|
|||
set-hook -ag pane-focus-in 'run -b "~/.config/agent-tracker/bin/tracker-client command acknowledge --client #{client_tty} --session-id #{session_id} --window-id #{window_id} --pane #{pane_id}"'
|
||||
set-hook -ag pane-focus-in 'run -b "tmux refresh-client -S"'
|
||||
set-hook -ag pane-died 'run -b "~/.config/agent-tracker/bin/tracker-client command delete_task --client #{client_tty} --session-id #{session_id} --window-id #{window_id} --pane #{pane_id}"'
|
||||
|
||||
# -- Project-specific window activation hooks
|
||||
# Checks for ./on-tmux-window-activate.sh or ../on-tmux-window-activate.sh and runs it
|
||||
set-hook -ag after-select-window 'run-shell "~/.config/tmux/scripts/check_and_run_on_activate.sh \"#{pane_current_path}\""'
|
||||
|
||||
# set-hook -ag window-linked 'run -b "tmux refresh-client -S"'
|
||||
# set-hook -ag window-unlinked 'run -b "tmux refresh-client -S"'
|
||||
# set-hook -ag window-renamed 'run -b "tmux refresh-client -S"'
|
||||
|
|
|
|||
17
tmux/scripts/check_and_run_on_activate.sh
Executable file
17
tmux/scripts/check_and_run_on_activate.sh
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
# Check for on-tmux-window-activate.sh in current dir or parent dir and run it
|
||||
|
||||
pane_dir="${1:-$PWD}"
|
||||
|
||||
# Check current directory
|
||||
if [[ -x "$pane_dir/on-tmux-window-activate.sh" ]]; then
|
||||
exec "$pane_dir/on-tmux-window-activate.sh"
|
||||
fi
|
||||
|
||||
# Check parent directory
|
||||
parent_dir=$(dirname "$pane_dir")
|
||||
if [[ -x "$parent_dir/on-tmux-window-activate.sh" ]]; then
|
||||
exec "$parent_dir/on-tmux-window-activate.sh"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue