[][src]Struct wmctrl::Window

pub struct Window { /* fields omitted */ }

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.

Methods

impl Window[src]

pub fn set_title(&mut self, title: &str)[src]

Set the title of the window

This method is the equivalent of wmctrl -r <WIN> -N <STR>.

pub fn set_icon_title(&self, title: &str)[src]

Set the icon title (short title) of the window

This method is the equivalent of wmctrl -r <WIN> -I <STR>.

pub fn set_both_title(&mut self, title: &str)[src]

Set both the title and icon title of the window

This method is the equivalent of wmctrl -r <WIN> -T <STR>.

pub fn change_state(&self, state: State)[src]

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));

pub fn transform(&mut self, transformation: Transformation)[src]

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));

pub fn set_desktop(&mut self, desktop: &str)[src]

Move the window to the specified desktop

This method is the equivalent of wmctrl -r <WIN> -t <DESK>.

pub fn activate(&mut self)[src]

Move the window to the current desktop and raise it

This method is the equivalent of wmctrl -R <WIN>.

pub fn raise(&self)[src]

Activate the window by switching to its desktop and raising it

This method is the equivalent of wmctrl -a <WIN>.

pub fn close(self)[src]

Close the window gracefully

This method is the equivalent of wmctrl -c <WIN>.

Examples

use wmctrl::Window;

// 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();

pub fn title(&self) -> &String[src]

Get the title immutably

Trait Implementations

impl Debug for Window[src]

Auto Trait Implementations

impl RefUnwindSafe for Window

impl Send for Window

impl Sync for Window

impl Unpin for Window

impl UnwindSafe for Window

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.