Repository navigation
Stop long multilingual typing from dropping characters on the remote desktop - #563
Merged
pallaoro merged 1 commit intoNov 9, 2026
Merged
Conversation
xdotool binds every character missing from the keymap to one scratch keycode and clears it 3 ms after the key press. An app that looks the key up later reads an empty or a newer binding, so long multilingual text lost characters (up to 137 of 1237 in a 4000-character call). Before typing, desktop-control now binds each such character to an empty keycode of its own with one xmodmap call, so xdotool finds it in the keymap and never rebinds. Bindings stay until a later character needs the keycode and are released when the service stops. Text with more distinct characters than free keycodes (17 on Xvfb) is typed in runs, reusing the keycode pressed longest ago after a 100 ms pause. The browser installer now installs x11-xserver-utils for xmodmap. Without it, typing falls back to xdotool's own rebinding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
computer→typelost non-ASCII characters in long text. Typing 4000 characters (1237 non-ASCII) into Mousepad on a 1-vCPU Ubuntu 24.04 box lost between 3 and 137 of them per call on main, while every ASCII character arrived. Some characters also came out duplicated ("日本語語").Cause
In
xdo.c(xdo_send_keysequence_window_list_do, the same in Ubuntu 24.04's 3.20160805.1 and upstream master), xdotool binds every character missing from the keymap to one scratch keycode, sends the key press, and clears the keycode 3 ms later. The next character rebinds the same keycode. Applications look the keycode up when they process the key, against the server's keymap at that moment. An app more than about 3 ms behind reads an empty binding (dropped character) or the next character's binding (wrong or duplicated character).Fix
typebinds each non-ASCII character missing from the keymap to an empty keycode of its own, in onexmodmapcall. xdotool finds them in the keymap and never rebinds.install-browser.shnow installsx11-xserver-utilsforxmodmap. Without it, typing behaves as before and the service logs one line.linux-smoke.mjsalso asserts that each non-ASCII character had its own keycode, because short text can survive the old race by luck.Verification
Unit tests for keymap parsing and run planning in
test/x11.test.ts. Typecheck and lint pass.Live, on a throwaway 1-vCPU / 4 GB Ubuntu 24.04 VM (Xvfb :99 1280x720x24, Openbox, Mousepad), typing 4000 characters in one MCP call and comparing the saved file:
linux-smoke.mjspasses on the final build. After the service stopped, all of Xvfb's 19 empty keycodes were empty again.Tradeoff
Long text with more distinct missing characters than free keycodes is slower: about 66 s for the Russian text and 92 s for the Chinese text with the CPU busy, against about 30 s before, when it was lossy. Without the pause, the same texts took 33 to 38 s and were still exact, so the 100 ms is margin. Binding a second keysym per keycode on the Shift level would roughly halve the reuses, if this matters.
Rollout
A box gets the fix when its
ateam-novncservice restarts on the newdesktop.js. A box withoutxmodmapalso needs the browser installer rerun.