tmux-resurrect
tmux-resurrect copied to clipboard
Allow XDG standards on save-dir.
Pretty much the title. I just want to use $XDG_DATA_HOME/tmux/resurrect as my save directory.
Thanks for your hard work.
You can do set -g @resurrect-dir "$XDG_DATA_HOME/tmux/resurrect".
Note the double quotes.
The doc is misleading about this. This will work assuming that XDG_DATA_HOME is exported in the environment when your tmux configuration is loaded.
I think this should be re-opened. Being able to set set -g @resurrect-dir "$XDG_DATA_HOME/tmux/resurrect" isn't really supporting the XDG standard.
- Each user must find this themself and configure accordingly.
- As commented by @sgleizes, the doc says one cannot use arbitrary shell variables, so using that configuration is basically "undefined behaviour".
- Implementing the XDG spec means that "if $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used." (how would users do that without tmux-resurrect support?)
My config is now set-option -g @resurrect-dir "~/.local/share/tmux/resurrect", but I wish I didn't have to do that.
Agreed. This should be the order priority:
@resurrect-dirtmux varTMUX_PLUGIN_MANAGER_PATH(from tpm is present) +/resurrect/XDG_DATA_HOME(if present) + ~~/resurrect/~~/tmux/resurrect/$HOME/.tmux/resurrect
XDG_DATA_HOME (if present) + /resurrect/
Nitpick, but perhaps use one of these instead of /resurrect/?
/tmux/resurrect//tmux-resurrect/
Oh, and more importantly think if XDG_DATA_HOME is unset, the default directory ~/.local/share should be used instead (ref. the spec). That would mean that $HOME/.tmux/resurrect is only used if it already exists, for backwards compatibility.
@bjornfor Exactly! In bash, this would be as simple as using
${XDG_DATA_HOME:-$HOME/.local/share}
to use the default value for the data directory if the envvar is not set.
+1 for being XDG compliant without the need for configuration. Tmux is XDG compliant since v3.1.
Also, why would we default to ~/.tmux/resurrect (or ~/.tmux-resurrect), instead of defaulting to ~/.local/share/...? The latter feels like behavior that is more aligned with the spirit of the XDG specification.