Struct XcbConnection

Source
pub struct XcbConnection { /* private fields */ }
Expand description

Handles communication with an X server via the XCB library.

XcbConnection is a minimal implementation that does not make use of the full asyc capabilities of the underlying C XCB library.

Implementations§

Source§

impl XcbConnection

Source

pub fn new() -> Result<Self>

Establish a new connection to the running X server. Fails if unable to connect

Source

pub fn xcb_connection(&self) -> &Connection

Get a handle on the underlying XCB Connection used by Api to communicate with the X server.

Source

pub fn api(&self) -> &Api

Get a handle on the underlying Api to communicate with the X server.

Source

pub fn api_mut(&mut self) -> &mut Api

Get a mutable handle on the underlying Api to communicate with the X server.

Source

pub fn known_atoms(&self) -> &HashMap<Atom, u32>

The current interned Atom values known to the underlying Api connection

Trait Implementations§

Source§

impl Debug for XcbConnection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl XAtomQuerier for XcbConnection

Source§

fn atom_name(&self, atom: Xid) -> Result<String>

Convert an X atom id to its human friendly name
Source§

fn atom_id(&self, name: &str) -> Result<Xid>

Fetch or intern an atom by name
Source§

impl XClientConfig for XcbConnection

Source§

fn configure_client(&self, id: Xid, data: &[ClientConfig]) -> Result<()>

Configure the on screen appearance of a client window
Source§

fn set_client_attributes(&self, id: Xid, data: &[ClientAttr]) -> Result<()>

Set client attributes such as event masks, border color etc
Source§

fn get_window_attributes(&self, id: Xid) -> Result<WindowAttributes>

Get the WindowAttributes for this client
Source§

fn position_client( &self, id: Xid, r: Region, border: u32, stack_above: bool, ) -> Result<()>

Reposition the window identified by ‘id’ to the specifed region
Source§

fn raise_client(&self, id: Xid) -> Result<()>

Raise the window to the top of the stack so it renders above peers
Source§

fn set_client_border_color(&self, id: Xid, color: Color) -> Result<()>

Change the border color for the given client
Source§

impl XClientHandler for XcbConnection

Source§

fn map_client(&self, id: Xid) -> Result<()>

Map a client to the display.
Source§

fn unmap_client(&self, id: Xid) -> Result<()>

Unmap a client from the display.
Source§

fn focus_client(&self, id: Xid) -> Result<()>

Mark the given client as having focus
Source§

fn destroy_client(&self, id: Xid) -> Result<()>

Destroy an existing client.
Source§

fn kill_client(&self, id: Xid) -> Result<()>

Forcably kill an existing client.
Source§

fn map_client_if_needed(&self, win: Option<&mut Client>) -> Result<()>

Map a known penrose Client if it is not currently visible
Source§

fn unmap_client_if_needed(&self, win: Option<&mut Client>) -> Result<()>

Unmap a known penrose Client if it is currently visible
Source§

impl XClientProperties for XcbConnection

Source§

fn get_prop(&self, id: Xid, name: &str) -> Result<Prop>

Query a property for a client by ID and name. Read more
Source§

fn list_props(&self, id: Xid) -> Result<Vec<String>>

Return the list of all properties set on the given client window Read more
Source§

fn delete_prop(&self, id: Xid, name: &str) -> Result<()>

Delete an existing property from a client
Source§

fn change_prop(&self, id: Xid, prop: &str, val: Prop) -> Result<()>

Change an existing property for a client
Source§

fn set_client_state(&self, id: Xid, state: WindowState) -> Result<()>

Update a client’s WM_STATE property to the given value. Read more
Source§

fn client_supports_protocol(&self, id: Xid, proto: &str) -> Result<bool>

Check to see if a given client window supports a particular protocol or not
Source§

fn client_accepts_focus(&self, id: Xid) -> bool

Check to see if a given client accepts input focus
Source§

fn toggle_client_fullscreen( &self, id: Xid, client_is_fullscreen: bool, ) -> Result<()>

Toggle the fullscreen state of the given client ID with the X server
Source§

fn client_name(&self, id: Xid) -> Result<String>

Fetch a client’s name proprty following ICCCM / EWMH standards
Source§

fn client_should_float(&self, id: Xid, floating_classes: &[&str]) -> bool

Determine whether the target client should be tiled or allowed to float
Source§

impl XConn for XcbConnection

Source§

fn init(&self) -> Result<()>

Initialise any state required before this connection can be used by the WindowManager. Read more
Source§

fn check_window(&self) -> Xid

An X id for a check window that will be used for holding EWMH window manager properties Read more
Source§

fn cleanup(&self) -> Result<()>

Perform any state cleanup required prior to shutting down the window manager
Source§

fn grab_keys( &self, key_bindings: &KeyBindings<Self>, mouse_bindings: &MouseBindings<Self>, ) -> Result<()>

Notify the X server that we are intercepting the user specified key bindings and prevent them being passed through to the underlying applications. Read more
Source§

fn mark_new_client(&self, id: Xid) -> Result<()>

Mark the given client as newly created
Source§

fn set_wm_properties(&self, workspaces: &[String]) -> Result<()>

Set required EWMH properties to ensure compatability with external programs
Source§

fn update_desktops(&self, workspaces: &[String]) -> Result<()>

Update the root window properties with the current desktop details
Source§

fn update_known_clients(&self, clients: &[Xid]) -> Result<()>

Update the root window properties with the current client details
Source§

fn set_current_workspace(&self, wix: usize) -> Result<()>

Update which desktop is currently focused
Source§

fn set_root_window_name(&self, name: &str) -> Result<()>

Set the WM_NAME prop of the root window
Source§

fn set_client_workspace(&self, id: Xid, wix: usize) -> Result<()>

Update which desktop a client is currently on
Source§

fn is_managed_client(&self, c: &Client) -> bool

Check to see if this client is one that we should be handling or not
Source§

fn active_managed_clients( &self, floating_classes: &[&str], ) -> Result<Vec<Client>>

The subset of active clients that are considered managed by penrose
Source§

impl XEventHandler for XcbConnection

Source§

fn flush(&self) -> bool

Flush pending actions to the X event loop
Source§

fn wait_for_event(&self) -> Result<XEvent>

Wait for the next event from the X server and return it as an XEvent
Source§

fn send_client_event(&self, msg: ClientMessage) -> Result<()>

Send an X event to the target client Read more
Source§

fn build_client_event(&self, kind: ClientMessageKind) -> Result<ClientMessage>

Build the required event data for sending a known client event.
Source§

impl XState for XcbConnection

Source§

fn root(&self) -> Xid

The root window ID
Source§

fn current_screens(&self) -> Result<Vec<Screen>>

Determine the currently connected screens and return their details
Source§

fn cursor_position(&self) -> Result<Point>

Determine the current (x,y) position of the cursor relative to the root window.
Source§

fn warp_cursor(&self, win_id: Option<Xid>, screen: &Screen) -> Result<()>

Warp the cursor to be within the specified window. If id == None then behaviour is definined by the implementor (e.g. warp cursor to active window, warp to center of screen)
Source§

fn client_geometry(&self, id: Xid) -> Result<Region>

Return the current (x, y, w, h) dimensions of the requested window
Source§

fn active_clients(&self) -> Result<Vec<Xid>>

Run on startup/restart to determine already running windows that we need to track
Source§

fn focused_client(&self) -> Result<Xid>

Return the client ID of the crate::core::client::Client that currently holds X focus

Auto Trait Implementations§

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> 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, 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