[][src]Trait penrose::xcb::XcbApi

pub trait XcbApi {
    pub fn atom(&self, name: &str) -> Result<u32>;
pub fn known_atom(&self, atom: Atom) -> u32;
pub fn delete_prop(&self, id: WinId, prop: Atom);
pub fn get_atom_prop(&self, id: WinId, atom: Atom) -> Result<u32>;
pub fn get_str_prop(&self, id: WinId, name: &str) -> Result<String>;
pub fn replace_prop(&self, id: WinId, prop: Atom, val: PropVal<'_>);
pub fn create_window(
        &self,
        ty: WinType,
        r: Region,
        managed: bool
    ) -> Result<WinId>;
pub fn configure_window(&self, id: WinId, conf: &[WinConfig]);
pub fn current_clients(&self) -> Result<Vec<WinId>>;
pub fn destroy_window(&self, id: WinId);
pub fn focused_client(&self) -> Result<WinId>;
pub fn map_window(&self, id: WinId);
pub fn mark_focused_window(&self, id: WinId);
pub fn send_client_event(&self, id: WinId, atom_name: &str) -> Result<()>;
pub fn set_window_attributes(&self, id: WinId, attrs: &[WinAttr]);
pub fn unmap_window(&self, id: WinId);
pub fn window_geometry(&self, id: WinId) -> Result<Region>;
pub fn current_screens(&self) -> Result<Vec<Screen>>;
pub fn screen_sizes(&self) -> Result<Vec<Region>>;
pub fn cursor_position(&self) -> Point;
pub fn grab_keys(&self, keys: &[&KeyCode]);
pub fn grab_mouse_buttons(&self, states: &[&MouseState]);
pub fn ungrab_keys(&self);
pub fn ungrab_mouse_buttons(&self);
pub fn flush(&self) -> bool;
pub fn root(&self) -> WinId;
pub fn set_randr_notify_mask(&self) -> Result<()>;
pub fn wait_for_event(&self) -> Result<XEvent>;
pub fn poll_for_event(&self) -> Result<Option<XEvent>>;
pub fn warp_cursor(&self, id: WinId, x: usize, y: usize); }

An abstraction layer for talking to the X server using the XCB api.

This has been written to be a reasonably close mapping to the underlying C API, but provides several quality of life changes that make consuming the API nicer to work with in Penrose code.

Required methods

pub fn atom(&self, name: &str) -> Result<u32>[src]

Intern an atom by name, returning the corresponding id.

Can fail if the atom name is not a known X atom or if there is an issue with communicating with the X server. For known atoms that are included in the Atom enum, the XcbApi::known_atom method should be used instead.

pub fn known_atom(&self, atom: Atom) -> u32[src]

Fetch the id value of a known Atom variant.

This operation is expected to always succeed as known atoms should either be interned on init of the implementing struct or statically assigned a value in the implementation.

pub fn delete_prop(&self, id: WinId, prop: Atom)[src]

Delete a known property from a window

pub fn get_atom_prop(&self, id: WinId, atom: Atom) -> Result<u32>[src]

Fetch an Atom property for a given window

pub fn get_str_prop(&self, id: WinId, name: &str) -> Result<String>[src]

Fetch an String property for a given window

pub fn replace_prop(&self, id: WinId, prop: Atom, val: PropVal<'_>)[src]

Replace a property value on a window.

See the documentation for the C level XCB API for the correct property type for each prop.

pub fn create_window(
    &self,
    ty: WinType,
    r: Region,
    managed: bool
) -> Result<WinId>
[src]

Create a new client window

pub fn configure_window(&self, id: WinId, conf: &[WinConfig])[src]

Apply a set of config options to a window

pub fn current_clients(&self) -> Result<Vec<WinId>>[src]

The list of currently active clients known to the X server

pub fn destroy_window(&self, id: WinId)[src]

Destroy the X server state for a given window

pub fn focused_client(&self) -> Result<WinId>[src]

The client that the X server currently considers to be focused

pub fn map_window(&self, id: WinId)[src]

Send a XEvent::MapRequest for the target window

pub fn mark_focused_window(&self, id: WinId)[src]

Mark the given window as currently having focus in the X server state

pub fn send_client_event(&self, id: WinId, atom_name: &str) -> Result<()>[src]

Send an event to a client

pub fn set_window_attributes(&self, id: WinId, attrs: &[WinAttr])[src]

Set attributes on the target window

pub fn unmap_window(&self, id: WinId)[src]

Unmap the target window

pub fn window_geometry(&self, id: WinId) -> Result<Region>[src]

Find the current size and position of the target window

pub fn current_screens(&self) -> Result<Vec<Screen>>[src]

Query the randr API for current outputs and return the details as penrose Screen structs.

pub fn screen_sizes(&self) -> Result<Vec<Region>>[src]

Query the randr API for current outputs and return the size of each screen

pub fn cursor_position(&self) -> Point[src]

The current (x, y) position of the cursor relative to the root window

pub fn grab_keys(&self, keys: &[&KeyCode])[src]

Register intercepts for each given KeyCode

pub fn grab_mouse_buttons(&self, states: &[&MouseState])[src]

Register intercepts for each given MouseState

pub fn ungrab_keys(&self)[src]

Drop all active intercepts for key combinations

pub fn ungrab_mouse_buttons(&self)[src]

Drop all active intercepts for mouse states

pub fn flush(&self) -> bool[src]

Flush pending actions to the X event loop

pub fn root(&self) -> WinId[src]

The current root window ID

pub fn set_randr_notify_mask(&self) -> Result<()>[src]

Set a pre-defined notify mask for randr events to subscribe to

pub fn wait_for_event(&self) -> Result<XEvent>[src]

Block until the next event from the X event loop is ready then return it.

This method should handle all of the mapping of xcb events to penrose XEvent instances, returning an Error when the event channel from the X server is closed.

pub fn poll_for_event(&self) -> Result<Option<XEvent>>[src]

Return the next event from the X event loop if there is one.

This method should handle all of the mapping of xcb events to penrose XEvent instances, returning None if there is no pending event and an error if the connection to the X server is closed.

pub fn warp_cursor(&self, id: WinId, x: usize, y: usize)[src]

Move the cursor to the given (x, y) position inside the specified window.

Loading content...

Implementors

impl XcbApi for Api[src]

Loading content...