fix: center and enlarge app-list icons
This commit is contained in:
parent
674e0940c5
commit
bd1f7d6064
1 changed files with 84 additions and 37 deletions
|
|
@ -139,10 +139,27 @@ impl DockItem {
|
||||||
let cosmic_icon = desktop_info
|
let cosmic_icon = desktop_info
|
||||||
.icon
|
.icon
|
||||||
.as_cosmic_icon()
|
.as_cosmic_icon()
|
||||||
.size(applet.suggested_size().0);
|
.size(applet.suggested_size().0 + 6);
|
||||||
|
|
||||||
let dot_radius = 2;
|
let dot_radius = 2;
|
||||||
let dots = (0..min(toplevels.len(), 3))
|
let dot_spacer = (0..1)
|
||||||
|
.map(|_| {
|
||||||
|
container(vertical_space(Length::Fixed(0.0)))
|
||||||
|
.padding(dot_radius)
|
||||||
|
.into()
|
||||||
|
})
|
||||||
|
.collect_vec();
|
||||||
|
|
||||||
|
let dots = if toplevels.is_empty() {
|
||||||
|
(0..1)
|
||||||
|
.map(|_| {
|
||||||
|
container(vertical_space(Length::Fixed(0.0)))
|
||||||
|
.padding(dot_radius)
|
||||||
|
.into()
|
||||||
|
})
|
||||||
|
.collect_vec()
|
||||||
|
} else {
|
||||||
|
(0..min(toplevels.len(), 3))
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
container(vertical_space(Length::Fixed(0.0)))
|
container(vertical_space(Length::Fixed(0.0)))
|
||||||
.padding(dot_radius)
|
.padding(dot_radius)
|
||||||
|
|
@ -163,29 +180,59 @@ impl DockItem {
|
||||||
)))
|
)))
|
||||||
.into()
|
.into()
|
||||||
})
|
})
|
||||||
.collect_vec();
|
.collect_vec()
|
||||||
|
};
|
||||||
|
|
||||||
let icon_wrapper: Element<_> = match applet.anchor {
|
let icon_wrapper: Element<_> = match applet.anchor {
|
||||||
PanelAnchor::Left => row(vec![column(dots).spacing(4).into(), cosmic_icon.into()])
|
PanelAnchor::Left => row(vec![
|
||||||
|
column(dots).spacing(4).into(),
|
||||||
|
cosmic_icon.into(),
|
||||||
|
column(dot_spacer).spacing(4).into(),
|
||||||
|
])
|
||||||
.align_items(iced::Alignment::Center)
|
.align_items(iced::Alignment::Center)
|
||||||
.spacing(4)
|
.spacing(1)
|
||||||
.into(),
|
.into(),
|
||||||
PanelAnchor::Right => row(vec![cosmic_icon.into(), column(dots).spacing(4).into()])
|
PanelAnchor::Right => row(vec![
|
||||||
|
column(dot_spacer).spacing(4).into(),
|
||||||
|
cosmic_icon.into(),
|
||||||
|
column(dots).spacing(4).into(),
|
||||||
|
])
|
||||||
.align_items(iced::Alignment::Center)
|
.align_items(iced::Alignment::Center)
|
||||||
.spacing(4)
|
.spacing(1)
|
||||||
.into(),
|
.into(),
|
||||||
PanelAnchor::Top => column(vec![row(dots).spacing(4).into(), cosmic_icon.into()])
|
PanelAnchor::Top => column(vec![
|
||||||
|
row(dots).spacing(4).into(),
|
||||||
|
cosmic_icon.into(),
|
||||||
|
row(dot_spacer).spacing(4).into(),
|
||||||
|
])
|
||||||
.align_items(iced::Alignment::Center)
|
.align_items(iced::Alignment::Center)
|
||||||
.spacing(4)
|
.spacing(1)
|
||||||
.into(),
|
.into(),
|
||||||
PanelAnchor::Bottom => column(vec![cosmic_icon.into(), row(dots).spacing(4).into()])
|
PanelAnchor::Bottom => column(vec![
|
||||||
|
row(dot_spacer).spacing(4).into(),
|
||||||
|
cosmic_icon.into(),
|
||||||
|
row(dots).spacing(4).into(),
|
||||||
|
])
|
||||||
.align_items(iced::Alignment::Center)
|
.align_items(iced::Alignment::Center)
|
||||||
.spacing(4)
|
.spacing(1)
|
||||||
.into(),
|
.into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let icon_button = cosmic::widget::button(icon_wrapper)
|
let icon_button = match applet.anchor {
|
||||||
|
PanelAnchor::Left => cosmic::widget::button(icon_wrapper)
|
||||||
.style(Button::Text)
|
.style(Button::Text)
|
||||||
.padding(8);
|
.padding([5, 0]),
|
||||||
|
PanelAnchor::Right => cosmic::widget::button(icon_wrapper)
|
||||||
|
.style(Button::Text)
|
||||||
|
.padding([5, 0]),
|
||||||
|
PanelAnchor::Top => cosmic::widget::button(icon_wrapper)
|
||||||
|
.style(Button::Text)
|
||||||
|
.padding([0, 5]),
|
||||||
|
PanelAnchor::Bottom => cosmic::widget::button(icon_wrapper)
|
||||||
|
.style(Button::Text)
|
||||||
|
.padding([0, 5]),
|
||||||
|
};
|
||||||
|
|
||||||
let icon_button = if interaction_enabled {
|
let icon_button = if interaction_enabled {
|
||||||
dnd_source(
|
dnd_source(
|
||||||
mouse_area(
|
mouse_area(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue