pub struct Window { /* private fields */ }Expand description
A type representing windows managed by the window manager.
An instance is only obtainable through wmctrl::get_windows()
Note: Since wmctrl fails silently there is no warranty that the actions performed on the window will be successful.
This is a flaw in the command line tool itself and not of this crate.
Implementations§
Source§impl Window
impl Window
Sourcepub fn set_title(&mut self, title: &str)
pub fn set_title(&mut self, title: &str)
Set the title of the window
This method is the equivalent of wmctrl -r <WIN> -N <STR>.
Sourcepub fn set_icon_title(&self, title: &str)
pub fn set_icon_title(&self, title: &str)
Set the icon title (short title) of the window
This method is the equivalent of wmctrl -r <WIN> -I <STR>.
Sourcepub fn set_both_title(&mut self, title: &str)
pub fn set_both_title(&mut self, title: &str)
Set both the title and icon title of the window
This method is the equivalent of wmctrl -r <WIN> -T <STR>.
Sourcepub fn change_state(&self, state: State)
pub fn change_state(&self, state: State)
Change the state of the window
Using this method it’s possible for example to make the window maximized, minimized, or fullscreen.
This method is the equivalent of wmctrl -r <WIN> -b <STARG>.
§Examples
let windows = wmctrl::get_windows();
let win = &windows[0];
// Make the window fullscreen
win.change_state(wmctrl::State::new(wmctrl::Action::Add, wmctrl::Property::Fullscreen));Sourcepub fn transform(&mut self, transformation: Transformation)
pub fn transform(&mut self, transformation: Transformation)
Resize and move the window around the desktop
This method is the equivalent of wmctrl -r <WIN> -e <MVARG>.
§Examples
let mut windows = wmctrl::get_windows();
let win = &mut windows[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));Sourcepub fn set_desktop(&mut self, desktop: &str)
pub fn set_desktop(&mut self, desktop: &str)
Move the window to the specified desktop
This method is the equivalent of wmctrl -r <WIN> -t <DESK>.
Sourcepub fn activate(&mut self)
pub fn activate(&mut self)
Move the window to the current desktop and raise it
This method is the equivalent of wmctrl -R <WIN>.
Sourcepub fn raise(&self)
pub fn raise(&self)
Activate the window by switching to its desktop and raising it
This method is the equivalent of wmctrl -a <WIN>.