Add virtual keyboard protocol gated by security context#47
Merged
malbiruk merged 1 commit intomalbiruk:mainfrom Apr 19, 2026
Merged
Add virtual keyboard protocol gated by security context#47malbiruk merged 1 commit intomalbiruk:mainfrom
malbiruk merged 1 commit intomalbiruk:mainfrom
Conversation
Implements zwp-virtual-keyboard-v1 so Wayland-native tools like wtype can synthesize key events (useful for on-screen keyboards, clipboard managers doing auto-paste, accessibility tools). Following the niri pattern, clients connecting through a security context listener (wp-security-context-v1) are marked restricted and denied access to virtual keyboard. Clients without a ClientState (e.g. the compositor's own XWayland) are treated as unrestricted. Closes malbiruk#43
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.
Changes
Adds
zwp-virtual-keyboard-v1so Wayland-native clients can synthesize key events. Gated behindwp-security-context-v1following the niri pattern — clients connecting through a security context listener are markedrestricted: trueinClientStateand the filter denies them access to virtual keyboard.src/state/mod.rs: newrestrictedfield inClientState;SecurityContextStateandVirtualKeyboardManagerStateinitialized with a sharedclient_is_unrestrictedfilter.src/handlers/mod.rs:SecurityContextHandlerimpl that inserts restricted clients from the listener source; delegates added.docs/DESIGN.md: protocols listed under implemented; Milestone 17 marked done for virtual-keyboard.Purpose
Enables tools like
wtypeand on-screen keyboards without the ydotool//dev/uinputworkaround. Required for clipboard auto-paste workflows and accessibility input methods.Testing
cargo build/cargo clippy -D warnings/cargo testall clean.wtype "hola mundo"injects the string into the focused terminal. Without the patch,wtypefails with "Compositor does not support the virtual keyboard protocol".Notes
Clients without a
ClientState(the compositor's own XWayland client, whoseXWayland::spawnsetup callback currently doesn't attach one) are treated as unrestricted. Happy to explicitly attachClientStatein the XWayland spawn path if you prefer — felt out of scope for this PR.Closes #43