Control mouse and keyboard from a smartphone
Find a file
Twilight0 f2f3cbceed X11: reduce typing delay for non-Latin characters (Greek, etc.)
Previously, typing non-Latin characters (e.g. Greek) via the X11 backend
was extremely slow (~1000ms per character) because the server had to
dynamically remap an unused keycode to the desired keysym via
XChangeKeyboardMapping. A blind 500ms sleep was used twice per character:
once before sending the key event (to wait for the mapping to propagate),
and once after (to wait for clients to process MappingNotify).

The root cause is that X11 key events only carry keycodes, not keysyms.
When a keysym has no existing keycode in the keyboard mapping, the app
must temporarily remap a keycode. Clients cache the keyboard mapping
locally and re-read it upon receiving a MappingNotify event from the
server. The race condition is that a client may process the key event
before it has processed the MappingNotify, interpreting the keycode with
the stale (old) mapping.

This patch replaces the blind pre-send sleep with a server-side
verification loop: after XChangeKeyboardMapping, it polls
XGetKeyboardMapping to confirm the server has applied the new mapping
before sending the key event. This is safe because XGetKeyboardMapping
reads directly from the server, which is the authority on the current
mapping. The post-send delay is reduced from 500ms to 50ms, which is
sufficient for clients to process MappingNotify on modern systems.

Expected improvement: non-Latin characters go from ~1000ms/char to
~55-60ms/char (verification ~5ms + post-send 50ms). Latin characters
remain instant as they already have existing keycode mappings.

The 500ms constant was overly conservative. The verification loop
provides a correct and responsive solution: it returns as soon as the
server confirms the mapping, and times out after 200ms as a safety net.

Fixes #46
2026-07-20 17:39:39 +03:00
.github/workflows CI: Install missing package 2025-03-17 20:24:25 +01:00
desktop Bump version to 1.5.3 2025-12-24 22:59:32 +01:00
flatpak Update dependencies 2025-12-24 22:57:01 +01:00
icon-font Reorganize 2022-06-20 03:48:43 +02:00
inputcontrol X11: reduce typing delay for non-Latin characters (Greek, etc.) 2026-07-20 17:39:39 +03:00
screenshots Update screenshots 2022-01-29 11:04:22 +01:00
snap Snap: Specifiy supported platforms 2026-07-11 20:59:03 +02:00
terminal Reorganize 2022-06-20 03:48:43 +02:00
webdata Workaround for virtual keyboard covering buttons for Safari on iOS 2024-01-31 09:33:11 +01:00
CHANGELOG.md Bump version to 1.5.3 2025-12-24 22:59:32 +01:00
COPYING import project 2018-06-23 17:40:58 +02:00
go.mod Update dependencies 2025-12-24 22:57:01 +01:00
go.sum Update dependencies 2025-12-24 22:57:01 +01:00
host.go Reorganize 2022-06-20 03:48:43 +02:00
icon_windows.go Use tags for go generate 2020-08-26 03:31:59 +02:00
icon_windows.syso New logo 2021-06-06 00:46:14 +02:00
main.go Bump version to 1.5.3 2025-12-24 22:59:32 +01:00
README.md Add support for session restore on the linux portals backend, fixing #77 2025-03-17 00:19:48 +01:00
webdata.go Set MIME types explicitly 2024-02-06 11:26:34 +01:00
webdata_test.go Set MIME types explicitly 2024-02-06 11:26:34 +01:00

Remote Touchpad

Control mouse and keyboard from the webbrowser of a smartphone (or any other device with a touchscreen). To take control open the displayed URL or scan the QR code.

Supports Flatpak's RemoteDesktop portal (for Wayland), Windows and X11.

Installation

  • Flatpak
  • Snap
  • Windows
  • Golang:
    • Portal & uinput & X11:

      go install -tags portal,uinput,x11 github.com/unrud/remote-touchpad@latest
      
    • Windows:

      go install github.com/unrud/remote-touchpad@latest
      

Screenshots

screenshot 1

screenshot 2

screenshot 3

screenshot 4