Struct WindowHandle

Source
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

Source

pub fn close(&self)

Sends a close request to this window.

If the window is unresponsive, it may not close.

Source

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.

Source

pub fn set_fullscreen(&self, set: bool)

Sets this window to fullscreen or not.

Source

pub fn toggle_fullscreen(&self)

Toggles this window between fullscreen and not.

Source

pub fn set_maximized(&self, set: bool)

Sets this window to maximized or not.

Source

pub fn toggle_maximized(&self)

Toggles this window between maximized and not.

Source

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.

Source

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.

Source

pub fn set_focused(&self, set: bool)

Focuses or unfocuses this window.

Source

pub fn toggle_focused(&self)

Toggles this window between focused and unfocused.

Source

pub fn set_decoration_mode(&self, mode: DecorationMode)

Sets this window’s decoration mode.

Source

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")?);
Source

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"
Source

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"
Source

pub fn raise(&self)

Raises this window to the front.

Source

pub fn loc(&self) -> Option<Point>

Gets this window’s current location in the global space.

Source

pub async fn loc_async(&self) -> Option<Point>

Async impl for Self::loc.

Source

pub fn size(&self) -> Option<Size>

Gets this window’s current size.

Source

pub async fn size_async(&self) -> Option<Size>

Async impl for Self::size.

Source

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.

Source

pub async fn app_id_async(&self) -> String

Async impl for Self::app_id.

Source

pub fn title(&self) -> String

Gets this window’s title.

If it doesn’t have one, this returns an empty string.

Source

pub async fn title_async(&self) -> String

Async impl for Self::title.

Source

pub fn focused(&self) -> bool

Gets whether or not this window has keyboard focus.

Source

pub async fn focused_async(&self) -> bool

Async impl for Self::focused.

Source

pub fn layout_mode(&self) -> LayoutMode

Gets this window’s current LayoutMode.

Source

pub async fn layout_mode_async(&self) -> LayoutMode

Async impl for Self::layout_mode.

Source

pub fn floating(&self) -> bool

Gets whether or not this window is floating.

Source

pub async fn floating_async(&self) -> bool

Async impl for Self::floating.

Source

pub fn fullscreen(&self) -> bool

Gets whether or not this window is fullscreen.

Source

pub async fn fullscreen_async(&self) -> bool

Async impl for Self::fullscreen.

Source

pub fn maximized(&self) -> bool

Gets whether or not this window is maximized.

Source

pub async fn maximized_async(&self) -> bool

Async impl for Self::maximized.

Source

pub fn tags(&self) -> impl Iterator<Item = TagHandle>

Gets handles to all tags on this window.

Source

pub async fn tags_async(&self) -> impl Iterator<Item = TagHandle>

Async impl for Self::tags.

Source

pub fn is_on_active_tag(&self) -> bool

Gets whether or not this window has an active tag.

Source

pub async fn is_on_active_tag_async(&self) -> bool

Async impl for Self::is_on_active_tag.

Source

pub fn id(&self) -> u32

Gets this window’s raw compositor id.

Source

pub fn from_id(id: u32) -> Self

Creates a window handle from an ID.

Note: This is mostly for testing and if you want to serialize and deserialize window handles.

Trait Implementations§

Source§

impl Clone for WindowHandle

Source§

fn clone(&self) -> WindowHandle

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WindowHandle

Source§

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

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

impl Hash for WindowHandle

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for WindowHandle

Source§

fn eq(&self, other: &WindowHandle) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for WindowHandle

Source§

impl StructuralPartialEq for WindowHandle

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more