Window

Struct Window 

Source
pub struct Window {
    pub id: u32,
    /* private fields */
}
Expand description

Window provides a higer level interfacefor manipulating windows.

Fields§

§id: u32

Implementations§

Source§

impl Window

Source

pub fn pid(&self) -> WmCtlResult<i32>

Get window pid

§Examples
use libwmctl::prelude::*;
let win = window(12345);
let pid = win.pid().unwrap();
Source

pub fn name(&self) -> WmCtlResult<String>

Get window name

§Examples
use libwmctl::prelude::*;
let win = window(12345);
let name = win.name().unwrap();
Source

pub fn class(&self) -> WmCtlResult<String>

Get window class which is typically the the application’s name

§Examples
use libwmctl::prelude::*;
let win = window(12345);
let class = win.class().unwrap();
Source

pub fn kind(&self) -> WmCtlResult<Kind>

Get window kind

§Arguments
  • win - id of the window to manipulate
§Examples
use libwmctl::prelude::*;
let win = window(12345);
let kind = win.kind().unwrap();
Source

pub fn state(&self) -> WmCtlResult<Vec<State>>

Get window state

§Examples
use libwmctl::prelude::*;
let win = window(12345);
let state = win.state().unwrap();
Source

pub fn parent(&self) -> WmCtlResult<Window>

Get window parent

§Examples
use libwmctl::prelude::*;
let win = window(12345);
let parent = win.parent().unwrap();
Source

pub fn desktop(&self) -> WmCtlResult<i32>

Get window desktop

§Examples
use libwmctl::prelude::*;
let win = window(12345);
let desktop = win.desktop().unwrap();
Source

pub fn geometry(&self) -> WmCtlResult<(i32, i32, u32, u32)>

Get window geometry

§Examples
use libwmctl::prelude::*;
let win = window(12345);
let (x, y, w, h) = win.geometry().unwrap();
Source

pub fn visual_geometry(&self) -> WmCtlResult<(i32, i32, u32, u32)>

Get visual window geometry

§Examples
use libwmctl::prelude::*;
let win = window(12345);
let (x, y, w, h) = win.visual_geometry().unwrap();
Source

pub fn borders(&self) -> Border

Get window frame border values added by the window manager

§Examples
use libwmctl::prelude::*;
let win = window(12345);
let (l, r, t, b) = win.borders();
Source

pub fn is_gtk(&self) -> bool

Determine if this window is a GTK application

§Examples
use libwmctl::prelude::*;
let win = window(12345);
let result = win.is_gtk();
Source

pub fn gtk_borders(&self) -> Border

Get window GNOME border values added by GTK

§Examples
use libwmctl::prelude::*;
let win = window(12345);
let (l, r, t, b) = win.gtk_borders();
Source

pub fn mapped(&self) -> WmCtlResult<MapState>

Get window mapped state

  • doesn’t return a valid state if all windows are included rather than just the managed ones
§Examples
use libwmctl::prelude::*;
let win = window(12345);
let state = win.mapped().unwrap();
Source

pub fn properties(&self) -> WmCtlResult<Vec<Property>>

Get all window properties generically

§Examples
use libwmctl::prelude::*;
let win = window(12345);
win.properties().unwrap();
Source

pub fn map(&self) -> WmCtlResult<()>

Map the window to the screen

  • Windows are created in the unmapped state and must be mapped to be visible
  • Unmapping the window will have the opposite effect of hidding the window
  • Useful for new windows or dialogs that need to conditionally be visible
  • It is much faster to hide and show and window rather than recreate it
§Examples
use libwmctl::prelude::*;
let win = window(12345);
win.map().unwrap();
Source

pub fn maximize(&self) -> WmCtlResult<()>

Maximize the window both horizontally and vertically

§Examples
use libwmctl::prelude::*;
let win = window(12345);
win.maximize().unwrap();
Source

pub fn maximized(&self) -> bool

Check if the window has a horizontally or vertically maximized

§Examples
use libwmctl::prelude::*;
let win = window(12345);
win.maximized()
Source

pub fn unmaximize(&self) -> WmCtlResult<()>

Remove the MaxVert and MaxHorz states

§Examples
use libwmctl::prelude::*;
let win = window(12345);
win.unmaximize().unwrap();
Source

pub fn shape(self, shape: Shape) -> Self

Queue the shape the window should be. This will not take effect until the place() method is called.

§Arguments
  • shape - pre-defined shape to manipulate the window into
§Examples
use libwmctl::prelude::*;
window(12345).shape(WinShape::Large).place().unwrap();
Source

pub fn pos(self, pos: Position) -> Self

Queue the position the window should be. This will not take effect until the place() method is called.

§Arguments
  • pos - pre-defined position to move the window to
§Examples
use libwmctl::prelude::*;
window(12345).pos(WinPosition::Right).place().unwrap();
Source

pub fn place(&self) -> WmCtlResult<()>

Move and resize the window according to the queued directives configured with the shape() and pos() methods.

§Examples
use libwmctl::prelude::*;
let win = window(12345);
win.shape(Shape::Large).pos(Position::Right).place();

Trait Implementations§

Source§

impl Clone for Window

Source§

fn clone(&self) -> Window

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl Freeze for Window

§

impl RefUnwindSafe for Window

§

impl Send for Window

§

impl Sync for Window

§

impl Unpin for Window

§

impl UnwindSafe for Window

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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