Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XAUTHORITY environment variable is not set when using automatic tmux start with systemd #129

Open
ariel-miculas opened this issue Oct 16, 2023 · 2 comments

Comments

@ariel-miculas
Copy link

ariel-miculas commented Oct 16, 2023

The feature is desribed here

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 tmux-plugins/tmux-resurrect#332

@MagnetizedFreckles
Copy link

Hello, I just wanna say that this exact issue happens for me

@Chris-zerocopy
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants