tmux-continuum
tmux-continuum copied to clipboard
XAUTHORITY environment variable is not set when using automatic tmux start with systemd
The issue prevents me (among other things) from copying text using xclip:
$ alias cb
cb='xclip -sel clip'
$ echo foobar | cb
Invalid MIT-MAGIC-COOKIE-1 key
Error: Can't open display: :0
$ xauth
Using authority file /home/amiculas/.Xauthority
xauth>
XAUTHORITY is empty in the tmux panes, but in a newly opened terminal it's set:
$ echo $XAUTHORITY
/tmp/xauth_cIHUDf
$ xauth
Using authority file /tmp/xauth_cIHUDf
xauth>
It can be observed that xauth is using the default file ~/.Xautority in tmux, but it uses another file /tmp/xauth_cIHUDf in a newly opened terminal.
Systemd unit:
[Unit]
Description=tmux default session (detached)
Documentation=man:tmux(1)
[Service]
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/tmux new-session -d
ExecStop=/home/amiculas/.tmux/plugins/tmux-resurrect/scripts/save.sh
ExecStop=/usr/bin/tmux kill-server
KillMode=control-group
RestartSec=2
[Install]
WantedBy=default.target
Systemd service:
$ systemctl --user status tmux.service
● tmux.service - tmux default session (detached)
Loaded: loaded (/home/amiculas/.config/systemd/user/tmux.service; enabled; preset: enabled)
Active: active (running) since Mon 2023-10-16 17:29:59 EEST; 10min ago
Docs: man:tmux(1)
Main PID: 1180 (tmux: server)
Tasks: 1396 (limit: 18804)
Memory: 5.8G
CPU: 3min 17.858s
Probably related to https://github.com/tmux-plugins/tmux-resurrect/issues/332
Hello, I just wanna say that this exact issue happens for me
Yes - I'd like to upvote this issue as well.
It prevents me from using xclip in any of the tmux panes or sessions I have open