Skip to main content

Crate eitype

Crate eitype 

Source
Expand description

eitype - A library for typing text using Emulated Input (EI) on Wayland

This library provides a simple interface to connect to an EI server and emulate keyboard input. It supports both portal-based connections (with user authorization) and direct socket connections.

§Example

use eitype::{EiType, EiTypeConfig};

// Connect via portal (will prompt for authorization on first use)
let mut typer = EiType::connect_portal(EiTypeConfig::default()).unwrap();

// Type some text
typer.type_text("Hello, world!").unwrap();

// Press special keys
typer.press_key("Return").unwrap();

§Thread safety

EiType is Send and Sync: it is safe to create it on one thread and use it from another (for example, a worker in a thread pool). Access to the underlying xkbcommon objects is serialized with an internal lock, so sharing an instance across threads is memory-safe and works the same on GIL-enabled and free-threaded interpreters.

Note that the keystroke stream is not transactional: if two threads type on the same instance simultaneously their key events will interleave. Serialize at a higher level if you need coherent output.

Structs§

EiType
Main interface for typing text via EI protocol.
EiTypeConfig
Configuration for keyboard layout and typing behavior

Enums§

Action
Actions that can be performed
EiTypeError
Errors that can occur when using eitype