A software KVM for Linux: share one keyboard, mouse and clipboard between two machines on a LAN, like Synergy, Barrier, Input Leap or Deskflow. It works the same under X11 and Wayland, including GNOME on Wayland. Push the pointer off the edge of one screen and it appears on the other. Copy text or an image on one machine and paste it on the other.
It should, if you share a keyboard and mouse between two Linux machines, at least one of them runs GNOME on Wayland, and:
- Deskflow or Input Leap stops capturing after the screen locks, and you have to allow it again after every unlock.
- Copy and paste between the machines does not work on Wayland.
- Barrier stopped working when you moved to Wayland.
It will not help if you need Windows or macOS, more than two machines, or crossing at the screen edge on a desktop other than GNOME.
Both come from Wayland's security model rather than from the tools:
- Capture stops whenever the screen locks. On Wayland an app can only take the keyboard and mouse through GNOME's InputCapture portal, and GNOME ends that session on lock, so it has to be approved again after every unlock.
- The clipboard does not cross. On GNOME Wayland only the focused app may read or write the clipboard, and a background sharing tool never has focus.
lankvm moves input below the display server, where neither applies.
Status: young. Used daily on Ubuntu 24.04 with GNOME 46, on both Wayland and X11, and tested against GNOME 46 to 51 on every push. Two machines only. Linux only.
machine with the keyboard (server) other machine (client)
keyboard, mouse ──evdev──▶ lankvm ══TLS 1.3══▶ lankvm ──uinput──▶ desktop
▲ ▲ ▲ ▲
edge, clip │ │ grab │ │ edge, clip, warp
GNOME Shell extension GNOME Shell extension
- The server reads the keyboard, mouse and touchpad straight from the kernel
(
/dev/input). While the pointer is on the other machine it grabs them (EVIOCGRAB), so its own desktop stops seeing them, and forwards the raw events. - The client creates a
/dev/uinputcopy of each of those devices and plays the events into it. To its desktop it looks like the keyboard and mouse were plugged in, so pointer speed, key repeat and the keyboard layout are the client's own, and its lock screen accepts typing. - A small GNOME Shell extension on each machine does the two jobs only the desktop can: noticing the pointer reach the shared edge (and placing it on arrival), and reading and writing the clipboard. It talks to the daemon over a Unix socket.
- The link is TLS 1.3, pinned: each machine trusts only the other's
certificate, which
lankvm pairexchanges once.
Nothing here asks the desktop for permission, so there is nothing for a lock screen to take away.
- Two Linux machines on the same network, each with Python 3.11+, openssl and a systemd user session. No Python packages are needed.
- GNOME Shell 46 to 51, for crossing at the screen edge and for the clipboard, on Wayland, or on X11 where your GNOME still has it. On other desktops lankvm still works, but you switch machines with a hotkey (Scroll Lock).
sudo, once per machine, to grant device access.
Clone this repository on both machines and cd into it:
git clone <repository URL> lankvm && cd lankvm-
Install.
--peer-sideis where the other machine sits, seen from this one. One side dials and the other listens; which way round does not matter../install.sh server --connect 192.168.1.20 --peer-side right # the machine with the keyboard and mouse ./install.sh client --listen 0.0.0.0 --peer-side left # the other one, at 192.168.1.20
-
Grant device access (see Security for what this means):
sudo ./setup-udev.sh server # read keyboards, mice and touchpads, and create virtual devices sudo ./setup-udev.sh client # create virtual devices only
-
Pair. Run
lankvm pairon one machine; it prints the command to run on the other. Both screens then show a six-digit code: if they match, answeryon both, and lankvm starts.lankvm pair # on one machine lankvm pair 192.168.1.20 # on the other, with the first one's address
-
Load the extension. GNOME only notices a new extension when the shell starts: log out and back in (Wayland), or press Alt+F2, type
r, Enter (X11). The installer has already enabled it. -
Stop any other sharing tool (Deskflow, Input Leap, Synergy) between the same two machines, or both will react to the same screen edge.
- Push the pointer off the shared edge to cross. It arrives at the same relative height on the other screen.
- Scroll Lock switches by hand, either way.
- Copy and paste works both ways for text and images: a screenshot, or Copy Image in a browser.
- It will not switch while a key or button is held on the server, so you can still drag a window to the edge to tile it. Let go, move away from the edge and push again.
~/.config/lankvm/config.toml, written by install.sh:
| key | default | meaning |
|---|---|---|
role |
(required) | server (keyboard and mouse plugged in here) or client |
connect / listen |
(one required) | HOST[:PORT] to dial, or ADDR[:PORT] to listen on |
peer_side |
(required) | left, right, top or bottom: where the other machine is |
port |
24810 |
used when connect or listen has none. Pairing uses the next port up. |
hotkey |
KEY_SCROLLLOCK |
manual switch key (server). Also KEY_PAUSE, KEY_SYSRQ, KEY_RIGHTCTRL, KEY_COMPOSE, KEY_F13 to KEY_F15, or a numeric key code |
clipboard |
true |
share copied text and images |
exclude |
["System Control"] |
regexes of device names never forwarded. The default keeps a keyboard's sleep and power keys local. |
The server forwards keyboards, mice, touchpads and media keys. It never forwards touchscreens, pen tablets or the lid and power buttons.
Read this before installing.
- On the server, the udev rule lets any program running as you read the keyboard. That is what lankvm needs, and also what a keylogger needs. Every X11 session already works this way; on Wayland it removes a protection you had. The access lasts only while you are logged in at the machine, and the client is never given it.
- Every keystroke crosses the network, passwords included. The link is TLS 1.3 and each side accepts only the certificate it was paired with, so another machine on the network can neither read the traffic nor connect.
- Pairing is protected by the code. A machine in the middle would have to
choose its numbers before it could know the code, so its chance of making
both screens agree is one in a million. Only answer
yif the codes match. - To withdraw everything:
sudo rm /etc/udev/rules.d/70-lankvm.rules.
- Losing the link gives the input back. If the client stops answering for 4 seconds, or the connection drops, the server releases the keyboard and mouse.
- A crashed or hung daemon cannot keep them. The kernel releases a grab when the process exits, and a watchdog exits the daemon if it stalls for 3 seconds while holding one. systemd then restarts it.
- Nothing stays held down. When input leaves the client, every key, button and touch still down there is released.
- The server's own touchscreen is never grabbed, so it always works.
- GNOME 46 to 51 for edges and clipboard. The extension lists the versions it is tested on, so GNOME switches it off on any other rather than let it misbehave. A new GNOME release needs a lankvm update that adds it.
- The clipboard carries text and images, up to 32 MB. Not files, and not the middle-click selection. Images cross as PNG, which nearly every app pastes. When something offers both text and a picture, as a range of spreadsheet cells does, the text crosses.
- Both machines need the same version. The link refuses a peer that speaks a different protocol and the log says so.
- Crossing with a touchpad: lift your finger and touch again on the far side.
- Two machines. No Windows or macOS.
- Deskflow, Input Leap, Synergy run on Windows, macOS and Linux, which lankvm does not. On GNOME Wayland they go through the portal described above.
- Barrier, the project Input Leap continues, is X11 only.
- lan-mouse is a modern Wayland-first tool. On GNOME it also uses the InputCapture portal.
- rkvm works at the kernel level like lankvm. You switch machines with a hotkey, and it does not share the clipboard.
journalctl --user-unit lankvm -f # what the daemon is doing
lankvm devices # what it can see, and which devices it would forward
gnome-extensions info lankvm@localhost # whether the shell has loaded the extension
journalctl -b | grep -i lankvm # extension errors land in the shell's log- The pointer does not cross at the edge, but Scroll Lock works: the
extension is not running. If
gnome-extensions infosaysEnabled: No, GNOME's switch for all user extensions may be off:gsettings set org.gnome.shell disable-user-extensions false. The daemon logsGNOME Shell extension connectedonce it is running. - A pointer already resting on the edge does not cross. Move it away and push again. Only arriving at the edge counts.
no readable keyboard or mouse:setup-udev.sh serverhas not run on that machine.
systemctl --user disable --now lankvm
gnome-extensions disable lankvm@localhost
rm -r ~/.local/lib/lankvm ~/.local/bin/lankvm ~/.config/systemd/user/lankvm.service \
~/.local/share/gnome-shell/extensions/lankvm@localhost ~/.config/lankvm
sudo rm /etc/udev/rules.d/70-lankvm.rulespython3 tests/test_pairing.py # pairing, including a machine in the middle
python3 tests/test_loopback.py # the daemon end to end over TLS, with a fake device (needs /dev/uinput)
python3 tests/extension_smoke.py # the extension in a throwaway headless GNOME Shell
tests/gnome-versions.sh 41 42 43 44 45 # the same on GNOME 47 to 51, in Fedora containers (needs Docker)All of them run on every push. The end-to-end test's fake device is a joystick on purpose: desktops ignore joysticks, so what it injects cannot type or click into whatever window has focus.
MIT. See LICENSE.