0

I'm trying to adopt Alexey Samoshkin's approach to copy text from remote tmux session into local clipboard. I'm using xsel instead of xclip, and systemd user service instead of system one. Here is my working configuration:

/etc/systemd/user/xsel.socket:

[Unit]
Description=xsel network listener socket

[Socket]
ListenStream=54793
Accept=yes

[Install]
WantedBy=sockets.target

/etc/systemd/user/xsel@.service:

[Unit]
Description=xsel network listener service

[Service]
Type=simple
ExecStart=/usr/bin/xsel --input --clipboard --nodetach

StandardInput=socket
StandardOutput=socket

xsel version 1.2.0
systemd 245 (245.6-8-arch)

Everything works as expected, but only with --nodetach option. Without this option clipboard doesn't change at all. Would you explain why?

1 Answers1

1

If a service detaches then it cannot write to stdout any more. So the --nodetach is needed for keeping stdout (and being able to redirect it).

Hauke Laging
  • 5,157
  • 2
  • 23
  • 40