pub struct Layout {
pub name: String,
pub flip: Flip,
pub rotate: Rotation,
pub reserve: Reserve,
pub columns: Columns,
}Expand description
Describes a layout or pattern in which tiles (windows) will be arranged.
The Layout allows to describe various types of “fixed” layouts used by a dynamic tiling manager.
Those include layouts like MainAndStack, Fibonacci, Dwindle, CenterMain, etc.
Fields§
§name: StringName and identifier of the layout. This is user chosen and no two layouts can have the same name.
flip: FlipFlips the entire result of tiles as a whole if specified to be anything other than Flip::None
rotate: RotationRotate the entire result of tiles as a whole, if specified to be anything other than Rotation::North
reserve: ReserveDefines the layouts behavior if certain “columns” (eg. main, stack, or second-stack) are empty.
See Reserve for more information.
columns: ColumnsConfiguration concerning the Main, Stack, and SecondStack columns.
See Columns for more information.
Implementations§
Source§impl Layout
impl Layout
Sourcepub fn is_monocle(&self) -> bool
pub fn is_monocle(&self) -> bool
Returns true if the layout must be considered a Monocle layout.
The Monocle layout is a special layout that always consists
of 0 or 1 windows. If there is a window, it is shown full screen.
Sourcepub fn is_main_and_deck(&self) -> bool
pub fn is_main_and_deck(&self) -> bool
Returns true if the layout must be considered a MainAndDeck layout.
The MainAndDeck layout is a special layout that always consists
of 0, 1 or 2 windows.
pub fn main_size(&self) -> Option<Size>
pub fn main_window_count(&self) -> Option<usize>
Sourcepub fn set_main_size(&mut self, size: Size)
pub fn set_main_size(&mut self, size: Size)
Sourcepub fn increase_main_size(&mut self, upper_bound: i32)
pub fn increase_main_size(&mut self, upper_bound: i32)
Increase the Size of the Main column, but to no
larger value than what is set in upper_bound.
The column is increased by a default amount,
either [DEFAULT_MAIN_SIZE_CHANGE_PIXEL] or
[DEFAULT_MAIN_SIZE_CHANGE_PERCENTAGE] depending
on whether the current Size is a Size::Pixel or Size::Ratio.
If the current layout has no Main column, nothing happens
Sourcepub fn decrease_main_size(&mut self)
pub fn decrease_main_size(&mut self)
Decrease the Size of the Main column, but to no
smaller value than zero.
The column is decreased by a default amount,
either [DEFAULT_MAIN_SIZE_CHANGE_PIXEL] or
[DEFAULT_MAIN_SIZE_CHANGE_PERCENTAGE] depending
on whether the current Size is a Size::Pixel or Size::Ratio.
If the current layout has no Main column, nothing happens
Sourcepub fn change_main_size(&mut self, delta: i32, upper_bound: i32)
pub fn change_main_size(&mut self, delta: i32, upper_bound: i32)
Change the Size of the Main column by a delta value.
The delta value can be positive or negative and is interpreted
as either Size::Pixel or Size::Ratio based on the current
Size of the Main column.
When the current Size is a Size::Pixel, the delta is
interpreted as a pixel value.
use leftwm_layouts::Layout;
use leftwm_layouts::geometry::Size;
let mut layout = Layout::default();
layout.set_main_size(Size::Pixel(200));
layout.change_main_size(100, 500);
assert_eq!(Size::Pixel(300), layout.columns.main.unwrap().size);When the current Size is a Size::Ratio, the delta is
interpreted as a percentage value and converted into a ratio
(i.e. 5 (percent) => Size::Ratio(0.05)).
use leftwm_layouts::Layout;
use leftwm_layouts::geometry::Size;
let mut layout = Layout::default();
layout.set_main_size(Size::Ratio(0.5));
layout.change_main_size(5, 500);
assert_eq!(Size::Ratio(0.55), layout.columns.main.unwrap().size);