| Crates.io | wrtype |
| lib.rs | wrtype |
| version | 0.1.0 |
| created_at | 2025-07-12 17:07:34.865844+00 |
| updated_at | 2025-07-12 17:07:34.865844+00 |
| description | A Rust implementation of wtype - a Wayland virtual keyboard tool that types text and sends key events |
| homepage | https://github.com/conneroisu/wrtype |
| repository | https://github.com/conneroisu/wrtype |
| max_upload_size | |
| id | 1749515 |
| size | 229,371 |
A Rust implementation of wtype - xdotool type for Wayland.
# Type unicode characters
wrtype ∇⋅∇ψ = ρ
# Press Ctrl+C
wrtype -M ctrl c -m ctrl
# Delay between keystrokes
wrtype foo -d 120 bar
# Read from stdin with delay
echo "everything" | wrtype --stdin -d 12
# Press and release the Left key
wrtype -P left -p left
# Hold the Right key for 1000ms
wrtype -P right -s 1000 -p right
nix develop
cargo build --release
Ensure you have the following system dependencies:
cargo build --release
-M <MOD>: Press modifier (shift, capslock, ctrl, logo, win, alt, altgr)-m <MOD>: Release modifier-P <KEY>: Press key-p <KEY>: Release key-k <KEY>: Type (press and release) key-d <TIME>: Sleep for TIME milliseconds between keystrokes-s <TIME>: Sleep for TIME milliseconds before interpreting following options--stdin: Read text from stdinThe implementation consists of several modules:
wrtype can be used as a Rust library for programmatic text input and automation:
use wrtype::{WrtypeClient, Modifier};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = WrtypeClient::new()?;
// Type text
client.type_text("Hello, Wayland!")?;
// Send keyboard shortcuts
client.send_shortcut(&[Modifier::Ctrl], "c")?;
Ok(())
}
Add to your Cargo.toml:
[dependencies]
wrtype = { git = "https://github.com/conneroisu/wrtype" }
The examples/ directory contains comprehensive examples showing different use cases:
# Run the interactive example runner
./run-examples.sh all
# Or run specific examples
./run-examples.sh basic # Basic text typing
./run-examples.sh shortcuts # Keyboard shortcuts
./run-examples.sh stdin # Stdin processing
./run-examples.sh advanced # Complex sequences
# Quick start guide
just quick-start
# Run specific examples
just example-basic
just example-shortcuts
just examples-all
# Development commands
just build
just test
just dev
basic_typing.rs) - Simple text input with Unicode supportshortcuts.rs) - Common keyboard shortcuts and combinationsstdin_processing.rs) - Reading and processing piped inputadvanced_sequences.rs) - Complex automation workflowsRun any example with:
cargo run --example basic_typing
# or using nix
nix develop -c cargo run --example basic_typing
wrtype is compatible with the original C implementation of wtype and supports the same command-line interface and functionality.