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 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_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"
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 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 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
.
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
].