Add workspaces_for_output helper function
This commit is contained in:
parent
88b35e3027
commit
ba52d69421
2 changed files with 13 additions and 6 deletions
10
src/main.rs
10
src/main.rs
|
|
@ -167,6 +167,16 @@ impl App {
|
||||||
self.workspaces.iter_mut().find(|i| &i.handle == handle)
|
self.workspaces.iter_mut().find(|i| &i.handle == handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO iterate in order based on `coordinates`
|
||||||
|
fn workspaces_for_output<'a>(
|
||||||
|
&'a self,
|
||||||
|
output: &'a wl_output::WlOutput,
|
||||||
|
) -> impl Iterator<Item = &Workspace> + 'a {
|
||||||
|
self.workspaces
|
||||||
|
.iter()
|
||||||
|
.filter(|w| w.outputs.contains(output))
|
||||||
|
}
|
||||||
|
|
||||||
fn toplevel_for_handle_mut(
|
fn toplevel_for_handle_mut(
|
||||||
&mut self,
|
&mut self,
|
||||||
handle: &ZcosmicToplevelHandleV1,
|
handle: &ZcosmicToplevelHandleV1,
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,7 @@ pub(crate) fn layer_surface<'a>(
|
||||||
}
|
}
|
||||||
let layout = app.conf.workspace_config.workspace_layout;
|
let layout = app.conf.workspace_config.workspace_layout;
|
||||||
let sidebar = workspaces_sidebar(
|
let sidebar = workspaces_sidebar(
|
||||||
app.workspaces
|
app.workspaces_for_output(&surface.output),
|
||||||
.iter()
|
|
||||||
.filter(|i| i.outputs.contains(&surface.output)),
|
|
||||||
&surface.output,
|
&surface.output,
|
||||||
layout,
|
layout,
|
||||||
drop_target,
|
drop_target,
|
||||||
|
|
@ -80,9 +78,8 @@ pub(crate) fn layer_surface<'a>(
|
||||||
);
|
);
|
||||||
// TODO multiple active workspaces? Not currently supported by cosmic.
|
// TODO multiple active workspaces? Not currently supported by cosmic.
|
||||||
let first_active_workspace = app
|
let first_active_workspace = app
|
||||||
.workspaces
|
.workspaces_for_output(&surface.output)
|
||||||
.iter()
|
.find(|w| w.is_active);
|
||||||
.find(|i| i.outputs.contains(&surface.output) && i.is_active);
|
|
||||||
let toplevels = if let Some(workspace) = first_active_workspace {
|
let toplevels = if let Some(workspace) = first_active_workspace {
|
||||||
toplevel_dnd_destination(
|
toplevel_dnd_destination(
|
||||||
DropTarget::OutputToplevels(workspace.handle.clone(), surface.output.clone()),
|
DropTarget::OutputToplevels(workspace.handle.clone(), surface.output.clone()),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue