XWrap

Struct XWrap 

Source
pub struct XWrap {
Show 13 fields pub atoms: XAtom, pub managed_windows: Vec<Window>, pub focused_window: Window, pub tag_labels: Vec<String>, pub mode: Mode<XlibWindowHandle>, pub focus_behaviour: FocusBehaviour, pub focus_on_activation: FocusOnActivationBehaviour, pub mouse_key_mask: ModMask, pub mode_origin: (i32, i32), pub task_notify: Arc<Notify>, pub motion_event_limiter: c_ulong, pub refresh_rate: c_short, pub window_hiding_strategy: WindowHidingStrategy, /* private fields */
}
Expand description

Contains Xserver information and origins.

Fields§

§atoms: XAtom§managed_windows: Vec<Window>§focused_window: Window§tag_labels: Vec<String>§mode: Mode<XlibWindowHandle>§focus_behaviour: FocusBehaviour§focus_on_activation: FocusOnActivationBehaviour§mouse_key_mask: ModMask§mode_origin: (i32, i32)§task_notify: Arc<Notify>§motion_event_limiter: c_ulong§refresh_rate: c_short§window_hiding_strategy: WindowHidingStrategy

Implementations§

Source§

impl XWrap

Source

pub fn get_all_windows(&self) -> Result<Vec<Window>, String>

Returns the child windows of all roots.

§Errors

Will error if root has no windows or there is an error obtaining the root windows. See get_windows_for_root.

Source

pub fn get_color(&self, color: String) -> c_ulong

Returns a XColor for a color.

Source

pub fn get_cursor_point(&self) -> Result<(i32, i32), XlibError>

Returns the current position of the cursor.

§Errors

Will error if root window cannot be found.

Source

pub fn get_cursor_window( &self, ) -> Result<WindowHandle<XlibWindowHandle>, XlibError>

Returns the current window under the cursor.

§Errors

Will error if root window cannot be found.

Source

pub const fn get_default_root_handle(&self) -> WindowHandle<XlibWindowHandle>

Returns the handle of the default root.

Source

pub const fn get_default_root(&self) -> Window

Returns the default root.

Source

pub fn get_hint_sizing_as_xyhw(&self, window: Window) -> Option<XyhwChange>

Returns the WM_SIZE_HINTS/WM_NORMAL_HINTS of a window as a XyhwChange.

Source

pub fn get_mask_event(&self) -> XEvent

Returns the next Xevent that matches the mask of the xserver.

Source

pub fn get_next_event(&self) -> XEvent

Returns the next Xevent of the xserver.

Source

pub fn get_screens(&self) -> Vec<Screen<XlibWindowHandle>>

Returns all the screens of the display.

§Panics

Panics if xorg cannot be contacted (xlib missing, not started, etc.) Also panics if window attrs cannot be obtained.

Source

pub fn get_screens_area_dimensions(&self) -> (i32, i32)

Returns the dimensions of the screens.

Source

pub fn get_transient_for(&self, window: Window) -> Option<Window>

Returns the transient parent of a window.

Source

pub fn get_window_actions_atoms(&self, window: Window) -> Vec<Atom>

Returns the atom actions of a window.

Source

pub fn get_window_attrs( &self, window: Window, ) -> Result<XWindowAttributes, XlibError>

Returns the attributes of a window.

§Errors

Will error if window status is 0 (no attributes).

Source

pub fn get_window_class(&self, window: Window) -> Option<(String, String)>

Returns a windows class WM_CLASS

Source

pub fn get_window_geometry( &self, window: Window, ) -> Result<XyhwChange, XlibError>

Returns the geometry of a window as a XyhwChange struct.

§Errors

Errors if Xlib returns a status of 0.

Source

pub fn get_window_name(&self, window: Window) -> Option<String>

Returns a windows name.

Source

pub fn get_window_legacy_name(&self, window: Window) -> Option<String>

Returns a WM_NAME (not _NETwindows name).

Source

pub fn get_window_pid(&self, window: Window) -> Option<u32>

