wmctrl 0.1.3

A wrapper for the command line tool wmctrl written in Rust
Documentation

Wmctrl Wrapper

A wrapper for the command line tool wmctrl written in Rust

Usage

Add wmctrl to your dependencies in your Cargo.toml:

[dependencies]
wmctrl = "0.1.3"

If you want the latest build use this GitHub repository as your uplink:

[dependencies]
wmctrl = { git = "https://github.com/Treborium/rust-wmctrl" }

Examples

Please refer to the documentation for detailed information.

If you want to copy & paste the examples below you need to use the following import statement:

use wmctrl::{Self, Window};

Find a window based on the title:

let windows = wmctrl::get_windows();
let firefox = wmctrl::utils::find_window_by_title(&windows, "Firefox")?;
println!("{}", firefox);

Resize and move a window to the specified coordinates:

let win = wmctrl::get_windows().get(0)?;
// This will move the window to the top left corner and resize it to 960x540
win.transform(wmctrl::Transformation::new(0, 0, 960, 540));

Close the window gracefully:

// We need to move the window out of the vector so there is no reference left
let win: Window = wmctrl::get_windows().remove(0);
win.close();

Make the window fullscreen:

let win = wmctrl::get_windows().get(0)?;
// Make the window fullscreen
win.change_state(wmctrl::State::new(wmctrl::Action::Add, wmctrl::Property::Fullscreen));