Improve handling of horizontal orientation
This commit is contained in:
parent
899dfb0a3d
commit
79584a6d93
1 changed files with 27 additions and 19 deletions
|
|
@ -50,6 +50,7 @@ pub(crate) fn layer_surface<'a>(
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
&surface.output,
|
&surface.output,
|
||||||
|
layout,
|
||||||
);
|
);
|
||||||
let container = match layout {
|
let container = match layout {
|
||||||
WorkspaceLayout::Vertical => widget::cosmic_container::container(
|
WorkspaceLayout::Vertical => widget::cosmic_container::container(
|
||||||
|
|
@ -61,7 +62,8 @@ pub(crate) fn layer_surface<'a>(
|
||||||
WorkspaceLayout::Horizontal => widget::cosmic_container::container(
|
WorkspaceLayout::Horizontal => widget::cosmic_container::container(
|
||||||
column![sidebar, toplevels]
|
column![sidebar, toplevels]
|
||||||
.spacing(12)
|
.spacing(12)
|
||||||
.height(iced::Length::Fill),
|
.height(iced::Length::Fill)
|
||||||
|
.width(iced::Length::Fill),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
crate::widgets::image_bg(container).into()
|
crate::widgets::image_bg(container).into()
|
||||||
|
|
@ -173,22 +175,23 @@ fn workspaces_sidebar<'a>(
|
||||||
} else {
|
} else {
|
||||||
sidebar_entries_container.into()
|
sidebar_entries_container.into()
|
||||||
};
|
};
|
||||||
widget::container(
|
// Shrink?
|
||||||
widget::container(bar)
|
let (width, height) = match layout {
|
||||||
.width(iced::Length::Fill)
|
WorkspaceLayout::Vertical => (iced::Length::Fill, iced::Length::Shrink),
|
||||||
//.height(iced::Length::Fill)
|
WorkspaceLayout::Horizontal => (iced::Length::Shrink, iced::Length::Fill),
|
||||||
.style(cosmic::theme::Container::custom(|theme| {
|
};
|
||||||
cosmic::iced_style::container::Appearance {
|
widget::container(widget::container(bar).width(width).height(height).style(
|
||||||
text_color: Some(theme.cosmic().on_bg_color().into()),
|
cosmic::theme::Container::custom(|theme| cosmic::iced_style::container::Appearance {
|
||||||
icon_color: Some(theme.cosmic().on_bg_color().into()),
|
text_color: Some(theme.cosmic().on_bg_color().into()),
|
||||||
background: Some(iced::Color::from(theme.cosmic().background.base).into()),
|
icon_color: Some(theme.cosmic().on_bg_color().into()),
|
||||||
border_radius: (12.0).into(),
|
background: Some(iced::Color::from(theme.cosmic().background.base).into()),
|
||||||
border_width: 0.0,
|
border_radius: (12.0).into(),
|
||||||
border_color: iced::Color::TRANSPARENT,
|
border_width: 0.0,
|
||||||
}
|
border_color: iced::Color::TRANSPARENT,
|
||||||
})),
|
}),
|
||||||
)
|
))
|
||||||
.width(iced::Length::Fill)
|
.width(width)
|
||||||
|
.height(height)
|
||||||
.padding(24.0)
|
.padding(24.0)
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
@ -242,12 +245,17 @@ fn toplevel_previews_entry<'a>(
|
||||||
fn toplevel_previews<'a>(
|
fn toplevel_previews<'a>(
|
||||||
toplevels: impl Iterator<Item = &'a Toplevel>,
|
toplevels: impl Iterator<Item = &'a Toplevel>,
|
||||||
output: &'a wl_output::WlOutput,
|
output: &'a wl_output::WlOutput,
|
||||||
|
layout: WorkspaceLayout,
|
||||||
) -> cosmic::Element<'a, Msg> {
|
) -> cosmic::Element<'a, Msg> {
|
||||||
|
let (width, height) = match layout {
|
||||||
|
WorkspaceLayout::Vertical => (iced::Length::FillPortion(4), iced::Length::Fill),
|
||||||
|
WorkspaceLayout::Horizontal => (iced::Length::Fill, iced::Length::FillPortion(4)),
|
||||||
|
};
|
||||||
row(toplevels
|
row(toplevels
|
||||||
.map(|t| toplevel_previews_entry(t, output))
|
.map(|t| toplevel_previews_entry(t, output))
|
||||||
.collect())
|
.collect())
|
||||||
.width(iced::Length::FillPortion(4))
|
.width(width)
|
||||||
.height(iced::Length::Fill)
|
.height(height)
|
||||||
.spacing(16)
|
.spacing(16)
|
||||||
.padding(12)
|
.padding(12)
|
||||||
.align_items(iced::Alignment::Center)
|
.align_items(iced::Alignment::Center)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue