status-area: Send opened/closed dbus menu events
This commit is contained in:
parent
a5dfc883b8
commit
1eaccc0f24
2 changed files with 16 additions and 6 deletions
|
|
@ -150,11 +150,11 @@ impl cosmic::Application for App {
|
|||
None
|
||||
};
|
||||
if self.open_menu.is_some() {
|
||||
self.menus[&id].about_to_show();
|
||||
self.menus[&id].opened();
|
||||
|
||||
let mut cmds = Vec::new();
|
||||
if let Some(id) = self.popup.take() {
|
||||
cmds.push(destroy_popup(id));
|
||||
if let Some(popup_id) = self.popup.take() {
|
||||
cmds.push(destroy_popup(popup_id));
|
||||
}
|
||||
let popup_id = self.next_popup_id();
|
||||
let mut popup_settings = self.core.applet.get_popup_settings(
|
||||
|
|
@ -180,8 +180,10 @@ impl cosmic::Application for App {
|
|||
}
|
||||
cmds.push(get_popup(popup_settings));
|
||||
return Command::batch(cmds);
|
||||
} else if let Some(id) = self.popup {
|
||||
return destroy_popup(id);
|
||||
} else if let Some(popup_id) = self.popup {
|
||||
self.menus[&id].closed();
|
||||
|
||||
return destroy_popup(popup_id);
|
||||
}
|
||||
Command::none()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,12 +84,20 @@ impl State {
|
|||
self.item.layout_subscription().map(Msg::Layout)
|
||||
}
|
||||
|
||||
pub fn about_to_show(&self) {
|
||||
pub fn opened(&self) {
|
||||
let menu_proxy = self.item.menu_proxy().clone();
|
||||
tokio::spawn(async move {
|
||||
let _ = menu_proxy.event(0, "opened", &0i32.into(), 0).await;
|
||||
let _ = menu_proxy.about_to_show(0).await;
|
||||
});
|
||||
}
|
||||
|
||||
pub fn closed(&self) {
|
||||
let menu_proxy = self.item.menu_proxy().clone();
|
||||
tokio::spawn(async move {
|
||||
let _ = menu_proxy.event(0, "closed", &0i32.into(), 0).await;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn layout_view(layout: &Layout, expanded: Option<i32>) -> cosmic::Element<Msg> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue