mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-05-15 14:15:52 -06:00
[GH-ISSUE #258] [documentation] Howto clipboard #129
Labels
No labels
Xorg
documentation
enhancement
macos
pull-request
question
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/lan-mouse#129
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DrYak on GitHub (Feb 7, 2025).
Original GitHub issue: https://github.com/feschber/lan-mouse/issues/258
Context
The roadmap in the main readme still lists clipboard unchecked:
While technically true, as lan-mouse's own protocol doesn't (and can't easily for technical reasons around UDP realtime communications) carry clipboard content, in practice clipboard sharing works like a charm (see #105) thanks to hooks, and external tools such as wl-clipboard/wl-clipboard-rs and xclip (for clipboard management) and SSH forced commands (for encryption and security) or Syncthing (keeping clipboard history synced)
In this HOWTO issue, several users have documented their respective solutions for sharing clipboard content.
TODO
Link this issue from the roadmap.
UPDATE
@bushyice commented on GitHub (May 1, 2025):
Turns out the resource you need is either so scarce or no longer exists. But it's alright, if i manage to get a way to get clipboard or drag and drop work i'll comment it here in detail until you're back.
@bushyice commented on GitHub (May 2, 2025):
Here's what i am doing to have it sync my clipboard:
Just keep the IPs you wanna sync in
~/.config/clip-iplistand then run this. You might wanna installsocatandclipnotifyif you don't have them.Issues:
clipnotifyonswayand it didn't seem to work... But it's open source so if you need to you can clone the github repo and editclipnotify.c.It's not 100% solid, but i am using it right now.
@DrYak commented on GitHub (Jul 25, 2025):
And here is my script which is SSH-based instead of
netcat/socat/bash's/dev/tcp/…/etc. clear-text network pipes (It should be a bit safer for copy-pasting passwords around).Key points
sshfor encrypted transmission, instead of clear-text network pipes.enter_hook.Limitations
entry_hook, but you can still use the script from command line.Usage
-ithe script tries to search one namedid_… blah …_clipboard-wor-xwl-copycommand at the SSH receiver.Howto
This is how you configure your local (sender) machine, so that it can push the content of the clipboard to a remote (receiver) machine.
This can work no matter what display server the desktop environment uses at each end-point, you can mix and match Wayland or X11.
SSH Key
First you need to create a passphrase-less SSH key-pair dedicated to this script:
output of `ssh-keygen`
SSH Forced Commands
generate
We will use forced commands, so that in case of leaked key, the worst that can happen is random shit copied into the clipboard (not even the clipboard content could be inspected, and no arbitrary commands could be run).
Use the
-foption of the script to show the lines that should be added to the remote machine:output of `pushclipboard -f`
configure remote receiving end
Depending on what desktop environment the remote (receiver) machine is running, copy the appropriate
command="…etcline for either Wayland or X11 display server, and add it to the.ssh/authorized_keysfile on that remote (receiver) machine:Test it on the CLI
On the local (sender) machine, copy something into the clipboard, either with the mouse, the keyboard, or the command line:
Try pushing the content of the keyboard to the remote (receiver) machine using the script on the command line interface:
output of `pushclipboard steamdeck.local`
Check that the remote (receiver) machine successfully put the string in its clipboard, either by checking the clipboard, or by pasting with the mouse, the keyboard, or the command line:
or
Configure lan-mouse
On the local (sender) machine you can edit the configuration file:
and add the
enter_hookoption for theclientsentry specific to that remote (receive) machine:Test it in lan-mouse
Now test that in lan-mouse, when moving the cursor from a Wayland Linux instance to another Linux instance, the clipboard gets copied over.
lan-mouse's logs
Rinse and repeat
You can repeat the above steps to add more machines.
Source code
pushclipboard
TODO
@DrYak commented on GitHub (Jul 25, 2025):
@kevinJ045
small improvement suggestion:
You paid attentions to avoid trailing lines with
-noption ofwl-paste... but are then accidentally reintroducing one withecho. I would suggest using echo's-noption:also side-note, as you're using bash:
bash has its own network stack with
/dev/tcp/and/dev/udp, so you could also potentially write:Also, FYI, I am trying to gather a collection of what people have implemented as solutions for clipboard sharing, so we can try to properly document it into lan-mouse. I think we could add yours, too.
@tmcnulty387 commented on GitHub (Jul 30, 2025):
A very simple way I've found to get clipboard syncing to work is by using https://github.com/quackduck/uniclip.
Once installed, you can run
uniclipon one machine and then it will prompt you with the command to run on the other, for exampleuniclip 10.42.0.200:38815.One downside I've found with uniclip is that you currently cannot directly target which network interface you want to use, however the network interface it chooses from what I've found is consistent and will always choose the same network interface given the same network configuration.
I would first try running
uniclipon both machines and see if either one targets the desired network interface first. Then you can turn off undesired network interfaces until it targets the desired one.Additionally, you can set the port using the
-pflag. That way the command to pair the devices always stays the same, for exampleuniclip -p 38815anduniclip 10.42.0.200:38815.@tmcnulty387 commented on GitHub (Jul 30, 2025):
Additionally, I've found that
wl-copyandwl-paste, which all wayland clipboard sharing methods use, doesn't work and freezes when in GNOME's overview mode. I switched to hyprland on both devices using end4's dotfiles and it's now working great. Highly recommend if you're looking for an alternative to GNOME.@paperluigis commented on GitHub (Aug 6, 2025):
i let KDE Connect handle the clipboard and it works fine
@DrYak commented on GitHub (Oct 24, 2025):
Note for people who run Plasma 6.5 and use the "focus stealing prevention" options:
wl-clipboardis now broken (https://github.com/bugaevc/wl-clipboard/issues/268), you need to switch to package wl-clipboard-rs, at least version 0.9.2.