Skip to content

Instantly share code, notes, and snippets.

@dcode
Created January 25, 2024 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcode/912be128174c468a2dc28f263bdb7328 to your computer and use it in GitHub Desktop.
Save dcode/912be128174c468a2dc28f263bdb7328 to your computer and use it in GitHub Desktop.
Automatic waypipe setup for SSH remote forwarding of clipboard (via wl-copy/paste) and other Wayland clients

README

The goal of this gist is to setup waypipe to automically run locally on user login and remotely when you connect to it. In both cases, this is managed by systemd user session and assumes that is running. This took way too long to figure out, so I hope it helps someone (or me) in the future.

Instructions

Local

On your local system, copy the waypipe-client.service to the user systemd directory.

install -d 0755 ${HOME}/.config/systemd/user/
install waypipe-client.service ${HOME}/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now waypipe-client.service

Configure SSH Remote Forward by creating or amending an entry for your remote host. It should look like the ssh_config file in this gist.

Remote

On the remote system, do similarly with waypipe-server.service.

install -d 0755 ${HOME}/.config/systemd/user/
install waypipe-server.service ${HOME}/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now waypipe-server.service
# Append to ${HOME}/.ssh/config
Host my-remote
# other relevant configuration
RemoteForward ${XDG_RUNTIME_DIR}/waypipe-server.sock:${XDG_RUNTIME_DIR}/waypipe-client.sock
# ${HOME}/.config/systemd/user/waypipe-client.service
[Unit]
Description=Runs waypipe on startup to support SSH forwarding
[Service]
ExecStart=/usr/bin/waypipe --socket %t/%N.sock client
[Install]
WantedBy=default.target
# ${HOME}/.config/systemd/user/waypipe-server.service
[Unit]
Description=Runs waypipe on startup to support SSH forwarding
[Service]
Type=simple
ExecStart=/usr/bin/waypipe --socket %t/%N.sock --no-gpu --display %t/wayland-remote server -- sleep inf
[Install]
WantedBy=default.target
@dcode
Copy link
Author

dcode commented Jan 25, 2024

I tried to make this work with systemd socket activation, but it seems that just isn't possible yet. I filed a feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment