tmux-continuum
tmux-continuum copied to clipboard
tmux-continuum is overwriting the systemd user service
Re: https://github.com/tmux-plugins/tmux-continuum/blob/master/docs/systemd_details.md
This doc says that:
The first time tmux starts when @continuum-boot is set to 'on' tmux-continuum will generate a user level systemd unit file which it will save to ${HOME}/.config/systemd/user/tmux.service and enable it.
However, in practice, it appears to be doing this every time tmux starts. I go in and edit that file because I want to make it static (so that I can start tmux with my own script and make sure the env vars I want pass through, but still have things saved when I shut down [the ExecStop, etc.])...but my changes are reverted. I'm not sure if they are reverted on shutdown, startup, or daemon-reload, to be honest.
I will put in an override instead of tweaking the file directly for now.
This was happening to me as well which was really confusing to say the least!!
Additionally, my understanding is that ~/.config/systemd/user is analagous to /etc/systemd/system in the sense that it is supposed to only contain user-created service files.
A better place to put the program-generated service file would be $XDG_DATA_HOME/systemd/user, defaulting to ~/.local/share/systemd/user
Refer to this unix/linux stack exchange post and man 5 systemd.unit
Like @wizonesolutions said, to work around this issue, you can use:
systemctl --user edit tmux
which creates the file ~/.config/systemd/user/tmux.service.d/override.conf
and for example change the ExecStart and ExecStop commands to look in your $XDG_CONFIG_HOME instead of ~/.tmux.conf and ~/.tmux/plugins:
[Service]
ExecStart=
ExecStart=/usr/bin/tmux -f %E/tmux/tmux.conf new-session -d
ExecStop=
ExecStop=%E/tmux/plugins/tmux-resurrect/scripts/save.sh
ExecStop=/usr/bin/tmux kill-server
which is all I was trying to do.