| Crates.io | wintrack |
| lib.rs | wintrack |
| version | 1.0.1 |
| created_at | 2025-07-12 17:40:03.268318+00 |
| updated_at | 2025-07-12 17:59:49.036313+00 |
| description | Library for monitoring window related events on Windows. |
| homepage | https://github.com/dinoslice/wintrack-rs |
| repository | https://github.com/dinoslice/wintrack-rs |
| max_upload_size | |
| id | 1749532 |
| size | 65,590 |
A library for monitoring window related events on Windows.
View API reference on docs.rs, and the crate page on crates.io.
Using a channel to receive messages:
use std::sync::mpsc;
use wintrack::WindowEventKind;
wintrack::try_hook().expect("hook should not be set yet");
let (tx, rx) = mpsc::channel();
wintrack::set_callback(Box::new(move |event| {
let snapshot_exe = event.snapshot.executable.file_name();
let is_firefox = snapshot_exe == Some(OsStr::new("firefox.exe"));
// only monitor name change events from Firefox
// (this checks when the tab changes)
if is_firefox && event.kind == WindowEventKind::WindowNameChanged {
// send the event to the main thread
let res = tx.send(event.snapshot);
if let Err(err) = res {
// ...
}
}
}));
while let Ok(browser_snapshot) = rx.recv() {
println!("Your active Firefox tab changed to {}.", browser_snapshot.title);
}