wip: update libcosmic (#93)
* wip: update libcosmic * fix: damge issue resolved by updating iced * fix: high cpu usage by time applet and app-list * refactor subscriptions to produce fewer events * refactor network applet to use less cpu * fix: text size * refactor: i18n for audio applet * refactor: power applet i18n setup * fix (battery): always send profile update * fix (battery): set toggler width to layout correctly * fix (app-list): backoff for restarts of toplevel subscription * fix (network): alignment * feat: ask for comfirmation before applying power applet actions * wip: integrate cosmic-config * update zbus * feat: update to use latest libcosmic * update iced * udpate deps * update deps * refactor: move applet helpers to this repo, outside of libcosmic. this should help alleviate some dependency hell * chore update deps * update deps * cleanup
This commit is contained in:
parent
8b46cc209f
commit
9ebd9b511a
48 changed files with 2841 additions and 1681 deletions
|
|
@ -8,6 +8,7 @@ use iced::subscription;
|
|||
use std::{fmt::Debug, hash::Hash};
|
||||
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
|
||||
use zbus::dbus_proxy;
|
||||
|
||||
#[dbus_proxy(
|
||||
default_service = "org.freedesktop.UPower",
|
||||
interface = "org.freedesktop.UPower.KbdBacklight",
|
||||
|
|
@ -35,7 +36,20 @@ trait KbdBacklight {
|
|||
pub fn kbd_backlight_subscription<I: 'static + Hash + Copy + Send + Sync + Debug>(
|
||||
id: I,
|
||||
) -> iced::Subscription<(I, KeyboardBacklightUpdate)> {
|
||||
subscription::unfold(id, State::Ready, move |state| start_listening(id, state))
|
||||
subscription::unfold(id, State::Ready, move |state| start_listening_loop(id, state))
|
||||
}
|
||||
|
||||
async fn start_listening_loop<I: Copy + Debug>(
|
||||
id: I,
|
||||
mut state: State,
|
||||
) -> ((I, KeyboardBacklightUpdate), State) {
|
||||
loop {
|
||||
let (update, new_state) = start_listening(id, state).await;
|
||||
state = new_state;
|
||||
if let Some(update) = update {
|
||||
return (update, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue