Crates.io | kwin-mouse-loc |
lib.rs | kwin-mouse-loc |
version | |
source | src |
created_at | 2024-08-29 11:35:50.334635 |
updated_at | 2024-10-17 03:50:57.489294 |
description | A very simple mouse controller that uses `libc::process_vm_readv` to read mouse location. Need root permissions. |
homepage | |
repository | https://github.com/Neutron3529/kwin-mouse-loc/ |
max_upload_size | |
id | 1355993 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A very simple mouse controller that uses libc::process_vm_readv
to read mouse location. Need root permissions.
Since mouse and keyboard operations is very dangerous, it might be easily be poisoned. And since there is no guarateen that crate owner is not evil, I wrote this simple crate.
The main aim of this crate is that, make user ensure they use a SAFE crate that cannot be poisoned.
The BEST practice of using this crate should be just copy the build.rs
and lib.rs
into your project.
If you like this crate, you could make it as an optional dependencies, BUT please keep one thing in mind:
DO NOT ENABLE THE DEPENDENCIES OF THIS CRATE
use kwin_mouse_loc::pointer::Workspace;
fn main(){
let mouse = unsafe{Workspace::new().get_mouse()};
let (x,y) = mouse.loc();
println!("mouse is located at ({x}, {y})");
// do some other things.
std::thread::sleep(std::time::Duration::from_millis(300));
// obtain mouse location again, with display.
println!("mouse is located at {mouse}");
}