feat: enable limiting applications to a single instance

This commit is contained in:
Ashley Wulber 2023-10-26 10:26:32 -04:00
parent 7b2b8952c6
commit 9da2501f28
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
5 changed files with 178 additions and 2 deletions

View file

@ -150,6 +150,13 @@ where
None
});
let single_instance = self
.app
.core()
.single_instance
.then(|| super::single_instance_subscription::<T>())
.map_or_else(Subscription::none, |s| s.map(super::Message::App));
Subscription::batch(vec![
self.app.subscription().map(super::Message::App),
keyboard_nav::subscription()
@ -174,6 +181,7 @@ where
})
.map(super::Message::Cosmic),
window_events.map(super::Message::Cosmic),
single_instance,
])
}