diff options
| author | rustn00b <83183600+rustn00b@users.noreply.github.com> | 2025-01-10 06:03:19 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-10 06:03:19 +0000 |
| commit | 5958d3be62b3abe21613567af28beb4d7d118205 (patch) | |
| tree | 1d270b02f5c807c527c8ca236fa7494181612610 /src/layout/monitor.rs | |
| parent | 142e57450dae5eba25b7f306d3c6dc9f51518a3d (diff) | |
| download | niri-5958d3be62b3abe21613567af28beb4d7d118205.tar.gz niri-5958d3be62b3abe21613567af28beb4d7d118205.tar.bz2 niri-5958d3be62b3abe21613567af28beb4d7d118205.zip | |
Allow workspace names to be changed dynamically (#904)
* Add un/set workspace name actions
* Add SetWorkspaceName reference to proptests
* Simplify unname_workspace
* Add ewaf version of set first workspace name test
* Simplify more
* Fix comment
* Make workspace in set-workspace-name a positional option
---------
Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Diffstat (limited to 'src/layout/monitor.rs')
| -rw-r--r-- | src/layout/monitor.rs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs index 57ca7f53..70009d67 100644 --- a/src/layout/monitor.rs +++ b/src/layout/monitor.rs @@ -382,18 +382,13 @@ impl<W: LayoutElement> Monitor<W> { } } - pub fn unname_workspace(&mut self, workspace_name: &str) -> bool { - for ws in &mut self.workspaces { - if ws - .name - .as_ref() - .map_or(false, |name| name.eq_ignore_ascii_case(workspace_name)) - { - ws.unname(); - return true; - } - } - false + pub fn unname_workspace(&mut self, id: WorkspaceId) -> bool { + let Some(ws) = self.workspaces.iter_mut().find(|ws| ws.id() == id) else { + return false; + }; + + ws.unname(); + true } pub fn move_left(&mut self) -> bool { |
