tmux-resurrect/docs/hooks.md

15 lines
641 B
Markdown
Raw Normal View History

2018-01-19 16:36:13 +00:00
# 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)'