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: AtomCollectionImplementations
sourceimpl WmCtl
impl WmCtl
sourcepub fn connect() -> WmCtlResult<Self>
pub fn connect() -> WmCtlResult<Self>
Create the window manager control instance and connect to the X11 server
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();sourcepub fn screen(&self) -> usize
pub fn screen(&self) -> usize
Get the default screen number
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.screen();sourcepub fn root(&self) -> u32
pub fn root(&self) -> u32
Get the root window
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.root();sourcepub fn width(&self) -> u32
pub fn width(&self) -> u32
Get the screen full width
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.width();sourcepub fn height(&self) -> u32
pub fn height(&self) -> u32
Get screen full height
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.height();sourcepub fn work_width(&self) -> u32
pub fn work_width(&self) -> u32
Get screen work width which is the full width minus any taskbars
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.work_width();sourcepub fn work_height(&self) -> u32
pub fn work_height(&self) -> u32
Get screen work height which is the full width minus any taskbars
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.work_height();sourcepub fn active_win(&self) -> WmCtlResult<u32>
pub fn active_win(&self) -> WmCtlResult<u32>
Get the active window id
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.active_win().unwrap();sourcepub fn composite_manager(&self) -> WmCtlResult<bool>
pub fn composite_manager(&self) -> WmCtlResult<bool>
Check if a composit manager is running
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.composite_manager().unwrap();sourcepub fn desktops(&self) -> WmCtlResult<u32>
pub fn desktops(&self) -> WmCtlResult<u32>
Get number of desktops
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
wmctl.desktops().unwrap();sourcepub fn maximize_win(&self, win: Window) -> WmCtlResult<()>
pub fn maximize_win(&self, win: Window) -> WmCtlResult<()>
sourcepub fn move_resize_win(
&self,
win: Window,
gravity: Option<u32>,
x: Option<u32>,
y: Option<u32>,
w: Option<u32>,
h: Option<u32>
) -> WmCtlResult<()>
pub fn move_resize_win(
&self,
win: Window,
gravity: Option<u32>,
x: Option<u32>,
y: Option<u32>,
w: Option<u32>,
h: Option<u32>
) -> WmCtlResult<()>
Move and resize the given window
Arguments
win- id of the window to manipulategravity- gravity to use when resizing the window, defaults to NorthWestx- x coordinate to use for the window during positioningy- y coordinate to use for the window during positioningw- width to resize the window toh- 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();sourcepub fn send_event(&self, msg: ClientMessageEvent) -> WmCtlResult<()>
pub fn send_event(&self, msg: ClientMessageEvent) -> WmCtlResult<()>
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();sourcepub fn unmaximize_win(&self, win: Window) -> WmCtlResult<()>
pub fn unmaximize_win(&self, win: Window) -> WmCtlResult<()>
sourcepub fn winmgr(&self) -> WmCtlResult<(u32, String)>
pub fn winmgr(&self) -> WmCtlResult<(u32, String)>
Get window manager’s window id and name
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let (id, name) = wmctl.winmgr().unwrap();sourcepub fn workarea(&self) -> WmCtlResult<(u16, u16)>
pub fn workarea(&self) -> WmCtlResult<(u16, u16)>
Get desktop work area
Examples
use libwmctl::prelude::*;
let wmctl = WmCtl::connect().unwrap();
let (w, h) = wmctl.workarea().unwrap();sourcepub fn win_attributes(&self, win: Window) -> WmCtlResult<(WinClass, WinMap)>
pub fn win_attributes(&self, win: Window) -> WmCtlResult<(WinClass, WinMap)>
sourcepub fn win_class(&self, win: Window) -> WmCtlResult<String>
pub fn win_class(&self, win: Window) -> WmCtlResult<String>
sourcepub fn win_desktop(&self, win: Window) -> WmCtlResult<i32>
pub fn win_desktop(&self, win: Window) -> WmCtlResult<i32>
sourcepub fn win_borders(&self, win: Window) -> WmCtlResult<(u32, u32, u32, u32)>
pub fn win_borders(&self, win: Window) -> WmCtlResult<(u32, u32, u32, u32)>
sourcepub fn win_geometry(&self, win: Window) -> WmCtlResult<(i32, i32, u32, u32)>
pub fn win_geometry(&self, win: Window) -> WmCtlResult<(i32, i32, u32, u32)>
sourcepub fn win_name(&self, win: Window) -> WmCtlResult<String>
pub fn win_name(&self, win: Window) -> WmCtlResult<String>
sourcepub fn win_parent(&self, win: Window) -> WmCtlResult<u32>
pub fn win_parent(&self, win: Window) -> WmCtlResult<u32>
sourcepub fn win_pid(&self, win: Window) -> WmCtlResult<i32>
pub fn win_pid(&self, win: Window) -> WmCtlResult<i32>
Auto Trait Implementations
impl !RefUnwindSafe for WmCtl
impl Send for WmCtl
impl Sync for WmCtl
impl Unpin for WmCtl
impl !UnwindSafe for WmCtl
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more