#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

#225 in GUI

Download history 453/week @ 2024-08-18 393/week @ 2024-08-25 1467/week @ 2024-09-01 3970/week @ 2024-09-08 743/week @ 2024-09-15 582/week @ 2024-09-22 655/week @ 2024-09-29 1070/week @ 2024-10-06 395/week @ 2024-10-13 952/week @ 2024-10-20 1624/week @ 2024-10-27 971/week @ 2024-11-03 316/week @ 2024-11-10 1342/week @ 2024-11-17 1589/week @ 2024-11-24 269/week @ 2024-12-01

3,570 downloads per month
Used in 3 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