| Crates.io | pc-remote |
| lib.rs | pc-remote |
| version | 0.1.0 |
| created_at | 2025-09-20 19:08:22.015313+00 |
| updated_at | 2025-09-20 19:08:22.015313+00 |
| description | This library provides cross-platform control over computer input devices |
| homepage | |
| repository | https://github.com/fuderis/rs-pc-remote |
| max_upload_size | |
| id | 1848132 |
| size | 785,354 |
This library provides cross-platform control over computer input devices. It allows emulating keyboard and mouse inputs programmatically and managing audio devices.
The library is designed for seamless integration into Rust projects, providing ergonomic APIs for all supported functionalities.
Please ensure the utility binaries (nircmd.exe, SoundVolumeView.exe, svcl.exe) are present in your binary path for audio control.
For audio device management, this library relies on several lightweight Windows utilities:
These tools are efficient and minimal, allowing fast interactions with Windows audio system without complex API integrations. You can download these utilities bundled together here: https://github.com/fuderis/rs-pc-remote/raw/main/bin
use pc_remote::{ Result, Keyboard, Key };
fn main() -> Result<()> {
let mut keyboard = Keyboard::new()?;
let hotkey = [Key::Shift, Key::A];
keyboard.press(&hotkey)?;
keyboard.release(&hotkey)?;
Ok(())
}
use pc_remote::{ Result, Mouse };
fn main() -> Result<()> {
let mut mouse = Mouse::new()?;
mouse.move_to_center()?;
Ok(())
}
use pc_remote::{ Result, Media };
use macron::path;
fn main() -> Result<()> {
let media = Media::new(path!("bin/nirsoft"))?;
/* binary repository example:
/bin
/nirsoft
/nircmd/nircmd.exe
/svcl/svcl.exe
/svv/SoundVolumeView.exe
*/
let audio_device = media.active_audio().expect("no audio device found");
let micro_device = media.active_micro().expect("no micro device found");
println!("Audio device: '{}', Microphone: '{}'", &audio_device.name, µ_device.name);
println!("Audio volume: {}%", audio_device.get_volume()?);
audio_device.set_volume(10)?;
println!("Audio volume: {}%", audio_device.get_volume()?);
Ok(())
}
This library distributed under the MIT license.
You can contact me via GitHub or send a message to my telegram @fuderis. This library is actively evolving, and your suggestions and feedback are always welcome!