active-win-pos-rs
A small Rust library that lets you get position, size, title and a few other properties of the active window on Windows, MacOS and Linux
Usage
Add to Cargo.toml:
[]
= "0.6"
Use:
use get_active_window;
Would give you an instance of ActiveWindow struct with unique window id, process id, window position and window title.
Or use active_win_pos_rs::get_position to get the WindowPosition only.
Window title on MacOS
On MacOS title property will always return an empty string
unless you Enable Screen Recording permission for your app.
Build
Example
Output:
active window: ActiveWindow {
title: "Command Prompt - cargo run --example active-window",
window_id: "0x70af2",
process_id: 22908,
position: WindowPosition {
x: 1414.0,
y: 135.0,
width: 993.0,
height: 519.0,
},
}