window_titles
is a small crossplatform utility crate with the only job of getting the titles of windows.
It supports:
- Linux / x11:
Using
xcb
to query the x11 server. (Safe) - Windows:
Using
winapi
. (Possibly Unsafe) - MacOS:
Using the
osascript
command. (Safe)
Usage is simple:
- Import both
Connection
andConnectionTrait
.
use window_titles::{Connection, ConnectionTrait};
- Initiate the connection (Only Linux can return an error for this method).
let connection = Connection::new()?;
- Get the window titles.
let titles: Vec<String> = connection.window_titles()?;