Expand description
Virtual keyboard typing via evdev/uinput with XKB layout-aware key mapping.
This crate provides:
Keyboard— a virtual uinput device that injects keystrokes.XkbKeymap— reverse char→keycode lookup from the active XKB layout.ClipboardBackend— trait + auto-detected clipboard implementations.
§Example (auto-detect layout and clipboard)
use xkb_type::{Keyboard, Key};
use std::time::Duration;
let mut kb = Keyboard::new(Duration::from_millis(2))?;
kb.type_text("Hello — こんにちは — €100 — 😀")?;
kb.backspace(5)?;
kb.send_combo(&[Key::KEY_LEFTCTRL, Key::KEY_C])?;§Example (explicit layout)
use xkb_type::Keyboard;
use std::time::Duration;
let mut kb = Keyboard::with_layout("de", None, Duration::from_millis(5))?;
kb.type_text("Schöne Grüße")?;Re-exports§
pub use clipboard::default_clipboard;pub use clipboard::NoopClipboard;pub use clipboard::WaylandClipboard;pub use clipboard::X11Clipboard;pub use keyboard::Keyboard;pub use keymap::KeyboardLayout;pub use keymap::XkbKeymap;pub use evdev;
Modules§
- clipboard
- Clipboard implementations — Wayland (wl-copy/wl-paste), X11 (arboard), and noop.
- keyboard
- Virtual keyboard via evdev/uinput.
- keymap
- XKB reverse lookup table: char → (Keycode, Modifiers).
Structs§
- Key
- Scancodes for key presses.
- KeyMapping
- Information needed to produce a character at the cursor.
- KeyTap
- A single keypress with optional Shift and/or AltGr modifiers.
Traits§
- Clipboard
Backend - Trait for clipboard get/set operations.
Functions§
- keyboard_
from_ detected_ layout - Convenience: build a
Keyboardfrom the detected layout with a sensible default key delay (5 ms).