Closed poetaman closed 3 years ago
In my testing things look perfect now, no case is missed, all possibilities have been tested. Now I would wait for your code review, and questions/suggestions.
Hey, thank you for the work on this PR. This PR changes the plugin behavior a lot: instead of saving the whole environment (all the tmux sessions) it saves just a single session or a group of sessions. As a current user of this plugin this breaks my workflow, so unfortunately these changes are unacceptable.
You now seem to understand well how tmux-resurrect works. I encourage you to fork the plugin (or just copy the code if you prefer that), rename it and focus on adding features relevant to saving/restoring individual sessions or projects. I would fully support this other projects by linking to it from tmux-resurrect docs.
Changed helpers.sh and save.sh to allow simultaneously working on and maintaining multiple independent resurrect session files. Should resolve #246, and #389. Description of changes: 1) File helpers.sh: function get_tmux_option() now has an optional 3rd argument that can be used to pass custom option to tmux show-option command. This is used in function resurrect_dir() to pickup session local value of @resurrect-dir instead of using a global @resurrect-dir. Using session local values for @resurrect-dir is needed to maintain and simultaneously work with multiple different resurrect session files. 2) File save.sh: a missing filter has been applied to tmux list-sessions, tmux-listpanes, and tmux-listwindows. The filter does this: at time of saving a resurrect session, it checks if the current (attached) session is in a group. If that is true then the filter passes only sessions/panes/windows that belong to current (attached) group. Thus only current group's sessions/panes/windows are saved. If that is false, then filter passes only current (attached) session's panes and windows. Thus only current (attached) session's panes/windows are saved. Both changes to 1) and 2) together are required to enable working on multiple different resurrect sessions simultaneously, and independently. The effect of maintaining, working on multiple different resurrect sessions simultaneously can be achieved by the user by setting different values for @resurrect-dir. I confirm testing new capability.