{"id":36224595,"url":"https://github.com/lete114/raw-input","last_synced_at":"2026-01-11T05:04:30.572Z","repository":{"id":331252477,"uuid":"1125749278","full_name":"lete114/raw-input","owner":"lete114","description":"A cross-platform library for capturing and simulating global input events (keyboard and mouse). ","archived":false,"fork":false,"pushed_at":"2025-12-31T16:16:03.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-05T01:13:37.413Z","etag":null,"topics":["automation","display","grab","hardware-support","hooks","input","intercept","keyboard","linux","listen","macos","mouse","raw","simulate","testing","windows"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lete114.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-31T09:34:03.000Z","updated_at":"2025-12-31T16:16:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lete114/raw-input","commit_stats":null,"previous_names":["lete114/raw-input"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/lete114/raw-input","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lete114%2Fraw-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lete114%2Fraw-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lete114%2Fraw-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lete114%2Fraw-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lete114","download_url":"https://codeload.github.com/lete114/raw-input/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lete114%2Fraw-input/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28287198,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T04:44:51.577Z","status":"ssl_error","status_checked_at":"2026-01-11T04:44:44.232Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","display","grab","hardware-support","hooks","input","intercept","keyboard","linux","listen","macos","mouse","raw","simulate","testing","windows"],"created_at":"2026-01-11T05:04:29.845Z","updated_at":"2026-01-11T05:04:30.567Z","avatar_url":"https://github.com/lete114.png","language":"Rust","readme":"\n# raw-input\n\n**raw-input** is a lightweight, high-performance cross-platform Rust library designed to capture and simulate global input events (keyboard and mouse). It is ideal for building global hotkey managers, input monitors, automation scripts, and accessibility tools.\n\n\u003e **Acknowledgments:** This project is inspired by [Narsil/rdev](https://github.com/Narsil/rdev) (originally by [Narsil](https://github.com/Narsil)) and its fork by [rustdesk-org/rdev](https://github.com/rustdesk-org/rdev). Standing on the shoulders of giants, `raw-input` aims to provide modern features such as status-based subscription management, alongside a more flexible and ergonomic API design for a superior developer experience.\n\n## ✨ Features\n\n* **Global Event Listening**: Capture system-wide keyboard, mouse movement, clicks, and scroll events without requiring window focus.\n* **Subscription Management**: Each listener returns a `SubscriptionHandle` that allows you to **Pause**, **Resume**, or **Unsubscribe** at runtime.\n* **Input Interception (Grab)**: Intercept and optionally block specific input events from reaching other applications.\n* **Input Simulation**: Inject physical-level keyboard and mouse events, supporting both relative movement and absolute screen coordinates.\n* **Display Utilities**: Query monitor information, physical resolutions, and DPI scale factors.\n* **Thread-Safe**: Designed with `DashMap` and atomic operations for safe multi-threaded usage.\n\n## 🚀 Quick Start\n\nInstall this to your `Cargo.toml`:\n\n```bash\ncargo add raw-input\n```\n\n### Basic Example: Monitoring Global Input\n\n```rust\nuse std::thread;\nuse std::time::Duration;\n\nuse raw_input::{Core, Listen, Event};\n\nfn main() {\n    // 1. Start the core engine in a background thread \n    // (Crucial for processing Windows message loops)\n    thread::spawn(|| {\n        Core::start().expect(\"Failed to start raw-input core\");\n    });\n\n    // 2. Subscribe to global events\n    Listen::start();\n    let handle = Listen::subscribe(|event| {\n        match event {\n            Event::KeyDown { key } =\u003e println!(\"Key pressed: {:?}\", key),\n            Event::MouseMove { delta } =\u003e println!(\"Mouse moved by: {}, {}\", delta.x, delta.y),\n            _ =\u003e {},\n        }\n    });\n\n    // 3. Manage the subscription lifecycle\n    thread::sleep(Duration::from_secs(5));\n    handle.pause();    // Stop receiving events temporarily\n\n    thread::sleep(Duration::from_secs(2));\n    handle.resume();   // Start receiving events again\n\n    thread::sleep(Duration::from_secs(2));\n    handle.unsubscribe(); // Permanently remove the listener\n    Listen::stop(); // Stop Listen\n    Core::stop()\n}\n```\n\n## 🛠 Core Modules\n\n| Module | Description |\n| --- | --- |\n| **`Core`** | The underlying driver. Manages low-level hooks and the OS event loop. |\n| **`Listen`** | The primary interface for subscribing to global input events. |\n| **`Simulate`** | Provides tools to programmatically synthesize keyboard and mouse input. |\n| **`Grab`** | Allows exclusive access to inputs by blocking them for other applications. |\n| **`Display`** | Utilities for monitor enumeration and coordinate mapping. |\n\n## 📦 Optional Features\n\n* `serialize`: Enables `serde` support (Serialize/Deserialize) for event structures like `Event`, `Key`, and `Point`.\n\n## 🖥 Platform Support\n\n| OS | Status | Notes |\n| --- | --- | --- |\n| **Windows** | ✅ Supported | Implemented via `SetWindowsHookEx` and `Raw Input` API. |\n| **macOS** | 🚧 Planned | Will be based on `CGEventTap`. |\n| **Linux** | 🚧 Planned | Will be based on `XRecord` or `evdev`. |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flete114%2Fraw-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flete114%2Fraw-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flete114%2Fraw-input/lists"}