pub struct WindowHandle { /* private fields */ }Expand description
A handle to a window.
This allows you to manipulate the window and get its properties.
Implementations§
Source§impl WindowHandle
impl WindowHandle
Sourcepub fn close(&self)
pub fn close(&self)
Sends a close request to this window.
If the window is unresponsive, it may not close.
Sourcepub fn set_geometry(
&self,
x: impl Into<Option<i32>>,
y: impl Into<Option<i32>>,
w: impl Into<Option<u32>>,
h: impl Into<Option<u32>>,
)
pub fn set_geometry( &self, x: impl Into<Option<i32>>, y: impl Into<Option<i32>>, w: impl Into<Option<u32>>, h: impl Into<Option<u32>>, )
Sets this window’s location and/or size.
Only affects the floating geometry of windows. Tiled geometries are calculated using the current layout.
Sourcepub fn resize_tile(&self, left: i32, right: i32, top: i32, bottom: i32)
pub fn resize_tile(&self, left: i32, right: i32, top: i32, bottom: i32)
If this window is tiled, resizes its tile by shifting the left, right, top, and bottom edges by the provided pixel amounts.
Positive amounts shift edges right/down, while negative amounts shift edges left/up.
If this resizes the tile in a direction that it can no longer resize towards (e.g. it’s at the edge of the screen), it will resize in the opposite direction.
§Examples
// Grow the focused tiled window 10 pixels leftward
window::get_focused()?.resize_tile(-10, 0, 0, 0);
// Shrink the focused tiled window 10 pixels inward from the right
window::get_focused()?.resize_tile(0, -10, 0, 0);
// Grow the focused tiled window 20 pixels centered vertically
window::get_focused()?.resize_tile(0, 0, -10, 10);Sourcepub fn set_fullscreen(&self, set: bool)
pub fn set_fullscreen(&self, set: bool)
Sets this window to fullscreen or not.
Sourcepub fn toggle_fullscreen(&self)
pub fn toggle_fullscreen(&self)
Toggles this window between fullscreen and not.
Sourcepub fn set_maximized(&self, set: bool)
pub fn set_maximized(&self, set: bool)
Sets this window to maximized or not.
Sourcepub fn toggle_maximized(&self)
pub fn toggle_maximized(&self)
Toggles this window between maximized and not.
Sourcepub fn set_floating(&self, set: bool)
pub fn set_floating(&self, set: bool)
Sets this window to floating or not.
Floating windows will not be tiled and can be moved around and resized freely.
Sourcepub fn toggle_floating(&self)
pub fn toggle_floating(&self)
Toggles this window to and from floating.
Floating windows will not be tiled and can be moved around and resized freely.
Sourcepub fn set_focused(&self, set: bool)
pub fn set_focused(&self, set: bool)
Focuses or unfocuses this window.
Sourcepub fn toggle_focused(&self)
pub fn toggle_focused(&self)
Toggles this window between focused and unfocused.
Sourcepub fn set_decoration_mode(&self, mode: DecorationMode)
pub fn set_decoration_mode(&self, mode: DecorationMode)
Sets this window’s decoration mode.
Sourcepub fn move_to_output(&self, output: &OutputHandle)
pub fn move_to_output(&self, output: &OutputHandle)
Moves this window to the specified output.
This will set the window tags to the output tags, and update the window position.
§Example
// Move the focused window to output DP-2
window::get_focused()?.move_to_output(&output::get_by_name("DP-2")?);Sourcepub fn move_to_tag(&self, tag: &TagHandle)
pub fn move_to_tag(&self, tag: &TagHandle)
Moves this window to the given tag.
This will remove all tags from this window then tag it with tag, essentially moving the
window to that tag.
§Examples
// Move the focused window to tag "Code" on the focused output
window::get_focused()?.move_to_tag(&tag::get("Code")?);Sourcepub fn set_tag(&self, tag: &TagHandle, set: bool)
pub fn set_tag(&self, tag: &TagHandle, set: bool)
Sets or unsets a tag on this window.
§Examples
let focused = window::get_focused()?;
let tag = tag::get("Potato")?;
focused.set_tag(&tag, true); // `focused` now has tag "Potato"
focused.set_tag(&tag, false); // `focused` no longer has tag "Potato"Sourcepub fn toggle_tag(&self, tag: &TagHandle)
pub fn toggle_tag(&self, tag: &TagHandle)
Toggles a tag on this window.
§Examples
let focused = window::get_focused()?;
let tag = tag::get("Potato")?;
focused.toggle_tag(&tag); // `focused` now has tag "Potato"
focused.toggle_tag(&tag); // `focused` no longer has tag "Potato"Sets the exact provided tags on this window.
Passing in an empty collection will not change the window’s tags.
For ergonomics, this accepts iterators of both TagHandle and &TagHandle.
§Examples
let focused = window::get_focused()?;
let tag1 = tag::get("1")?;
let tag3 = tag::get("3")?;
// Set `focused`'s tags to "1" and "3", removing all others
focused.set_tags([tag1, tag3]);Sourcepub fn set_vrr_demand(&self, vrr_demand: impl Into<Option<VrrDemand>>)
pub fn set_vrr_demand(&self, vrr_demand: impl Into<Option<VrrDemand>>)
Sets this window’s VrrDemand.
When set to None, this window has no vrr demand.
This works in conjunction with an output with
Vrr::OnDemand.
Sourcepub async fn size_async(&self) -> Option<Size>
pub async fn size_async(&self) -> Option<Size>
Async impl for Self::size.
Sourcepub fn app_id(&self) -> String
pub fn app_id(&self) -> String
Gets this window’s app id (class if it’s an xwayland window).
If it doesn’t have one, this returns an empty string.
Sourcepub async fn app_id_async(&self) -> String
pub async fn app_id_async(&self) -> String
Async impl for Self::app_id.
Sourcepub fn title(&self) -> String
pub fn title(&self) -> String
Gets this window’s title.
If it doesn’t have one, this returns an empty string.
Sourcepub async fn title_async(&self) -> String
pub async fn title_async(&self) -> String
Async impl for Self::title.
Sourcepub fn output(&self) -> Option<OutputHandle>
pub fn output(&self) -> Option<OutputHandle>
Gets this window’s output.
This is currently implemented as the output of the first tag that this window has.
Returns None if this window doesn’t exist or if it has no tags.
Sourcepub async fn output_async(&self) -> Option<OutputHandle>
pub async fn output_async(&self) -> Option<OutputHandle>
Async impl for Self::output.
Sourcepub async fn focused_async(&self) -> bool
pub async fn focused_async(&self) -> bool
Async impl for Self::focused.
Sourcepub fn layout_mode(&self) -> LayoutMode
pub fn layout_mode(&self) -> LayoutMode
Gets this window’s current LayoutMode.
Sourcepub async fn layout_mode_async(&self) -> LayoutMode
pub async fn layout_mode_async(&self) -> LayoutMode
Async impl for Self::layout_mode.
Sourcepub async fn floating_async(&self) -> bool
pub async fn floating_async(&self) -> bool
Async impl for Self::floating.
Sourcepub async fn tiled_async(&self) -> bool
pub async fn tiled_async(&self) -> bool
Async impl for Self::tiled.
Sourcepub fn fullscreen(&self) -> bool
pub fn fullscreen(&self) -> bool
Gets whether or not this window is fullscreen.
Sourcepub async fn fullscreen_async(&self) -> bool
pub async fn fullscreen_async(&self) -> bool
Async impl for Self::fullscreen.
Sourcepub async fn maximized_async(&self) -> bool
pub async fn maximized_async(&self) -> bool
Async impl for Self::maximized.
Gets handles to all tags on this window.
Async impl for Self::tags.
Sourcepub fn is_on_active_tag(&self) -> bool
pub fn is_on_active_tag(&self) -> bool
Gets whether or not this window has an active tag.
Sourcepub async fn is_on_active_tag_async(&self) -> bool
pub async fn is_on_active_tag_async(&self) -> bool
Async impl for Self::is_on_active_tag.
Sourcepub fn in_direction(
&self,
direction: Direction,
) -> impl Iterator<Item = WindowHandle> + use<>
pub fn in_direction( &self, direction: Direction, ) -> impl Iterator<Item = WindowHandle> + use<>
Gets all windows in the provided direction, sorted closest to farthest.
Sourcepub async fn in_direction_async(
&self,
direction: Direction,
) -> impl Iterator<Item = WindowHandle> + use<>
pub async fn in_direction_async( &self, direction: Direction, ) -> impl Iterator<Item = WindowHandle> + use<>
Async impl for Self::in_direction.
Sourcepub fn foreign_toplevel_list_identifier(&self) -> Option<String>
pub fn foreign_toplevel_list_identifier(&self) -> Option<String>
Gets this window’s ext-foreign-toplevel-list handle identifier.
Sourcepub async fn foreign_toplevel_list_identifier_async(&self) -> Option<String>
pub async fn foreign_toplevel_list_identifier_async(&self) -> Option<String>
Async impl for Self::foreign_toplevel_list_identifier.
Sourcepub fn swap(&self, target: &WindowHandle)
pub fn swap(&self, target: &WindowHandle)
Swap position with another window.
Sourcepub async fn swap_async(&self, target: &WindowHandle)
pub async fn swap_async(&self, target: &WindowHandle)
Async impl for Self::swap.
Trait Implementations§
Source§impl Clone for WindowHandle
impl Clone for WindowHandle
Source§fn clone(&self) -> WindowHandle
fn clone(&self) -> WindowHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WindowHandle
impl Debug for WindowHandle
Source§impl Hash for WindowHandle
impl Hash for WindowHandle
Source§impl PartialEq for WindowHandle
impl PartialEq for WindowHandle
impl Eq for WindowHandle
impl StructuralPartialEq for WindowHandle
Auto Trait Implementations§
impl Freeze for WindowHandle
impl RefUnwindSafe for WindowHandle
impl Send for WindowHandle
impl Sync for WindowHandle
impl Unpin for WindowHandle
impl UnwindSafe for WindowHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].