#mouse #wayland #kde #k-win

kwin-mouse-loc

A very simple mouse controller that uses libc::process_vm_readv to read mouse location. Need root permissions.

5 releases

0.0.1-pre-0… Oct 17, 2024
0.0.1-pre-0.0.1 Oct 16, 2024
0.0.0-pre-0.0.3-fix Aug 31, 2024
0.0.0-pre-0.0.4 Sep 30, 2024

#270 in Hardware support

Download history 319/week @ 2024-08-27 28/week @ 2024-09-03 7/week @ 2024-09-10 4/week @ 2024-09-17 59/week @ 2024-09-24 67/week @ 2024-10-01 8/week @ 2024-10-08 509/week @ 2024-10-15 12/week @ 2024-10-22 4/week @ 2024-11-05

529 downloads per month

GPL-3.0-or-later

39KB
746 lines

kwin-mouse-loc

A very simple mouse controller that uses libc::process_vm_readv to read mouse location. Need root permissions.

Usage

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

Example

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}");
}

Dependencies

~5.5–7.5MB
~137K SLoC