From 347f2a706057c0d00bb2e82245329e76daefe95b Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Tue, 3 Jan 2023 12:38:02 -0800 Subject: [PATCH] Fill space proportionally --- src/main.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index f949872..8a37aff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -249,7 +249,7 @@ fn layer_surface<'a>(app: &'a App, surface: &'a LayerSurface) -> cosmic::Element app.toplevels .iter() .filter(|i| i.info.workspace == surface.active_workspace) - ), // XXX + ), ] .height(iced::Length::Fill) .width(iced::Length::Fill) @@ -266,15 +266,17 @@ fn workspace_sidebar_entry(workspace: &Workspace) -> cosmic::Element { .on_press(Msg::ActivateWorkspace(workspace.handle.clone())), widget::text(&workspace.name) ] - .height(iced::Length::Fill) - //.width(iced::Length::Fill) .into() } fn workspaces_sidebar<'a>( workspaces: impl Iterator, ) -> cosmic::Element<'a, Msg> { - widget::column(workspaces.map(workspace_sidebar_entry).collect()).into() + widget::column(workspaces.map(workspace_sidebar_entry).collect()) + .width(iced::Length::Fill) + .height(iced::Length::Fill) + .into() + // New workspace } @@ -285,15 +287,16 @@ fn toplevel_preview<'a>(toplevel: &'a Toplevel) -> cosmic::Element<'a, Msg> { widget::button(widget::Image::new(toplevel.img.clone().unwrap_or_else( || widget::image::Handle::from_pixels(0, 0, vec![0, 0, 0, 255]), ))) - .height(iced::Length::Fill) - //.width(iced::Length::Fill) .into() } fn toplevel_previews<'a>( toplevels: impl Iterator, ) -> cosmic::Element<'a, Msg> { - widget::row(toplevels.map(toplevel_preview).collect()).into() + widget::row(toplevels.map(toplevel_preview).collect()) + .width(iced::Length::FillPortion(4)) + .height(iced::Length::Fill) + .into() } pub fn main() -> iced::Result {