You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cli/load(fix[hooks]): Run on_project_start only for new session builds
why: on_project_start had been triggered before dispatch, so it also ran for paths that reused an existing session. That made --here rebuilds and interactive append flows execute a hook documented as new-session-only.
what:
- Move on_project_start execution into the attached and detached new-session load paths
- Keep --here rebuilds inside tmux and append flows from invoking the hook
- Preserve the outside-tmux --here fallback behavior, which still creates a new session
- Add dispatch tests for attached, detached, append, and here routing
- Add an on_project_exit guard assertion and fix the loader doctest ellipsis
- Update the related load, comparison, and configuration docs to match current behavior
Copy file name to clipboardExpand all lines: docs/cli/load.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -265,7 +265,7 @@ $ tmuxp load --here .
265
265
When used, tmuxp builds the workspace panes inside the current window rather than spawning a new session.
266
266
267
267
```{note}
268
-
`--here` sends shell commands (such as `cd` and `export` for environment variables) directly to the active pane via `send-keys`. The pane must be running a POSIX-compatible shell (bash, zsh, etc.). If the active pane is running a non-shell program (e.g., `vim`, `python`), those commands will be interpreted as input to that program.
268
+
When `--here` needs to provision a directory, environment, or shell, tmuxp uses tmux primitives (`set-environment` and `respawn-pane`) instead of typing `cd` / `export` into the pane. If provisioning is needed, tmux will replace the active pane process before the workspace commands run, so long-running child processes in that pane can be terminated.
| Deprecated pre | (none) |`pre` (deprecated → `on_project_start`+`on_project_restart`; runs before session create) | (none) |
86
87
| Deprecated post | (none) |`post` (deprecated → `on_project_stop`+`on_project_exit`; runs after attach on every invocation) | (none) |
87
88
89
+
tmuxp's lifecycle hook names are intentionally close to tmuxinator's, but `on_project_start` is limited to new-session creation and `on_project_exit` is guarded so teardown only runs when the last client detaches.
Copy file name to clipboardExpand all lines: docs/configuration/top-level.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ windows:
61
61
|------|-------------|
62
62
| `on_project_start` | Before session build (new session creation only) |
63
63
| `on_project_restart` | When reattaching to an existing session (confirmed attach only) |
64
-
| `on_project_exit` | On client detach (tmux `client-detached` hook) |
64
+
| `on_project_exit` | When the last client detaches (tmux `client-detached` hook) |
65
65
| `on_project_stop` | Before `tmuxp stop` kills the session |
66
66
67
67
Each hook accepts a string (single command) or a list of strings (multiple commands run sequentially).
@@ -74,12 +74,12 @@ on_project_start:
74
74
75
75
```{note}
76
76
These hooks are inspired by tmuxinator's lifecycle hooks but have tmuxp-specific semantics.
77
-
`on_project_start` only fires on new session creation (not on reattach).
77
+
`on_project_start` only fires on new session creation (not on reattach, append, or `--here`).
78
78
`on_project_restart`only fires when you confirm reattaching to an existing session.
79
79
```
80
80
81
81
```{note}
82
-
`on_project_exit` uses tmux's `client-detached` hook, which fires on **any** client detach — including terminal close, SSH disconnect, or manual `tmux detach`. Note: unlike tmuxinator (which fires `on_project_exit` once when the wrapper script exits), tmuxp's hook fires on every detach event for the lifetime of the session.
82
+
`on_project_exit` uses tmux's `client-detached` hook, but tmuxp guards it with `#{session_attached} == 0` so the command only runs when the **last** client detaches. This avoids repeated teardown in multi-client sessions. Unlike tmuxinator's wrapper-process hook, tmuxp keeps the hook on the session itself for the session lifetime.
0 commit comments