Skip to main content

PanelDesc

Struct PanelDesc 

Source
pub struct PanelDesc<'a> {
    pub namespace: &'a str,
    pub monitor: Option<MonitorId>,
    pub layer: PanelLayer,
    pub anchor: PanelAnchor,
    pub reserve: Reserve,
    pub margins: Margins,
    pub keyboard: PanelKeyboard,
}
Expand description

Where a panel goes and how it behaves.

Laid out the way wlr-layer-shell describes a surface, because that protocol is the most complete statement of what a panel is: the other window systems implement a subset, and the backend docs say which.

Its size is WindowDesc::size, with one exception: along an axis where it is anchored to both opposite edges, that size is ignored and the panel stretches between them. A bar anchored TOP | LEFT | RIGHT with a size of (0, 50) is 50 high and as wide as the monitor. Either way the size it actually gets arrives as the first Resized, as for any window, and is the one to draw at.

Fields§

§namespace: &'a str

The name window-system rules match the panel by: the layer-shell namespace on Wayland, which Sway’s and Hyprland’s per-layer rules key on. Empty means WindowDesc::app_id.

§monitor: Option<MonitorId>

The monitor it is placed on, or None for the system’s choice, which is where the user is rather than the primary monitor: the compositor’s pick on Wayland (the focused output on Sway, Hyprland and niri), and the monitor under the pointer on Win32 and AppKit. A launcher opening on a screen the user is not looking at is the failure this avoids.

§layer: PanelLayer

Which band of the stack it lives in.

§anchor: PanelAnchor

The edges it is held against. A panel held against two opposite edges stretches between them; one held against none is centred.

§reserve: Reserve

Whether, and how, it keeps other windows out of its space.

§margins: Margins

Space between the panel and the edges it is anchored to, in logical units. A margin on an edge it is not anchored to does nothing.

§keyboard: PanelKeyboard

Whether it takes the keyboard.

Implementations§

Source§

impl PanelDesc<'_>

Source

pub fn reserved_edge(&self) -> Option<PanelAnchor>

The edge Reserve::OwnExtent would reserve: the one anchored edge, alone or with both of its neighbours. None for any other anchoring, which has no single edge to give up.

Trait Implementations§

Source§

impl<'a> Clone for PanelDesc<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for PanelDesc<'a>

Source§

impl<'a> Debug for PanelDesc<'a>

Source§

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

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

impl<'a> Default for PanelDesc<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> PartialEq for PanelDesc<'a>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for PanelDesc<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for PanelDesc<'a>

§

impl<'a> RefUnwindSafe for PanelDesc<'a>

§

impl<'a> Send for PanelDesc<'a>

§

impl<'a> Sync for PanelDesc<'a>

§

impl<'a> Unpin for PanelDesc<'a>

§

impl<'a> UnsafeUnpin for PanelDesc<'a>

§

impl<'a> UnwindSafe for PanelDesc<'a>

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.