Save and restore hooks

This commit is contained in:
Sergey Vlasov
2018-01-19 18:36:13 +02:00
committed by Ash Berlin-Taylor
parent 42f77b303c
commit 0133c7a96a
6 changed files with 38 additions and 0 deletions

14
docs/hooks.md Normal file
View File

@ -0,0 +1,14 @@
# Save & Restore Hooks
Hooks allow to set custom commands that will be executed during session save and restore.
Currently the following hooks are supported:
- `@resurrect-save-hook` - executed after session save
- `@resurrect-restore-hook` - executed before session restore
Here is an example how to save and restore window geometry for most terminals in X11.
Add this to `.tmux.conf`:
set -g @resurrect-save-hook 'eval $(xdotool getwindowgeometry --shell $WINDOWID); echo 0,$X,$Y,$WIDTH,$HEIGHT > $HOME/.tmux/resurrect/geometry'
set -g @resurrect-restore-hook 'wmctrl -i -r $WINDOWID -e $(cat $HOME/.tmux/resurrect/geometry)'