I am trying to follow this tutorial which will help me copy text from remote tmux sessions onto my local clipboard.
The first there is to setup a systemd service which listens on a given port on the local machine and copies the contents to the clipboard using xclip. I am unable to reproduce the results. The xlclip.socket file is as follows:
[Unit]
Description=Network copy backend for tmux based on xclip
[Socket]
ListenStream=19988
Accept=yes
[Install]
WantedBy=sockets.target
The xclip@.service file is as follows:
[Unit]
Description=Copy backend service piping input to xclip
[Service]
Type=simple
ExecStart=/usr/bin/xclip -i -f -selection primary | /usr/bin/xclip -i -selection clipboard
StandardInput=socket
StandardOutput=socket
The error that I get is: Error: Can't open display: (null)
This probably indicates that xclip cannot access the clipboard which is managed by XServer. How should I solve this problem? Any help is appreciated.