Returns a windows _NET_WM_PID.

Source

pub fn get_window_states(&self, window: Window) -> Vec<WindowState>

Returns the states of a window.

Source

pub fn get_window_states_atoms(&self, window: Window) -> Vec<Atom>

Returns the atom states of a window.

Source

pub fn get_window_strut_array(&self, window: Window) -> Option<DockArea>

Returns structure of a window as a DockArea.

Source

pub fn get_window_type(&self, window: Window) -> WindowType

Returns the type of a window.

Source

pub fn get_wmhints(&self, window: Window) -> Option<XWMHints>

Returns the WM_HINTS of a window.

Source

pub fn get_wm_state(&self, window: Window) -> Option<c_long>

Returns the WM_STATE of a window.

Source

pub fn get_xatom_name(&self, atom: Atom) -> Result<String, XlibError>

Returns the name of a XAtom.

§Errors

Errors if XAtom is not valid.

Source§

impl XWrap

Source

pub fn grab_mouse_clicks(&self, handle: Window, is_focused: bool)

Grabs the mouse clicks of a window.

Source

pub fn grab_buttons(&self, window: Window, button: u32, modifiers: u32)

Grabs the button with the modifier for a window.

Source

pub fn ungrab_buttons(&self, handle: Window)

Cleans all currently grabbed buttons of a window.

Source

pub fn grab_pointer(&self, cursor: c_ulong)

Grabs the cursor and sets its visual.

Source

pub fn ungrab_pointer(&self)

Ungrab the cursor.

Source

pub fn move_cursor_to_window(&self, window: Window) -> Result<(), XlibError>

Move the cursor to a window.

§Errors

Will error if unable to obtain window attributes. See get_window_attrs.

Source

pub fn move_cursor_to_point(&self, point: (i32, i32)) -> Result<(), XlibError>

Move the cursor to a point.

§Errors

Error indicates XlibError.

Source

pub fn replay_click(&self, focused_window: Window, button: c_uint)

Replay a click on a window.

Source

pub fn allow_pointer_events(&self)

Release the pointer if it is frozen.

Source§

impl XWrap

Source

pub fn append_property_long( &self, window: Window, property: Atom, type: Atom, data: &[c_long], )

Appends a window property.

Source

pub fn replace_property_long( &self, window: Window, property: Atom, type: Atom, data: &[c_long], )

Replaces a window property.

Source

pub fn set_client_list(&self)

Sets the client list to the currently managed windows.

Source

pub fn set_current_desktop(&self, current_tag: Option<TagId>)

Sets the current desktop.

Source

pub fn set_desktop_prop(&self, data: &[u32], atom: c_ulong)

Sets a desktop property.

Source

pub fn set_desktop_prop_c_ulong( &self, value: c_ulong, atom: c_ulong, type: c_ulong, )

Sets a desktop property with type c_ulong.

Source

pub fn set_desktop_prop_string( &self, value: &str, atom: c_ulong, encoding: Atom, )

Sets a desktop property with type string.

Source

pub fn set_state( &self, handle: WindowHandle<XlibWindowHandle>, toggle_to: bool, atom: Atom, )

Sets a windows state.

Source

pub fn set_window_border_color(&self, window: Window, color: c_ulong)

Sets a windows border color.

Source

pub fn set_background_color(&self, color: c_ulong)

Source

pub fn set_window_config( &self, window: Window, window_changes: XWindowChanges, unlock: u32, )

Sets a windows configuration.

Source

pub fn set_window_desktop(&self, window: Window, current_tag: &TagId)

Sets what desktop a window is on.

Source

pub fn set_window_states_atoms(&self, window: Window, states: &[Atom])

Sets the atom states of a window.

Source

pub fn set_window_urgency(&self, window: Window, is_urgent: bool)

Source

pub fn set_wmhints(&self, window: Window, wmh: &mut XWMHints)

Sets the XWMHints of a window.

Source

pub fn set_wm_states(&self, window: Window, states: &[c_long])

Sets the WM_STATE of a window.

Source§

impl XWrap

Source

pub fn setup_window( &self, window: Window, ) -> Option<DisplayEvent<XlibWindowHandle>>

Sets up a window before we manage it.

Source

pub fn setup_managed_window( &mut self, h: WindowHandle<XlibWindowHandle>, floating: bool, follow_mouse: bool, ) -> Option<DisplayEvent<XlibWindowHandle>>

Sets up a window that we want to manage.

Source

pub fn teardown_managed_window( &mut self, h: &WindowHandle<XlibWindowHandle>, destroyed: bool, )

Teardown a managed window when it is destroyed.

Source

pub fn update_window(&self, window: &Window<XlibWindowHandle>)

Updates a window.

Source

pub fn toggle_window_visibility( &self, window: Window, visible: bool, preferred_stategy: Option<WindowHidingStrategy>, )

Show or hide a window, depending on its current visibility. Depending on the configured window_hiding_strategy, this will toggle window visibility by moving the window out of / in to view, or map / unmap it in the display server.

see <https://github.com/leftwm/leftwm/issues/1100> and <https://github.com/leftwm/leftwm/pull/1274> for details

Source

pub fn window_take_focus( &mut self, window: &Window<XlibWindowHandle>, previous: Option<&Window<XlibWindowHandle>>, )

Makes a window take focus.

Source

pub fn focus(&mut self, window: Window, never_focus: bool)

Focuses a window.

Source

pub fn unfocus( &self, handle: Option<WindowHandle<XlibWindowHandle>>, floating: bool, )

Unfocuses all windows.

Source

pub fn configure_window(&self, window: &Window<XlibWindowHandle>)

Send a XConfigureEvent for a window to X.

Source

pub fn change_window_attributes( &self, window: Window, mask: c_ulong, attrs: XSetWindowAttributes, )

Change a windows attributes.

Source

pub fn restack(&self, handles: Vec<WindowHandle<XlibWindowHandle>>)

Restacks the windows to the order of the vec.

Source

pub fn move_resize_window(&self, window: Window, x: i32, y: i32, w: u32, h: u32)

Source

pub fn move_to_top(&self, handle: &WindowHandle<XlibWindowHandle>)

Raise a window.

Source

pub fn kill_window(&self, h: &WindowHandle<XlibWindowHandle>)

Kills a window.

Source

pub fn force_unmapped(&mut self, window: Window)

Forcibly unmap a window.

Source

pub fn subscribe_to_event(&self, window: Window, mask: c_long)

Subscribe to an event of a window.

Source

pub fn subscribe_to_window_events(&self, window: Window)

Subscribe to the wanted events of a window.

Source§

impl XWrap

Source

pub fn new() -> Self

§Panics

Panics if unable to contact xorg.

Source

pub fn load_config(&mut self, config: &impl Config)

Source

pub fn init(&mut self)

Initialize the xwrapper.

Source

pub fn init_desktops_hints(&self)

EWMH support used for bars such as polybar.

§Panics

Panics if a new Cstring cannot be formed

Source

pub fn send_xevent( &self, window: Window, propogate: i32, mask: c_long, event: &mut XEvent, )

Send a xevent for a window to X.

Source

pub fn update_colors( &mut self, focused: Option<WindowHandle<XlibWindowHandle>>, windows: &[Window<XlibWindowHandle>], )

Update all the windows with the new colors.

Source

pub fn set_mode(&mut self, mode: Mode<XlibWindowHandle>)

Sets the mode within our xwrapper.

Source

pub async fn wait_readable(&mut self)

Wait until readable.

Source

pub fn sync(&self)

Flush and sync the xserver.

Source

pub fn flush(&self)

Flush the xserver.

Source

pub fn queue_len(&self) -> i32

Returns how many events are waiting.

Trait Implementations§

Source§

impl Default for XWrap

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for XWrap

§

impl !RefUnwindSafe for XWrap

§

impl !Send for XWrap

§

impl !Sync for XWrap

§

impl Unpin for XWrap

§

impl !UnwindSafe for XWrap

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

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
§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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