#position #mouse #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

#209 in GUI

Download history 315/week @ 2024-07-10 236/week @ 2024-07-17 249/week @ 2024-07-24 355/week @ 2024-07-31 2007/week @ 2024-08-07 2182/week @ 2024-08-14 278/week @ 2024-08-21 446/week @ 2024-08-28 4389/week @ 2024-09-04 1266/week @ 2024-09-11 645/week @ 2024-09-18 550/week @ 2024-09-25 694/week @ 2024-10-02 981/week @ 2024-10-09 410/week @ 2024-10-16 2059/week @ 2024-10-23

4,214 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