#mouse #position #cross-platform

bin+lib mouse_position

Get the mouse position on Linux, Windows and MacOS

4 releases

0.1.4 May 31, 2024
0.1.3 Dec 15, 2022
0.1.1 Dec 15, 2022
0.1.0 Dec 15, 2022

#216 in GUI

Download history 239/week @ 2024-07-19 277/week @ 2024-07-26 412/week @ 2024-08-02 3643/week @ 2024-08-09 503/week @ 2024-08-16 421/week @ 2024-08-23 305/week @ 2024-08-30 4436/week @ 2024-09-06 1344/week @ 2024-09-13 597/week @ 2024-09-20 477/week @ 2024-09-27 730/week @ 2024-10-04 939/week @ 2024-10-11 695/week @ 2024-10-18 1915/week @ 2024-10-25 933/week @ 2024-11-01

4,554 downloads per month
Used in 2 crates

MIT license

7KB
97 lines

Mouse Position

A simple crate to get the mouse position in a cross platform way. It uses winapi crate to get the mouse position on windows, x11-dl for linux, and core-graphics for macos.

Example Usage:

use mouse_position::mouse_position::{Mouse};

fn main() {
    let position = Mouse::get_mouse_position();
    match position {
        Mouse::Position { x, y } => println!("x: {}, y: {}", x, y),
        Mouse::Error => println!("Error getting mouse position"),
   }
}

lib.rs:

A a simple crate to get the mouse position in a cross platform way. It uses winapi crate to get the mouse position on windows, x11-dl for linux, and core-graphics for macos. Example Usage:

use mouse_position::mouse_position::{Mouse};

fn main() {
    let position = Mouse::get_mouse_position();
    match position {
        Mouse::Position { x, y } => println!("x: {}, y: {}", x, y),
        Mouse::Error => println!("Error getting mouse position"),
   }
}

Dependencies

~0–385KB