feat: Workspace view closing by pressing current workspace or empty space

This commit is contained in:
Adam Cosner 2025-01-23 20:02:16 -08:00 committed by Ian Douglas Scott
parent e032b0b5ee
commit fd0bdeebbf
2 changed files with 16 additions and 8 deletions

View file

@ -505,6 +505,11 @@ impl Application for App {
return self.hide();
}
Msg::ActivateWorkspace(workspace_handle) => {
if let Some(workspace) = self.workspace_for_handle(&workspace_handle) {
if workspace.is_active {
return self.hide();
}
}
self.send_wayland_cmd(backend::Cmd::ActivateWorkspace(workspace_handle));
}
Msg::ActivateToplevel(toplevel_handle) => {

View file

@ -359,14 +359,17 @@ fn toplevel_previews<'a>(
.map(|t| toplevel_previews_entry(t, output, drag_toplevel == Some(&t.handle)))
.collect();
//row(entries)
widget::container(crate::widgets::toplevels(entries))
.align_x(iced::alignment::Horizontal::Center)
.width(width)
.height(height)
//.spacing(16)
.padding(12)
//.align_items(iced::Alignment::Center)
.into()
widget::mouse_area(
widget::container(crate::widgets::toplevels(entries))
.align_x(iced::alignment::Horizontal::Center)
.width(width)
.height(height)
//.spacing(16)
.padding(12),
)
.on_press(Msg::Close)
//.align_items(iced::Alignment::Center)
.into()
}
fn bg_element<'a>(