[−][src]Struct penrose::core::workspace::Workspace
A Workspace represents a named set of clients that are tiled according to a specific layout. Layout properties are tracked per workspace and clients are referenced by ID. Workspaces are independant of monitors and can be moved between monitors freely, bringing their clients with them.
The parent WindowManager struct tracks which client is focused from the point of view of the X server by checking focus at the Workspace level whenever a new Workspace becomes active.
Implementations
impl Workspace
[src]
pub fn new(name: impl Into<String>, layouts: Vec<Layout>) -> Self
[src]
Construct a new Workspace with the given name and choice of layouts
pub fn name(&self) -> &str
[src]
The name of this workspace
pub fn len(&self) -> usize
[src]
The number of clients currently on this workspace
pub fn is_empty(&self) -> bool
[src]
Is this Workspace currently empty?
pub fn iter(&self) -> Iter<'_, WinId>
[src]
Iterate over the clients on this workspace in position order
Example
let ids: Vec<WinId> = workspace.iter().map(|id| *id).collect(); assert_eq!(ids, vec![0, 1, 2, 3, 4]);
pub fn client_ids(&self) -> Vec<WinId>
[src]
The ordered list of Client IDs currently contained in this workspace
Example
assert_eq!(workspace.client_ids(), vec![0, 1, 2, 3, 4]);
pub fn focused_client(&self) -> Option<WinId>
[src]
A reference to the currently focused client if there is one
Example
assert_eq!(workspace.focused_client(), Some(0)); workspace.focus_client(2); assert_eq!(workspace.focused_client(), Some(2));
pub fn add_client(&mut self, id: WinId, ip: &InsertPoint) -> Result<()>
[src]
Add a new client to this workspace at the top of the stack and focus it
Example
assert_eq!(workspace.client_ids(), vec![0]); workspace.add_client(1, &InsertPoint::Last)?; assert_eq!(workspace.client_ids(), vec![0, 1]); workspace.add_client(2, &InsertPoint::First)?; assert_eq!(workspace.client_ids(), vec![2, 0, 1]);
pub fn focus_client(&mut self, id: WinId) -> Option<WinId>
[src]
Focus the client with the given id, returns an option of the previously focused client if there was one
Example
assert_eq!(workspace.focused_client(), Some(0)); assert_eq!(workspace.focus_client(3), Some(0)); assert_eq!(workspace.focused_client(), Some(3));
pub fn remove_client(&mut self, id: WinId) -> Option<WinId>
[src]
Remove a target client, retaining focus at the same position in the stack. Returns the removed client if there was one to remove.
Example
assert_eq!(workspace.client_ids(), vec![0, 1, 2, 3, 4]); assert_eq!(workspace.remove_client(2), Some(2)); assert_eq!(workspace.client_ids(), vec![0, 1, 3, 4]); assert_eq!(workspace.remove_client(42), None); assert_eq!(workspace.client_ids(), vec![0, 1, 3, 4]);
pub fn remove_focused_client(&mut self) -> Option<WinId>
[src]
Remove the currently focused client, keeping focus at the same position in the stack. Returns the removed client if there was one to remove.
Example
assert_eq!(workspace.client_ids(), vec![0, 1]); assert_eq!(workspace.focused_client(), Some(0)); assert_eq!(workspace.remove_focused_client(), Some(0)); assert_eq!(workspace.remove_focused_client(), Some(1)); assert_eq!(workspace.remove_focused_client(), None); assert_eq!(workspace.client_ids(), vec![]);
pub fn try_set_layout(&mut self, symbol: &str) -> Option<&Layout>
[src]
Set the active layout by symbol name if it is available. Returns a reference to active layout if it was able to be set.
Example
assert_eq!(workspace.layout_symbol(), "first"); assert!(workspace.try_set_layout("second").is_some()); assert_eq!(workspace.layout_symbol(), "second"); assert!(workspace.try_set_layout("invalid").is_none()); assert_eq!(workspace.layout_symbol(), "second");
pub fn cycle_layout(&mut self, direction: Direction) -> &str
[src]
Cycle through the available layouts on this workspace
Example
assert_eq!(workspace.layout_symbol(), "first"); assert_eq!(workspace.cycle_layout(Forward), "second"); assert_eq!(workspace.cycle_layout(Forward), "first");
pub fn layout_symbol(&self) -> &str
[src]
The symbol of the currently used layout (passed on creation)
Example
assert_eq!(workspace.layout_symbol(), "first");
pub fn layout_conf(&self) -> LayoutConf
[src]
The LayoutConf of the currently active Layout. Used by the WindowManager to determine when and how the layout function should be applied.
Example
assert_eq!(workspace.layout_conf(), LayoutConf::default());
pub fn cycle_client(&mut self, direction: Direction) -> Option<(WinId, WinId)>
[src]
Cycle focus through the clients on this workspace, returning the previous and new focused client ids.
Example
assert_eq!(workspace.client_ids(), vec![0, 1, 2]); assert_eq!(workspace.focused_client(), Some(0)); assert_eq!(workspace.cycle_client(Forward), Some((0, 1))); assert_eq!(workspace.cycle_client(Forward), Some((1, 2))); assert_eq!(workspace.cycle_client(Forward), Some((2, 0)));
pub fn drag_client(&mut self, direction: Direction) -> Option<WinId>
[src]
Drag the focused client through the stack, retaining focus
Example
assert_eq!(workspace.client_ids(), vec![0, 1, 2]); assert_eq!(workspace.focused_client(), Some(0)); assert_eq!(workspace.drag_client(Forward), Some(0)); assert_eq!(workspace.client_ids(), vec![1, 0, 2]); assert_eq!(workspace.focused_client(), Some(0));
pub fn rotate_clients(&mut self, direction: Direction)
[src]
Rotate the client stack in the given direction
Example
assert_eq!(workspace.client_ids(), vec![0, 1, 2, 3]); assert_eq!(workspace.focused_client(), Some(0)); workspace.rotate_clients(Forward); assert_eq!(workspace.client_ids(), vec![3, 0, 1, 2]); assert_eq!(workspace.focused_client(), Some(3)); workspace.rotate_clients(Forward); assert_eq!(workspace.client_ids(), vec![2, 3, 0, 1]); assert_eq!(workspace.focused_client(), Some(2));
pub fn update_max_main(&mut self, change: Change)
[src]
Increase or decrease the number of possible clients in the main area of the current Layout
pub fn update_main_ratio(&mut self, change: Change, step: f32)
[src]
Increase or decrease the size of the main area for the current Layout
Trait Implementations
impl Clone for Workspace
[src]
impl Debug for Workspace
[src]
impl PartialEq<Workspace> for Workspace
[src]
impl StructuralPartialEq for Workspace
[src]
Auto Trait Implementations
impl RefUnwindSafe for Workspace
[src]
impl Send for Workspace
[src]
impl Sync for Workspace
[src]
impl Unpin for Workspace
[src]
impl UnwindSafe for Workspace
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,