Struct TagHandle

Source
pub struct TagHandle { /* private fields */ }
Expand description

A handle to a tag.

This handle allows you to do things like switch to tags and get their properties.

Implementations§

Source§

impl TagHandle

Source

pub fn from_id(id: u32) -> Self

Creates a tag handle from a numeric id.

Source

pub fn switch_to(&self)

Activates this tag and deactivates all other ones on the same output.

This emulates what a traditional workspace is.

§Examples
// Assume the focused output has the following inactive tags and windows:
// "1": Alacritty
// "2": Firefox, Discord
// "3": Steam
tag::get("2")?.switch_to(); // Displays Firefox and Discord
tag::get("3")?.switch_to(); // Displays Steam
Source

pub fn set_active(&self, set: bool)

Sets this tag to active or not.

While active, windows with this tag will be displayed.

While inactive, windows with this tag will not be displayed unless they have other active tags.

§Examples
// Assume the focused output has the following inactive tags and windows:
// "1": Alacritty
// "2": Firefox, Discord
// "3": Steam
tag::get("2")?.set_active(true);  // Displays Firefox and Discord
tag::get("3")?.set_active(true);  // Displays Firefox, Discord, and Steam
tag::get("2")?.set_active(false); // Displays Steam
Source

pub fn toggle_active(&self)

Toggles this tag between active and inactive.

While active, windows with this tag will be displayed.

While inactive, windows with this tag will not be displayed unless they have other active tags.

§Examples
// Assume the focused output has the following inactive tags and windows:
// "1": Alacritty
// "2": Firefox, Discord
// "3": Steam
tag::get("2")?.toggle_active(); // Displays Firefox and Discord
tag::get("3")?.toggle_active(); // Displays Firefox, Discord, and Steam
tag::get("3")?.toggle_active(); // Displays Firefox, Discord
tag::get("2")?.toggle_active(); // Displays nothing
Source

pub fn remove(&self)

Removes this tag from its output.

§Examples
let tags =
    tag::add(&output::get_by_name("DP-1")?, ["1", "2", "Buckle", "Shoe"]).collect::<Vec<_>>();

tags[1].remove();
tags[3].remove();
// "DP-1" now only has tags "1" and "Buckle"
Source

pub fn active(&self) -> bool

Gets whether or not this tag is active.

Source

pub async fn active_async(&self) -> bool

Async impl for Self::active.

Source

pub fn name(&self) -> String

Gets this tag’s name.

Source

pub async fn name_async(&self) -> String

Async impl for Self::name.

Source

pub fn output(&self) -> OutputHandle

Gets a handle to the output this tag is on.

Source

pub async fn output_async(&self) -> OutputHandle

Async impl for Self::output.

Source

pub fn windows(&self) -> impl Iterator<Item = WindowHandle>

Gets all windows with this tag.

Source

pub async fn windows_async(&self) -> impl Iterator<Item = WindowHandle>

Async impl for Self::windows.

Source

pub fn id(&self) -> u32

Gets this tag’s raw compositor id.

Trait Implementations§

Source§

impl Clone for TagHandle

Source§

fn clone(&self) -> TagHandle

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 TagHandle

Source§

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

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

impl Hash for TagHandle

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 TagHandle

Source§

fn eq(&self, other: &TagHandle) -> 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 TagHandle

Source§

impl StructuralPartialEq for TagHandle

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