WindowLayout

Struct WindowLayout 

Source
pub struct WindowLayout {
    pub pos_in_scrolling_layout: Option<(usize, usize)>,
    pub tile_size: (f64, f64),
    pub window_size: (i32, i32),
    pub tile_pos_in_workspace_view: Option<(f64, f64)>,
    pub window_offset_in_tile: (f64, f64),
}
Expand description

Position- and size-related properties of a Window.

Optional properties will be unset for some windows, do not rely on them being present. Whether some optional properties are present or absent for certain window types may change across niri releases.

All sizes and positions are in logical pixels unless stated otherwise. Logical sizes may be fractional. For example, at 1.25 monitor scale, a 2-physical-pixel-wide window border is 1.6 logical pixels wide.

This struct contains positions and sizes both for full tiles (Self::tile_size, Self::tile_pos_in_workspace_view) and the window geometry (Self::window_size, Self::window_offset_in_tile). For visual displays, use the tile properties, as they correspond to what the user visually considers “window”. The window properties on the other hand are mainly useful when you need to know the underlying Wayland window sizes, e.g. for application debugging.

Fields§

§pos_in_scrolling_layout: Option<(usize, usize)>

Location of a tiled window within a workspace: (column index, tile index in column).

The indices are 1-based, i.e. the leftmost column is at index 1 and the topmost tile in a column is at index 1. This is consistent with Action::FocusColumn and Action::FocusWindowInColumn.

§tile_size: (f64, f64)

Size of the tile this window is in, including decorations like borders.

§window_size: (i32, i32)

Size of the window’s visual geometry itself.

Does not include niri decorations like borders.

Currently, Wayland toplevel windows can only be integer-sized in logical pixels, even though it doesn’t necessarily align to physical pixels.

§tile_pos_in_workspace_view: Option<(f64, f64)>

Tile position within the current view of the workspace.

This is the same “workspace view” as in gradients’ relative-to in the niri config.

§window_offset_in_tile: (f64, f64)

Location of the window’s visual geometry within its tile.

This includes things like border sizes. For fullscreened fixed-size windows this includes the distance from the corner of the black backdrop to the corner of the (centered) window contents.

Trait Implementations§

Source§

impl Clone for WindowLayout

Source§

fn clone(&self) -> WindowLayout

Returns a duplicate 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 WindowLayout

Source§

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

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

impl<'de> Deserialize<'de> for WindowLayout

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for WindowLayout

Source§

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

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for WindowLayout

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,