design: vertical app-list multi-window pop-up
This commit is contained in:
parent
e12c91b2cb
commit
2f1b20e1c7
1 changed files with 62 additions and 25 deletions
|
|
@ -685,11 +685,27 @@ impl cosmic::Application for CosmicAppList {
|
||||||
width: width as i32,
|
width: width as i32,
|
||||||
height: height as i32,
|
height: height as i32,
|
||||||
};
|
};
|
||||||
popup_settings.positioner.size_limits = Limits::NONE
|
let max_windows = 7.0;
|
||||||
.max_width(56.0 + (TOPLEVEL_BUTTON_WIDTH + 12.0) * 7.0)
|
let window_spacing = 8.0;
|
||||||
.min_width(30.0)
|
popup_settings.positioner.size_limits = match self.core.applet.anchor {
|
||||||
.min_height(100.0)
|
PanelAnchor::Right | PanelAnchor::Left => Limits::NONE
|
||||||
.max_height(16.0 + TOPLEVEL_BUTTON_HEIGHT);
|
.min_width(100.0)
|
||||||
|
.min_height(30.0)
|
||||||
|
.max_width(window_spacing * 2.0 + TOPLEVEL_BUTTON_WIDTH)
|
||||||
|
.max_height(
|
||||||
|
TOPLEVEL_BUTTON_HEIGHT * max_windows
|
||||||
|
+ window_spacing * (max_windows + 1.0),
|
||||||
|
),
|
||||||
|
PanelAnchor::Bottom | PanelAnchor::Top => Limits::NONE
|
||||||
|
.min_width(30.0)
|
||||||
|
.min_height(100.0)
|
||||||
|
.max_width(
|
||||||
|
TOPLEVEL_BUTTON_WIDTH * max_windows
|
||||||
|
+ window_spacing * (max_windows + 1.0),
|
||||||
|
)
|
||||||
|
.max_height(window_spacing * 2.0 + TOPLEVEL_BUTTON_HEIGHT),
|
||||||
|
};
|
||||||
|
|
||||||
return get_popup(popup_settings);
|
return get_popup(popup_settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1421,27 +1437,48 @@ impl cosmic::Application for CosmicAppList {
|
||||||
};
|
};
|
||||||
self.core.applet.popup_container(content).into()
|
self.core.applet.popup_container(content).into()
|
||||||
}
|
}
|
||||||
PopupType::TopLevelList => {
|
PopupType::TopLevelList => match self.core.applet.anchor {
|
||||||
let mut content = row![]
|
PanelAnchor::Left | PanelAnchor::Right => {
|
||||||
.padding([8, 12])
|
let mut content = column![]
|
||||||
.align_items(Alignment::Center)
|
.padding(8)
|
||||||
.spacing(12);
|
.align_items(Alignment::Center)
|
||||||
for (handle, info, img) in toplevels {
|
.spacing(8);
|
||||||
let title = if info.title.len() > 26 {
|
for (handle, info, img) in toplevels {
|
||||||
format!("{:.23}...", &info.title)
|
let title = if info.title.len() > 26 {
|
||||||
} else {
|
format!("{:.23}...", &info.title)
|
||||||
info.title.clone()
|
} else {
|
||||||
};
|
info.title.clone()
|
||||||
content = content.push(toplevel_button(
|
};
|
||||||
img.clone(),
|
content = content.push(toplevel_button(
|
||||||
&desktop_info.icon,
|
img.clone(),
|
||||||
Message::Toggle(handle.clone()),
|
&desktop_info.icon,
|
||||||
title,
|
Message::Toggle(handle.clone()),
|
||||||
10.0,
|
title,
|
||||||
));
|
10.0,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
self.core.applet.popup_container(content).into()
|
||||||
}
|
}
|
||||||
self.core.applet.popup_container(content).into()
|
PanelAnchor::Bottom | PanelAnchor::Top => {
|
||||||
}
|
let mut content =
|
||||||
|
row![].padding(8).align_items(Alignment::Center).spacing(8);
|
||||||
|
for (handle, info, img) in toplevels {
|
||||||
|
let title = if info.title.len() > 26 {
|
||||||
|
format!("{:.23}...", &info.title)
|
||||||
|
} else {
|
||||||
|
info.title.clone()
|
||||||
|
};
|
||||||
|
content = content.push(toplevel_button(
|
||||||
|
img.clone(),
|
||||||
|
&desktop_info.icon,
|
||||||
|
Message::Toggle(handle.clone()),
|
||||||
|
title,
|
||||||
|
10.0,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
self.core.applet.popup_container(content).into()
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let suggested = self.core.applet.suggested_size();
|
let suggested = self.core.applet.suggested_size();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue