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: WindowHidingStrategyImplementations§
Source§impl XWrap
impl XWrap
Sourcepub fn get_all_windows(&self) -> Result<Vec<Window>, String>
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.
Sourcepub fn get_cursor_point(&self) -> Result<(i32, i32), XlibError>
pub fn get_cursor_point(&self) -> Result<(i32, i32), XlibError>
Sourcepub fn get_cursor_window(
&self,
) -> Result<WindowHandle<XlibWindowHandle>, XlibError>
pub fn get_cursor_window( &self, ) -> Result<WindowHandle<XlibWindowHandle>, XlibError>
Sourcepub const fn get_default_root_handle(&self) -> WindowHandle<XlibWindowHandle>
pub const fn get_default_root_handle(&self) -> WindowHandle<XlibWindowHandle>
Returns the handle of the default root.
Sourcepub const fn get_default_root(&self) -> Window
pub const fn get_default_root(&self) -> Window
Returns the default root.
Sourcepub fn get_hint_sizing_as_xyhw(&self, window: Window) -> Option<XyhwChange>
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.
Sourcepub fn get_mask_event(&self) -> XEvent
pub fn get_mask_event(&self) -> XEvent
Returns the next Xevent that matches the mask of the xserver.
Sourcepub fn get_next_event(&self) -> XEvent
pub fn get_next_event(&self) -> XEvent
Returns the next Xevent of the xserver.
Sourcepub fn get_screens(&self) -> Vec<Screen<XlibWindowHandle>>
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.
Sourcepub fn get_screens_area_dimensions(&self) -> (i32, i32)
pub fn get_screens_area_dimensions(&self) -> (i32, i32)
Returns the dimensions of the screens.
Sourcepub fn get_transient_for(&self, window: Window) -> Option<Window>
pub fn get_transient_for(&self, window: Window) -> Option<Window>
Returns the transient parent of a window.
Sourcepub fn get_window_actions_atoms(&self, window: Window) -> Vec<Atom> ⓘ
pub fn get_window_actions_atoms(&self, window: Window) -> Vec<Atom> ⓘ
Returns the atom actions of a window.
Sourcepub fn get_window_attrs(
&self,
window: Window,
) -> Result<XWindowAttributes, XlibError>
pub fn get_window_attrs( &self, window: Window, ) -> Result<XWindowAttributes, XlibError>
Sourcepub fn get_window_class(&self, window: Window) -> Option<(String, String)>
pub fn get_window_class(&self, window: Window) -> Option<(String, String)>
Returns a windows class WM_CLASS
Sourcepub fn get_window_geometry(
&self,
window: Window,
) -> Result<XyhwChange, XlibError>
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.
Sourcepub fn get_window_name(&self, window: Window) -> Option<String>
pub fn get_window_name(&self, window: Window) -> Option<String>
Returns a windows name.
Sourcepub fn get_window_legacy_name(&self, window: Window) -> Option<String>
pub fn get_window_legacy_name(&self, window: Window) -> Option<String>
Returns a WM_NAME (not _NETwindows name).
Sourcepub fn get_window_pid(&self, window: Window) -> Option<u32>
pub fn get_window_pid(&self, window: Window) -> Option<u32>
Returns a windows _NET_WM_PID.
Sourcepub fn get_window_states(&self, window: Window) -> Vec<WindowState>
pub fn get_window_states(&self, window: Window) -> Vec<WindowState>
Returns the states of a window.
Sourcepub fn get_window_states_atoms(&self, window: Window) -> Vec<Atom> ⓘ
pub fn get_window_states_atoms(&self, window: Window) -> Vec<Atom> ⓘ
Returns the atom states of a window.
Sourcepub fn get_window_strut_array(&self, window: Window) -> Option<DockArea>
pub fn get_window_strut_array(&self, window: Window) -> Option<DockArea>
Returns structure of a window as a DockArea.
Sourcepub fn get_window_type(&self, window: Window) -> WindowType
pub fn get_window_type(&self, window: Window) -> WindowType
Returns the type of a window.
Sourcepub fn get_wmhints(&self, window: Window) -> Option<XWMHints>
pub fn get_wmhints(&self, window: Window) -> Option<XWMHints>
Returns the WM_HINTS of a window.
Sourcepub fn get_wm_state(&self, window: Window) -> Option<c_long>
pub fn get_wm_state(&self, window: Window) -> Option<c_long>
Returns the WM_STATE of a window.
Source§impl XWrap
impl XWrap
Sourcepub fn grab_mouse_clicks(&self, handle: Window, is_focused: bool)
pub fn grab_mouse_clicks(&self, handle: Window, is_focused: bool)
Grabs the mouse clicks of a window.
Grabs the button with the modifier for a window.
Cleans all currently grabbed buttons of a window.
Sourcepub fn grab_pointer(&self, cursor: c_ulong)
pub fn grab_pointer(&self, cursor: c_ulong)
Grabs the cursor and sets its visual.
Sourcepub fn ungrab_pointer(&self)
pub fn ungrab_pointer(&self)
Ungrab the cursor.
Sourcepub fn move_cursor_to_window(&self, window: Window) -> Result<(), XlibError>
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.
Sourcepub fn replay_click(&self, focused_window: Window, button: c_uint)
pub fn replay_click(&self, focused_window: Window, button: c_uint)
Replay a click on a window.
Sourcepub fn allow_pointer_events(&self)
pub fn allow_pointer_events(&self)
Release the pointer if it is frozen.
Source§impl XWrap
impl XWrap
Sourcepub fn append_property_long(
&self,
window: Window,
property: Atom,
type: Atom,
data: &[c_long],
)
pub fn append_property_long( &self, window: Window, property: Atom, type: Atom, data: &[c_long], )
Appends a window property.
Sourcepub fn replace_property_long(
&self,
window: Window,
property: Atom,
type: Atom,
data: &[c_long],
)
pub fn replace_property_long( &self, window: Window, property: Atom, type: Atom, data: &[c_long], )
Replaces a window property.
Sourcepub fn set_client_list(&self)
pub fn set_client_list(&self)
Sets the client list to the currently managed windows.
Sourcepub fn set_current_desktop(&self, current_tag: Option<TagId>)
pub fn set_current_desktop(&self, current_tag: Option<TagId>)
Sets the current desktop.
Sourcepub fn set_desktop_prop(&self, data: &[u32], atom: c_ulong)
pub fn set_desktop_prop(&self, data: &[u32], atom: c_ulong)
Sets a desktop property.
Sourcepub fn set_desktop_prop_c_ulong(
&self,
value: c_ulong,
atom: c_ulong,
type: c_ulong,
)
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.
Sourcepub fn set_desktop_prop_string(
&self,
value: &str,
atom: c_ulong,
encoding: Atom,
)
pub fn set_desktop_prop_string( &self, value: &str, atom: c_ulong, encoding: Atom, )
Sets a desktop property with type string.
Sourcepub fn set_state(
&self,
handle: WindowHandle<XlibWindowHandle>,
toggle_to: bool,
atom: Atom,
)
pub fn set_state( &self, handle: WindowHandle<XlibWindowHandle>, toggle_to: bool, atom: Atom, )
Sets a windows state.
Sourcepub fn set_window_border_color(&self, window: Window, color: c_ulong)
pub fn set_window_border_color(&self, window: Window, color: c_ulong)
Sets a windows border color.
pub fn set_background_color(&self, color: c_ulong)
Sourcepub fn set_window_config(
&self,
window: Window,
window_changes: XWindowChanges,
unlock: u32,
)
pub fn set_window_config( &self, window: Window, window_changes: XWindowChanges, unlock: u32, )
Sets a windows configuration.
Sourcepub fn set_window_desktop(&self, window: Window, current_tag: &TagId)
pub fn set_window_desktop(&self, window: Window, current_tag: &TagId)
Sets what desktop a window is on.
Sourcepub fn set_window_states_atoms(&self, window: Window, states: &[Atom])
pub fn set_window_states_atoms(&self, window: Window, states: &[Atom])
Sets the atom states of a window.
pub fn set_window_urgency(&self, window: Window, is_urgent: bool)
Sourcepub fn set_wmhints(&self, window: Window, wmh: &mut XWMHints)
pub fn set_wmhints(&self, window: Window, wmh: &mut XWMHints)
Sets the XWMHints of a window.
Sourcepub fn set_wm_states(&self, window: Window, states: &[c_long])
pub fn set_wm_states(&self, window: Window, states: &[c_long])
Sets the WM_STATE of a window.
Source§impl XWrap
impl XWrap
Sourcepub fn setup_window(
&self,
window: Window,
) -> Option<DisplayEvent<XlibWindowHandle>>
pub fn setup_window( &self, window: Window, ) -> Option<DisplayEvent<XlibWindowHandle>>
Sets up a window before we manage it.
Sourcepub fn setup_managed_window(
&mut self,
h: WindowHandle<XlibWindowHandle>,
floating: bool,
follow_mouse: bool,
) -> Option<DisplayEvent<XlibWindowHandle>>
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.
Sourcepub fn teardown_managed_window(
&mut self,
h: &WindowHandle<XlibWindowHandle>,
destroyed: bool,
)
pub fn teardown_managed_window( &mut self, h: &WindowHandle<XlibWindowHandle>, destroyed: bool, )
Teardown a managed window when it is destroyed.
Sourcepub fn update_window(&self, window: &Window<XlibWindowHandle>)
pub fn update_window(&self, window: &Window<XlibWindowHandle>)
Updates a window.
Sourcepub fn toggle_window_visibility(
&self,
window: Window,
visible: bool,
preferred_stategy: Option<WindowHidingStrategy>,
)
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
Sourcepub fn window_take_focus(
&mut self,
window: &Window<XlibWindowHandle>,
previous: Option<&Window<XlibWindowHandle>>,
)
pub fn window_take_focus( &mut self, window: &Window<XlibWindowHandle>, previous: Option<&Window<XlibWindowHandle>>, )
Makes a window take focus.
Sourcepub fn unfocus(
&self,
handle: Option<WindowHandle<XlibWindowHandle>>,
floating: bool,
)
pub fn unfocus( &self, handle: Option<WindowHandle<XlibWindowHandle>>, floating: bool, )
Unfocuses all windows.
Sourcepub fn configure_window(&self, window: &Window<XlibWindowHandle>)
pub fn configure_window(&self, window: &Window<XlibWindowHandle>)
Send a XConfigureEvent for a window to X.
Sourcepub fn change_window_attributes(
&self,
window: Window,
mask: c_ulong,
attrs: XSetWindowAttributes,
)
pub fn change_window_attributes( &self, window: Window, mask: c_ulong, attrs: XSetWindowAttributes, )
Change a windows attributes.
Sourcepub fn restack(&self, handles: Vec<WindowHandle<XlibWindowHandle>>)
pub fn restack(&self, handles: Vec<WindowHandle<XlibWindowHandle>>)
Restacks the windows to the order of the vec.
pub fn move_resize_window(&self, window: Window, x: i32, y: i32, w: u32, h: u32)
Sourcepub fn move_to_top(&self, handle: &WindowHandle<XlibWindowHandle>)
pub fn move_to_top(&self, handle: &WindowHandle<XlibWindowHandle>)
Raise a window.
Sourcepub fn kill_window(&self, h: &WindowHandle<XlibWindowHandle>)
pub fn kill_window(&self, h: &WindowHandle<XlibWindowHandle>)
Kills a window.
Sourcepub fn force_unmapped(&mut self, window: Window)
pub fn force_unmapped(&mut self, window: Window)
Forcibly unmap a window.
Sourcepub fn subscribe_to_event(&self, window: Window, mask: c_long)
pub fn subscribe_to_event(&self, window: Window, mask: c_long)
Subscribe to an event of a window.
Sourcepub fn subscribe_to_window_events(&self, window: Window)
pub fn subscribe_to_window_events(&self, window: Window)
Subscribe to the wanted events of a window.
Source§impl XWrap
impl XWrap
pub fn load_config(&mut self, config: &impl Config)
Sourcepub fn init_desktops_hints(&self)
pub fn init_desktops_hints(&self)
Sourcepub fn send_xevent(
&self,
window: Window,
propogate: i32,
mask: c_long,
event: &mut XEvent,
)
pub fn send_xevent( &self, window: Window, propogate: i32, mask: c_long, event: &mut XEvent, )
Send a xevent for a window to X.
Sourcepub fn update_colors(
&mut self,
focused: Option<WindowHandle<XlibWindowHandle>>,
windows: &[Window<XlibWindowHandle>],
)
pub fn update_colors( &mut self, focused: Option<WindowHandle<XlibWindowHandle>>, windows: &[Window<XlibWindowHandle>], )
Update all the windows with the new colors.
Sourcepub fn set_mode(&mut self, mode: Mode<XlibWindowHandle>)
pub fn set_mode(&mut self, mode: Mode<XlibWindowHandle>)
Sets the mode within our xwrapper.
Sourcepub async fn wait_readable(&mut self)
pub async fn wait_readable(&mut self)
Wait until readable.