Repository navigation
Autocomplete on KDE Plasma through KWin's input method - #462
Merged
Merged
Conversation
KWin talks zwp_input_method_v1 only to a program it starts itself, the one chosen under System Settings → Keyboard → Virtual Keyboard, and starts it again only if it crashes. So `lokalbot --kwin-input-method` holds that connection for the session and passes the field to the app over a socket in LokalBot's private runtime folder; the app runs the shared Core as on the other routes. Quitting and reopening LokalBot leaves the input method in place, and with the app closed the helper takes no keys and shows nothing. - New route (kwin.rs), helper (kwin_helper.rs) and their messages (kwin_wire.rs). The keyboard is grabbed only while a suggestion shows. - KWin names the window in front through the existing KWin script probe, so excluded apps are refused before their text is used. - A desktop entry lists LokalBot under Virtual Keyboard; packages, install.sh and the AUR package install it, and Settings shows a command otherwise. - Settings strings in all 24 languages; PRIVACY.md and the port README. - Live test under headless KWin, typing through KWin's EIS endpoint (scripts/live-kwin.sh).
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
lokalbot | 24088a5 | Commit Preview URL Branch Preview URL |
Nov 09 2026, 04:49 AM |
stevyhacker
marked this pull request as ready for review
November 9, 2026 04:51
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.
Summary
Autocomplete in other apps now works on KDE Plasma (Wayland), the one major Linux desktop where it only worked in the practice editor.
KWin talks
zwp_input_method_v1only to the program it starts itself, the one chosen under System Settings → Keyboard → Virtual Keyboard, and starts it again only when it crashes. So a small helper,lokalbot --kwin-input-method, holds that connection for the whole session and passes the field to the app over a socket in LokalBot's private runtime folder (owner-only, peer uid checked). The app runs the sharedCoreas the Sway and GNOME routes do. Quitting and reopening LokalBot leaves the input method in place; with the app closed the helper takes no keys, shows nothing and holds no text.input_method/kwin_helper.rs: the helper. Grabs the keyboard only while a suggestion shows; every key but the accept keys and Esc goes straight back to KWin.input_method/kwin.rs: the app's route, Settings steps, and the desktop entry.input_method/kwin_wire.rs: the line-based JSON messages, with a version handshake (after an update, Settings asks for one log-out until Plasma starts the new helper).FrontWindows::connect), so excluded apps are refused before their text is used.com.lokalbot.LokalBot.InputMethod.desktop(X-KDE-Wayland-VirtualKeyboard=true,NoDisplay=true) is installed by the.deb/.rpm/Arch packages,install.shand the AUR PKGBUILD. A copy run from the extracted folder gets a one-line command in Settings (lokalbot --kwin-input-method-entry).Design details that came from KWin 6.8 itself rather than its docs: a move to another field or window arrives as deactivate + activate,
resetcomes after enable, and the content type is re-sent on most GTK 3 keystrokes, so only activate, deactivate and reset mark a new field. With no keyboard grab KWin commits the preedit'scommittext on the next key, so the suggestion's commit text is always empty.Validation
On the Ubuntu box (Linux CI's commands, final code):
10 new unit tests (wire framing and limits, content-type mapping, socket replacement and permissions, peer check, desktop entry and its quoting, packaged entry matches the generated one).
Live, under headless KWin 6.8.2 (Arch, Plasma 6) with keys typed through KWin's EIS endpoint (
crates/lokalbot-platform/scripts/live-kwin.sh, new ignored testkwin_input_method_shows_accepts_and_stays_out_of_passwords), passing:The live test passed 3 of 3 runs with KWin starting the real app binary (
lokalbot --kwin-input-method) as its input method, and also with the helper example.Probes with a stand-in app driving the helper: GTK 4, Qt 6 and Qt 5 each show the suggestion, take Tab and commit it.
install.shinstalls the entry with the absoluteExecand--uninstallremoves it.Not run: Firefox and Chrome on KDE (Firefox's content sandbox won't start in the test container), a real Plasma desktop with a real model, Plasma 5. The Sway live test wasn't rerun;
wlroots.rsonly had items made visible to the new route.Changed test expectations
None.
Risk / rollout notes
lokalbot --kwin-input-methodfor the session once the user picks LokalBot under Virtual Keyboard. It exits only when KWin closes the connection; a crash makes KWin restart it (KWin gives up after 5 in 20 s).llms.txt, the privacy page, the Wayland autocomplete explainer) still says KDE isn't supported. Update it when the release ships, not before.