|
1 | 1 | # Save & Restore Hooks
|
2 | 2 |
|
3 |
| -Hooks allow to set custom commands that will be executed during session save and restore. |
| 3 | +Hooks allow to set custom commands that will be executed during session save |
| 4 | +and restore. Most hooks are called with zero arguments, unless explicitly |
| 5 | +stated otherwise. |
4 | 6 |
|
5 | 7 | Currently the following hooks are supported:
|
6 | 8 |
|
7 |
| -- `@resurrect-save-hook` - executed after session save |
8 |
| -- `@resurrect-restore-hook` - executed before session restore |
| 9 | +- `@resurrect-hook-post-save-layout` |
| 10 | + |
| 11 | + Called after all sessions, panes and windows have been saved. |
| 12 | + |
| 13 | + Passed single argument of the state file. |
| 14 | + |
| 15 | +- `@resurrect-hook-post-save-all` |
| 16 | + |
| 17 | + Called at end of save process right before the spinner is turned off. |
| 18 | + |
| 19 | +- `@resurrect-hook-pre-restore-all` |
| 20 | + |
| 21 | + Called before any tmux state is altered. |
| 22 | + |
| 23 | +- `@resurrect-hook-pre-restore-history` |
| 24 | + |
| 25 | + Called after panes and layout have been restores, but before bash history is |
| 26 | + restored (if it is enabled) -- the hook is always called even if history |
| 27 | + saving is disabled. |
| 28 | + |
| 29 | +- `@resurrect-hook-pre-restore-pane-processes` |
| 30 | + |
| 31 | + Called after history is restored, but before running processes are restored. |
| 32 | + |
| 33 | +### Examples |
9 | 34 |
|
10 | 35 | Here is an example how to save and restore window geometry for most terminals in X11.
|
11 | 36 | Add this to `.tmux.conf`:
|
12 | 37 |
|
13 |
| - set -g @resurrect-save-hook 'eval $(xdotool getwindowgeometry --shell $WINDOWID); echo 0,$X,$Y,$WIDTH,$HEIGHT > $HOME/.tmux/resurrect/geometry' |
14 |
| - set -g @resurrect-restore-hook 'wmctrl -i -r $WINDOWID -e $(cat $HOME/.tmux/resurrect/geometry)' |
| 38 | + set -g @resurrect-hook-post-save-all 'eval $(xdotool getwindowgeometry --shell $WINDOWID); echo 0,$X,$Y,$WIDTH,$HEIGHT > $HOME/.tmux/resurrect/geometry' |
| 39 | + set -g @resurrect-hook-pre-restore-all 'wmctrl -i -r $WINDOWID -e $(cat $HOME/.tmux/resurrect/geometry)' |
0 commit comments