pub struct WmCtl {
    pub atoms: AtomCollection,
    /* private fields */
}
Expand description

Window Manager control implements the EWMH protocol using x11rb to provide a simplified access layer to EWHM compatible window managers.

Fields

atoms: AtomCollection

Implementations

Create the window manager control instance and connect to the X11 server

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();

Get the default screen number

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.screen();

Get the root window

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.root();

Get the screen full width

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.width();

Get screen full height

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.height();

Get screen work width which is the full width minus any taskbars

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.work_width();

Get screen work height which is the full width minus any taskbars

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.work_height();

Get the active window id

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.active_win().unwrap();

Check if a composit manager is running

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.composite_manager().unwrap();

Get number of desktops

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.desktops().unwrap();

Maximize the window both horizontally and vertiacally

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.maximize_win(12345).unwrap();

Move and resize the given window

Arguments
  • win - id of the window to manipulate
  • gravity - gravity to use when resizing the window, defaults to NorthWest
  • x - x coordinate to use for the window during positioning
  • y - y coordinate to use for the window during positioning
  • w - width to resize the window to
  • h - height to resize the window to
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.move_resize_win(12345, None, Some(0), Some(0), Some(500), Some(500)).unwrap();

Send the event ensuring that a flush is called and that the message was precisely executed in the case of a resize/move.

Arguments
  • msg - the client message event to send
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let flags = MOVE_RESIZE_WINDOW_WIDTH | MOVE_RESIZE_WINDOW_HEIGHT;
wmctl.send_event(ClientMessageEvent::new(32, win, wmctl.atoms._NET_MOVERESIZE_WINDOW,
    [flags, 0, 0, 500, 500])).unwrap();

Determine if the given function is supported by the window manager

Arguments
  • atom - atom to lookup to see if its supported
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.supported(wmctl.atoms._NET_MOVERESIZE_WINDOW);

Remove the MaxVert and MaxHorz states

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.unmaximize_win(12345).unwrap();

Get windows optionally all

Arguments
  • all - default is to get all windows controlled by the window manager, when all is true get the super set of x11 windows
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.windows(false).unwrap();

Get window manager’s window id and name

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let (id, name) = wmctl.winmgr().unwrap();

Get desktop work area

Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let (w, h) = wmctl.workarea().unwrap();

Get window attribrtes

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let (class, state) = wmctl.win_attributes(12345).unwrap();

Get window class which ends up being the applications name

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let class = wmctl.win_class(12345).unwrap();

Get window desktop

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let desktop = wmctl.win_desktop(12345).unwrap();

Get window frame border values added by the window manager

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let (l, r, t, b) = wmctl.win_borders(12345).unwrap();

Get window geometry

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let (x, y, w, h) = wmctl.win_geometry(12345).unwrap();

Get window name

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let name = wmctl.win_name(12345).unwrap();

Get window parent

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let parent = wmctl.win_parent(12345).unwrap();

Get window pid

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let pid = wmctl.win_pid(12345).unwrap();

Get window state

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let state = wmctl.win_state(12345).unwrap();

Get window type

Arguments
  • win - id of the window to manipulate
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let type_ = wmctl.win_type(12345).unwrap();

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more