tmux-continuum: Autosave not working
Autosave is not working and I’ve narrowed it down to this piece of code:
# Advanced edge case handling: start auto-saving only if this is the
# only tmux server. We don't want saved files from more environments to
# overwrite each other.
if ! another_tmux_server_running; then
# give user a chance to restore previously saved session
delay_saving_environment_on_first_plugin_load
add_resurrect_save_interpolation
fi
The problem is that I share my work environment with several co-workers. So, in total we may have > 3 tmux processes. This function grabs all of them:
all_tmux_processes() {
# ignores `tmux source-file .tmux.conf` command used to reload tmux.conf
ps -Ao "command pid" |
\grep "^tmux" |
\grep -v "^tmux source"
}
Long story short, it seems that add_resurrect_save_interpolation is never called because continuum thinks there are more than one TMUX servers running. Should it not consider only the running user’s processes?
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 6
- Comments: 19 (2 by maintainers)
Commits related to this issue
- Make tmux-continuum auto save work with "oh my tmux" See https://github.com/tmux-plugins/tmux-continuum/issues/48 — committed to rhazegh/.tmux by rhazegh 4 years ago
I also this problem. It seems that the default interval of 15 min isn’t applied. If I manually set
set -g @continuum-save-interval '15'it /seems/ to work.I judge by the output of scripts/continuum_status.sh which I put into my powerline configuration.
Not sure what exactly caused it but for me the culprit was https://github.com/jimeh/tmux-themepack. When sourcing my plugins with tpm I had to make sure to add the themepack before continuum.
Before (not working):
After (working):
Maybe it helps someone else 😃
If you are using “Oh My Tmux” (https://github.com/gpakosz/.tmux):
Open
.tmux.confand find the following line:Add these two lines after the above-mentioned line:
Save
.tmux.confand reload tmux configuration by<prefix> rinside a tmux session. Auto save should work now.The added script doesn’t print anything so there isn’t anything added to your status-right visually. It just uses the refresh of the status line to run the save script.
If you have to modify
status-rightafter tpm and want to use auto save, try adding this to yourstatus-right:#(~/.tmux/plugins/tmux-continuum/scripts/continuum_save.sh)Holy crap you’re right it is fixed for me now. Thank you so much for investigating this!
Would make sense as the auto save command gets written into
status-right. So everything that setsstatus-rightwould have to be loaded beforehand.At least if I got right from reading the code. In my opinion this should be stated in the readme (if correct).
EDIT: Just tested it by echoing from ./scripts/continuum_save.sh main(). The script is the first segment of the right status. So every modification of
status-righthas to be done before tpm sources continuum.I had a problem with autosave though I’m using only one tmux server. I use tmux attach to attach the sessions. This gets counted in for all_tmux_processes. So, I added a grep -v for tmux attach in helpers.sh
It works now.
Without the setting continuum_status.sh gives this: