pub struct StackSet<C>where
C: Clone + PartialEq + Eq + Hash,{ /* private fields */ }
Expand description
The side-effect free internal state representation of the window manager.
Implementations§
source§impl<C> StackSet<C>where
C: Clone + PartialEq + Eq + Hash,
impl<C> StackSet<C>where C: Clone + PartialEq + Eq + Hash,
sourcepub fn try_new<I, J, T>(
layouts: LayoutStack,
ws_tags: I,
screen_details: J
) -> Result<Self>where
T: Into<String>,
I: IntoIterator<Item = T>,
J: IntoIterator<Item = Rect>,
pub fn try_new<I, J, T>( layouts: LayoutStack, ws_tags: I, screen_details: J ) -> Result<Self>where T: Into<String>, I: IntoIterator<Item = T>, J: IntoIterator<Item = Rect>,
sourcepub fn focus_screen(&mut self, screen_index: usize)
pub fn focus_screen(&mut self, screen_index: usize)
sourcepub fn focus_tag(&mut self, tag: impl AsRef<str>)
pub fn focus_tag(&mut self, tag: impl AsRef<str>)
Set focus to the Workspace with the specified tag.
If there is no matching workspace then the StackSet is unmodified. If the Workspace is currently visible then focus moves to the screen containing that workspace, otherwise the workspace replaces whatever was on the active screen.
If you always want to focus the given tag on the active screen, see StackSet::pull_tag_to_screen instead.
sourcepub fn pull_tag_to_screen(&mut self, tag: impl AsRef<str>)
pub fn pull_tag_to_screen(&mut self, tag: impl AsRef<str>)
Focus the requested tag on the current screen, swapping the current tag with it.
sourcepub fn toggle_tag(&mut self)
pub fn toggle_tag(&mut self)
Toggle focus back to the previously focused Workspace based on its tag
sourcepub fn focus_client(&mut self, client: &C)
pub fn focus_client(&mut self, client: &C)
Focus the given client and set its Workspace as current (see focus_tag).
If the client is unknown then this is a no-op.
sourcepub fn sink(&mut self, client: &C) -> Option<Rect>
pub fn sink(&mut self, client: &C) -> Option<Rect>
Clear the floating status of a client, returning its previous preferred
screen position if the client was known, otherwise None
.
sourcepub fn has_floating_windows(&self, tag: impl AsRef<str>) -> bool
pub fn has_floating_windows(&self, tag: impl AsRef<str>) -> bool
Check whether a given tag currently has any floating windows present.
Returns false if the tag given is unknown to this StackSet.
sourcepub fn remove_client(&mut self, client: &C) -> Option<C>
pub fn remove_client(&mut self, client: &C) -> Option<C>
Delete a client from this StackSet.
sourcepub fn remove_focused(&mut self) -> Option<C>
pub fn remove_focused(&mut self) -> Option<C>
Remove the currently focused client from this stack if there is one.
The client is returned to the caller as Some(C)
if there was one.
sourcepub fn kill_focused(&mut self)
pub fn kill_focused(&mut self)
Delete the currently focused client from this stack if there is one.
The following diff will send a kill client message to this client on refresh.
sourcepub fn move_focused_to_tag(&mut self, tag: impl AsRef<str>)
pub fn move_focused_to_tag(&mut self, tag: impl AsRef<str>)
Move the focused client of the current Workspace to the focused position
of the workspace matching the provided tag
.
sourcepub fn move_focused_to_screen(&mut self, screen: usize)
pub fn move_focused_to_screen(&mut self, screen: usize)
sourcepub fn move_client_to_tag(&mut self, client: &C, tag: impl AsRef<str>)
pub fn move_client_to_tag(&mut self, client: &C, tag: impl AsRef<str>)
Move the given client to the focused position of the Workspace matching
the provided tag
. If the client is already on the target workspace it is
moved to the focused position.
sourcepub fn move_client_to_current_tag(&mut self, client: &C)
pub fn move_client_to_current_tag(&mut self, client: &C)
Move the given client to the focused position of the current Workspace. If the client is already on the target workspace it is moved to the focused position.
sourcepub fn contains_tag(&self, tag: &str) -> bool
pub fn contains_tag(&self, tag: &str) -> bool
Is the given tag present in the StackSet?
sourcepub fn ordered_workspaces(&self) -> impl Iterator<Item = &Workspace<C>>
pub fn ordered_workspaces(&self) -> impl Iterator<Item = &Workspace<C>>
All Workspaces in this StackSet order by their id that have not been marked as being invisible.
sourcepub fn tag_for_screen(&self, index: usize) -> Option<&str>
pub fn tag_for_screen(&self, index: usize) -> Option<&str>
sourcepub fn tag_for_client(&self, client: &C) -> Option<&str>
pub fn tag_for_client(&self, client: &C) -> Option<&str>
Find the tag of the Workspace containing a given client. Returns Some(tag) if the client is known otherwise None.
sourcepub fn screen_for_client(&self, client: &C) -> Option<&Screen<C>>
pub fn screen_for_client(&self, client: &C) -> Option<&Screen<C>>
If the given client is currently visible on a screen return a reference to that screen, otherwise None.
sourcepub fn tag_for_workspace_id(&self, id: usize) -> Option<String>
pub fn tag_for_workspace_id(&self, id: usize) -> Option<String>
Find the tag of the Workspace with the given NetWmDesktop ID.
sourcepub fn contains(&self, client: &C) -> bool
pub fn contains(&self, client: &C) -> bool
Returns true
if the StackSet contains an element equal to the given value.
sourcepub fn current_client(&self) -> Option<&C>
pub fn current_client(&self) -> Option<&C>
Extract a reference to the focused element of the current Stack
sourcepub fn current_screen(&self) -> &Screen<C>
pub fn current_screen(&self) -> &Screen<C>
An immutable reference to the currently focused Screen
sourcepub fn current_workspace(&self) -> &Workspace<C>
pub fn current_workspace(&self) -> &Workspace<C>
An immutable reference to the current Workspace
sourcepub fn current_workspace_mut(&mut self) -> &mut Workspace<C>
pub fn current_workspace_mut(&mut self) -> &mut Workspace<C>
A mutable reference to the current Workspace
sourcepub fn current_stack(&self) -> Option<&Stack<C>>
pub fn current_stack(&self) -> Option<&Stack<C>>
An immutable reference to the current Stack if there is one
sourcepub fn current_tag(&self) -> &str
pub fn current_tag(&self) -> &str
The tag
of the current Workspace
sourcepub fn add_workspace<T>(&mut self, tag: T, layouts: LayoutStack) -> Result<()>where
T: Into<String>,
pub fn add_workspace<T>(&mut self, tag: T, layouts: LayoutStack) -> Result<()>where T: Into<String>,
sourcepub fn add_invisible_workspace<T>(&mut self, tag: T) -> Result<()>where
T: Into<String>,
pub fn add_invisible_workspace<T>(&mut self, tag: T) -> Result<()>where T: Into<String>,
Add a new invisible Workspace to this StackSet.
It will not be possible to focus this workspace on a screen but its state will be tracked and clients can be placed on it. The id assigned to this workspace will be max(workspace ids) + 1.
Errors
This function will error with NonUniqueTags
if the given tag is already present.
sourcepub fn workspace(&self, tag: &str) -> Option<&Workspace<C>>
pub fn workspace(&self, tag: &str) -> Option<&Workspace<C>>
A reference to the Workspace with a tag of tag
if there is one
sourcepub fn workspace_mut(&mut self, tag: &str) -> Option<&mut Workspace<C>>
pub fn workspace_mut(&mut self, tag: &str) -> Option<&mut Workspace<C>>
A mutable reference to the Workspace with a tag of tag
if there is one
sourcepub fn next_layout(&mut self)
pub fn next_layout(&mut self)
sourcepub fn previous_layout(&mut self)
pub fn previous_layout(&mut self)
sourcepub fn set_layout_by_name(&mut self, layout: impl AsRef<str>)
pub fn set_layout_by_name(&mut self, layout: impl AsRef<str>)
Attempt to set the current Layout by name.
This is a no-op if the requested layout is already active or if no layout with the given name is available for the active workspace.
sourcepub fn next_screen(&mut self)
pub fn next_screen(&mut self)
Move focus to the next Screen
sourcepub fn previous_screen(&mut self)
pub fn previous_screen(&mut self)
Move focus to the previous Screen
sourcepub fn drag_workspace_forward(&mut self)
pub fn drag_workspace_forward(&mut self)
Drag the focused workspace onto the next Screen, holding focus
sourcepub fn drag_workspace_backward(&mut self)
pub fn drag_workspace_backward(&mut self)
Drag the focused workspace onto the previous Screen, holding focus
sourcepub fn modify_occupied<F>(&mut self, f: F)where
F: FnOnce(Stack<C>) -> Stack<C>,
pub fn modify_occupied<F>(&mut self, f: F)where F: FnOnce(Stack<C>) -> Stack<C>,
Apply a function to modify the current Stack if it is non-empty without allowing for emptying it entirely.
sourcepub fn screens_mut(&mut self) -> impl Iterator<Item = &mut Screen<C>>
pub fn screens_mut(&mut self) -> impl Iterator<Item = &mut Screen<C>>
sourcepub fn workspaces(&self) -> impl Iterator<Item = &Workspace<C>>
pub fn workspaces(&self) -> impl Iterator<Item = &Workspace<C>>
sourcepub fn workspaces_mut(&mut self) -> impl Iterator<Item = &mut Workspace<C>>
pub fn workspaces_mut(&mut self) -> impl Iterator<Item = &mut Workspace<C>>
sourcepub fn on_screen_workspaces(&self) -> impl Iterator<Item = &Workspace<C>>
pub fn on_screen_workspaces(&self) -> impl Iterator<Item = &Workspace<C>>
Iterate over the Workspace currently displayed on a screen in an arbitrary order.
sourcepub fn clients(&self) -> impl Iterator<Item = &C>
pub fn clients(&self) -> impl Iterator<Item = &C>
Iterate over each client in this StackSet in an arbitrary order.
sourcepub fn on_screen_workspace_clients(&self) -> impl Iterator<Item = &C>
pub fn on_screen_workspace_clients(&self) -> impl Iterator<Item = &C>
Iterate over clients present in on-screen Workspaces.
NOTE: this does not mean that every client returned by this iterator is visible on the screen: only that it is currently assigned to a workspace that is displayed on a screen.
Iterate over clients from workspaces not currently mapped to a screen.
source§impl StackSet<Xid>
impl StackSet<Xid>
sourcepub fn float(&mut self, client: Xid, r: Rect) -> Result<()>
pub fn float(&mut self, client: Xid, r: Rect) -> Result<()>
Record a known client as floating, giving its preferred screen position.
Errors
This method with return Error::UnknownClient if the given client is not already managed in this stack_set.
This method with return Error::ClientIsNotVisible if the given client is not currently mapped to a screen. This is required to determine the correct relative positioning for the floating client as is it is moved between screens.
source§impl<C> StackSet<C>where
C: Clone + PartialEq + Eq + Hash,
impl<C> StackSet<C>where C: Clone + PartialEq + Eq + Hash,
sourcepub fn focus_up(&mut self)
pub fn focus_up(&mut self)
Move focus from the current element up the Stack, wrapping to the bottom if focus is already at the top. This is a no-op if the current stack is empty.
sourcepub fn focus_down(&mut self)
pub fn focus_down(&mut self)
Move focus from the current element down the Stack, wrapping to the top if focus is already at the bottom. This is a no-op if the current stack is empty.
sourcepub fn swap_up(&mut self)
pub fn swap_up(&mut self)
Swap the position of the focused element with one above it. The currently focused element is maintained by this operation. This is a no-op if the current stack is empty.
sourcepub fn swap_down(&mut self)
pub fn swap_down(&mut self)
Swap the position of the focused element with one below it. The currently focused element is maintained by this operation. This is a no-op if the current stack is empty.
sourcepub fn rotate_up(&mut self)
pub fn rotate_up(&mut self)
Rotate all elements of the stack forward, wrapping from top to bottom. The currently focused position in the stack is maintained by this operation. This is a no-op if the current stack is empty.
sourcepub fn rotate_down(&mut self)
pub fn rotate_down(&mut self)
Rotate all elements of the stack back, wrapping from bottom to top. The currently focused position in the stack is maintained by this operation. This is a no-op if the current stack is empty.
sourcepub fn rotate_focus_to_head(&mut self)
pub fn rotate_focus_to_head(&mut self)
Rotate the Stack until the current focused element is in the head position. This is a no-op if the current stack is empty.
sourcepub fn focus_head(&mut self)
pub fn focus_head(&mut self)
Move focus to the element in the head position. This is a no-op if the current stack is empty.
sourcepub fn swap_focus_and_head(&mut self)
pub fn swap_focus_and_head(&mut self)
Swap the current head element with the focused element in the stack order. Focus stays with the original focused element. This is a no-op if the current stack is empty.