1
0
Fork 0
forked from wry/wry

seperate workspaces by monitor

This commit is contained in:
kossLAN 2026-05-16 18:34:20 -04:00
parent c555593ae2
commit a29937ebe8
No known key found for this signature in database
5 changed files with 44 additions and 20 deletions

View file

@ -677,7 +677,7 @@ impl OutputNode {
let name = 'name: {
for i in 1.. {
let name = i.to_string();
if !self.state.workspaces.contains(&name) {
if self.find_workspace(&name).is_none() {
break 'name name;
}
}
@ -686,6 +686,13 @@ impl OutputNode {
self.create_workspace(&name)
}
pub fn find_workspace(&self, name: &str) -> Option<Rc<WorkspaceNode>> {
self.workspaces
.iter()
.find(|ws| ws.name.as_str() == name)
.map(|ws| (*ws).clone())
}
pub fn show_workspace(&self, ws: &Rc<WorkspaceNode>) -> bool {
let mut seats = SmallVec::new();
if let Some(old) = self.workspace.set(Some(ws.clone())) {
@ -705,7 +712,7 @@ impl OutputNode {
wh.handle_destroyed();
}
old.clear();
self.state.workspaces.remove(&old.name);
self.state.workspaces.remove(&old.id);
} else {
old.set_visible(false);
old.flush_jay_workspaces();
@ -747,7 +754,7 @@ impl OutputNode {
self.workspaces.add_last(ws.clone())
};
*ws.output_link.borrow_mut() = Some(link);
self.state.workspaces.set(name.to_string(), ws.clone());
self.state.workspaces.set(ws.id, ws.clone());
if self.workspace.is_none() {
self.show_workspace(&ws);
}