dbus: Add methods to show or hide

This commit is contained in:
Ian Douglas Scott 2025-09-22 11:49:06 -07:00 committed by Ian Douglas Scott
parent c9a69bdfdb
commit b8780b9911
4 changed files with 66 additions and 4 deletions

View file

@ -116,6 +116,7 @@ enum Msg {
TogglePinned(ExtWorkspaceHandleV1),
EnteredWorkspaceSidebarEntry(ExtWorkspaceHandleV1, bool),
DbusInterface(zbus::Result<dbus::Interface>),
DBus(dbus::Event),
Ignore,
}
@ -728,6 +729,12 @@ impl Application for App {
self.dbus_interface = Some(interface);
}
}
Msg::DBus(evt) => {
return match evt {
dbus::Event::Show => self.show(),
dbus::Event::Hide => self.hide(),
};
}
Msg::Ignore => {}
}
@ -812,6 +819,9 @@ impl Application for App {
if let Some(conn) = self.conn.clone() {
subscriptions.push(backend::subscription(conn).map(Msg::Wayland));
}
if let Some(interface) = &self.dbus_interface {
subscriptions.push(interface.subscription().map(Msg::DBus));
}
iced::Subscription::batch(subscriptions)
}