status-area: Show icons that have icon_pixmap but not icon_name (#302)

This is at least one of the issue behind
https://github.com/pop-os/cosmic-applets/issues/165. OBS now shows it's
icon instead of an empty space. But the Mattermost flatpak doesn't show
anything. (Is that Flatpak related, or does it not use
`StatusNotifierItem`?)

Requires https://github.com/pop-os/libcosmic/pull/368. Ideally, it
should have some way to choose from multiple icons in memory of
different sizes.
This commit is contained in:
Ian Douglas Scott 2024-03-27 13:33:37 -07:00 committed by GitHub
parent 8128b6cf89
commit 180e75cb9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 61 additions and 24 deletions

View file

@ -174,11 +174,14 @@ impl cosmic::Application for App {
fn view(&self) -> cosmic::Element<'_, Msg> {
// XXX connect open event
iced::widget::row(self.menus.iter().map(|(id, menu)| {
self.core
.applet
.icon_button(menu.icon_name())
.on_press(Msg::TogglePopup(*id))
.into()
match menu.icon_pixmap() {
Some(icon) if menu.icon_name() == "" => {
self.core.applet.icon_button_from_handle(icon.clone())
}
_ => self.core.applet.icon_button(menu.icon_name()),
}
.on_press(Msg::TogglePopup(*id))
.into()
}))
.into()
}