chore: update dependencies
This commit is contained in:
parent
c05dad00de
commit
0de9c33822
15 changed files with 313 additions and 359 deletions
|
|
@ -12,7 +12,7 @@ ashpd = { version = "0.12", default-features = false, features = [
|
|||
"tokio",
|
||||
], optional = true }
|
||||
chrono = "0.4.42"
|
||||
clap = { version = "4.5.51", features = ["derive"] }
|
||||
clap = { version = "4.5.54", features = ["derive"] }
|
||||
color-eyre = "0.6.5"
|
||||
cosmic-bg-config.workspace = true
|
||||
cosmic-comp-config = { workspace = true, optional = true }
|
||||
|
|
@ -40,7 +40,7 @@ cosmic-settings-daemon-config = { git = "https://github.com/pop-os/cosmic-settin
|
|||
derive_setters = "0.1.8"
|
||||
dirs = "6.0.0"
|
||||
eyre = "0.6.12"
|
||||
freedesktop-desktop-entry = "0.7.19"
|
||||
freedesktop-desktop-entry = "0.8.1"
|
||||
futures = "0.3.31"
|
||||
hostname-validator = "1.1.1"
|
||||
hostname1-zbus = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
|
||||
|
|
@ -52,48 +52,51 @@ image = { version = "0.25", default-features = false, features = [
|
|||
"webp",
|
||||
"hdr",
|
||||
] }
|
||||
indexmap = "2.12.0"
|
||||
indexmap = "2.13.0"
|
||||
itertools = "0.14.0"
|
||||
itoa = "1.0.15"
|
||||
itoa = "1.0.17"
|
||||
libcosmic.workspace = true
|
||||
locale1 = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
|
||||
sysinfo = { version = "0.36.1", optional = true }
|
||||
sysinfo = { version = "0.37.2", optional = true }
|
||||
mime-apps = { package = "cosmic-mime-apps", git = "https://github.com/pop-os/cosmic-mime-apps", optional = true }
|
||||
# TODO: updating notify beyond this hangs the app
|
||||
notify = "6.1.1"
|
||||
notify = "8.2.0"
|
||||
regex = "1.12.2"
|
||||
ron = "0.11"
|
||||
ron = "0.12"
|
||||
rust-embed = "8.9.0"
|
||||
sctk = { workspace = true, optional = true }
|
||||
secure-string = "0.3.0"
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
slab = "0.4.11"
|
||||
slotmap = "1.0.7"
|
||||
slotmap = "1.1.1"
|
||||
static_init = "1.0.4"
|
||||
sunrise = "2.1.0"
|
||||
timedate-zbus = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
|
||||
tokio = { workspace = true, features = ["fs", "io-util", "sync"] }
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = { version = "0.3.22", features = ["env-filter"] }
|
||||
udev = { version = "0.9.3", optional = true }
|
||||
upower_dbus = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
|
||||
bluez-zbus = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
|
||||
url = "2.5.7"
|
||||
url = "2.5.8"
|
||||
xkb-data = "0.2.1"
|
||||
xkeysym = { version = "0.2.1", optional = true }
|
||||
zbus = { version = "5.12.0", default-features = false, features = [
|
||||
zbus = { version = "=5.12.0", default-features = false, features = [
|
||||
"tokio",
|
||||
], optional = true }
|
||||
zbus_polkit = { version = "5.0.0", optional = true }
|
||||
fontdb = "0.23.0"
|
||||
mime = "0.3.17"
|
||||
rustix = { version = "1.1.2", features = ["process"] }
|
||||
rustix = { version = "1.1.3", features = ["process"] }
|
||||
gettext-rs = { version = "0.7.7", features = [
|
||||
"gettext-system",
|
||||
], optional = true }
|
||||
async-fn-stream = "0.3"
|
||||
num-traits = "0.2"
|
||||
pwhash = "1"
|
||||
# Pinned to fix ashpd. Remove this when fixed.
|
||||
zvariant = "=5.8.0"
|
||||
# Pinned to fix ashpd. Remove this when fixed.
|
||||
zvariant_derive = "=5.8.0"
|
||||
|
||||
[dependencies.icu]
|
||||
version = "2.1.1"
|
||||
|
|
|
|||
|
|
@ -2,98 +2,58 @@ use cosmic::{
|
|||
iced::{Subscription, stream},
|
||||
iced_futures::futures::{self, SinkExt},
|
||||
};
|
||||
use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Watcher};
|
||||
use notify::{Config, EventKind, RecommendedWatcher, RecursiveMode, Watcher};
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
use tokio::sync::mpsc::{UnboundedReceiver, unbounded_channel};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum State {
|
||||
Ready,
|
||||
Waiting {
|
||||
watcher: RecommendedWatcher,
|
||||
rx: UnboundedReceiver<notify::Result<Event>>,
|
||||
},
|
||||
Finished,
|
||||
}
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum DesktopFileEvent {
|
||||
pub enum Event {
|
||||
Changed,
|
||||
}
|
||||
|
||||
pub fn desktop_files<I: 'static + Hash + Copy + Send + Sync + Debug>(
|
||||
id: I,
|
||||
) -> cosmic::iced::Subscription<DesktopFileEvent> {
|
||||
) -> cosmic::iced::Subscription<Event> {
|
||||
Subscription::run_with_id(
|
||||
id,
|
||||
stream::channel(50, move |mut output| async move {
|
||||
let mut state = State::Ready;
|
||||
stream::channel(1, move |mut output| async move {
|
||||
let handle = tokio::runtime::Handle::current();
|
||||
let (tx, mut rx) = mpsc::channel(4);
|
||||
let mut last_update = std::time::Instant::now();
|
||||
|
||||
loop {
|
||||
state = start_watching(state, &mut output).await;
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
// Automatically select the best implementation for your platform.
|
||||
// You can also access each implementation directly e.g. INotifyWatcher.
|
||||
let watcher = RecommendedWatcher::new(
|
||||
move |res: Result<notify::Event, notify::Error>| {
|
||||
if let Ok(event) = res {
|
||||
match event.kind {
|
||||
EventKind::Create(_) | EventKind::Modify(_) | EventKind::Remove(_) => {
|
||||
let now = std::time::Instant::now();
|
||||
if now.duration_since(last_update).as_secs() > 3 {
|
||||
_ = handle.block_on(tx.send(()));
|
||||
last_update = now;
|
||||
}
|
||||
}
|
||||
|
||||
async fn start_watching(
|
||||
state: State,
|
||||
output: &mut futures::channel::mpsc::Sender<DesktopFileEvent>,
|
||||
) -> State {
|
||||
match state {
|
||||
State::Ready => {
|
||||
let paths = freedesktop_desktop_entry::default_paths();
|
||||
// TODO log errors
|
||||
if let Ok((mut watcher, rx)) = async_watcher() {
|
||||
for path in paths {
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
},
|
||||
Config::default(),
|
||||
);
|
||||
|
||||
if let Ok(mut watcher) = watcher {
|
||||
for path in cosmic::desktop::fde::default_paths() {
|
||||
let _ = watcher.watch(path.as_ref(), RecursiveMode::Recursive);
|
||||
}
|
||||
|
||||
_ = output.send(DesktopFileEvent::Changed).await;
|
||||
State::Waiting { watcher, rx }
|
||||
} else {
|
||||
State::Finished
|
||||
while rx.recv().await.is_some() {
|
||||
_ = output.send(Event::Changed).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
State::Waiting { watcher, rx } => {
|
||||
if let Some(rx) = async_watch(rx).await {
|
||||
_ = output.send(DesktopFileEvent::Changed).await;
|
||||
State::Waiting { watcher, rx }
|
||||
} else {
|
||||
State::Finished
|
||||
}
|
||||
}
|
||||
State::Finished => cosmic::iced::futures::future::pending().await,
|
||||
}
|
||||
}
|
||||
|
||||
fn async_watcher() -> notify::Result<(RecommendedWatcher, UnboundedReceiver<notify::Result<Event>>)>
|
||||
{
|
||||
let (tx, rx) = unbounded_channel();
|
||||
|
||||
// Automatically select the best implementation for your platform.
|
||||
// You can also access each implementation directly e.g. INotifyWatcher.
|
||||
let watcher = RecommendedWatcher::new(
|
||||
move |res| {
|
||||
_ = tx.send(res);
|
||||
},
|
||||
Config::default(),
|
||||
)?;
|
||||
|
||||
Ok((watcher, rx))
|
||||
}
|
||||
|
||||
async fn async_watch(
|
||||
mut rx: UnboundedReceiver<notify::Result<Event>>,
|
||||
) -> Option<UnboundedReceiver<notify::Result<Event>>> {
|
||||
// TODO log errors
|
||||
if let Some(res) = rx.recv().await {
|
||||
match res {
|
||||
Ok(_) => return Some(rx),
|
||||
Err(_) => return None,
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
|
||||
futures::future::pending().await
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue