Skip to content

Add virtual keyboard protocol gated by security context#47

Merged
malbiruk merged 1 commit intomalbiruk:mainfrom
nico4348:feat/virtual-keyboard
Apr 19, 2026
Merged

Add virtual keyboard protocol gated by security context#47
malbiruk merged 1 commit intomalbiruk:mainfrom
nico4348:feat/virtual-keyboard

Conversation

@nico4348
Copy link
Copy Markdown
Contributor

Changes

Adds zwp-virtual-keyboard-v1 so Wayland-native clients can synthesize key events. Gated behind wp-security-context-v1 following the niri pattern — clients connecting through a security context listener are marked restricted: true in ClientState and the filter denies them access to virtual keyboard.

  • src/state/mod.rs: new restricted field in ClientState; SecurityContextState and VirtualKeyboardManagerState initialized with a shared client_is_unrestricted filter.
  • src/handlers/mod.rs: SecurityContextHandler impl 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 wtype and on-screen keyboards without the ydotool//dev/uinput workaround. Required for clipboard auto-paste workflows and accessibility input methods.

Testing

  • cargo build / cargo clippy -D warnings / cargo test all clean.
  • Manual: with the patched compositor running, wtype "hola mundo" injects the string into the focused terminal. Without the patch, wtype fails with "Compositor does not support the virtual keyboard protocol".

Notes

Clients without a ClientState (the compositor's own XWayland client, whose XWayland::spawn setup callback currently doesn't attach one) are treated as unrestricted. Happy to explicitly attach ClientState in the XWayland spawn path if you prefer — felt out of scope for this PR.

Closes #43

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
@malbiruk malbiruk merged commit e26eb81 into malbiruk:main Apr 19, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Virtual keyboard (zwp-virtual-keyboard-v1) — interest in a standalone PR?

2 participants