chore: updates after iced rebase

This commit is contained in:
Ashley Wulber 2026-03-03 13:53:45 -05:00 committed by Ashley Wulber
parent 45e01aa6e6
commit d4becdd6c5
15 changed files with 1329 additions and 1118 deletions

View file

@ -1,4 +1,5 @@
use cosmic::iced::{self, futures::StreamExt};
use std::{any::TypeId, hash::Hash};
use tokio::sync::broadcast;
use tokio_stream::wrappers::BroadcastStream;
@ -65,9 +66,23 @@ impl Interface {
}
pub fn subscription(&self) -> iced::Subscription<Event> {
iced::Subscription::run_with_id(
"workspaces-dbus-sun",
BroadcastStream::new(self.event_sender.subscribe()).filter_map(|x| async { x.ok() }),
#[derive(Clone)]
struct Wrapper {
event_sender: broadcast::Sender<Event>,
}
impl Hash for Wrapper {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
TypeId::of::<Wrapper>().hash(state);
}
}
iced::Subscription::run_with(
Wrapper {
event_sender: self.event_sender.clone(),
},
|Wrapper { event_sender }| {
BroadcastStream::new(event_sender.subscribe()).filter_map(|x| async { x.ok() })
},
)
}
}