diff --git a/Cargo.toml b/Cargo.toml index bc501e3a..c9a1d9ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,11 +87,19 @@ winit_wgpu = ["winit", "wgpu"] xdg-portal = ["ashpd"] qr_code = ["iced/qr_code"] markdown = ["iced/markdown"] +async-std = [ + "dep:async-std", + "ashpd/async-std", + "rfd?/async-std", + "zbus?/async-io", + "iced/async-std", +] [dependencies] apply = "0.3.0" ashpd = { version = "0.9.1", default-features = false, optional = true } async-fs = { version = "2.1", optional = true } +async-std = { version = "1.10", optional = true } cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "178eb0b", optional = true } chrono = "0.4.35" cosmic-config = { path = "cosmic-config" } diff --git a/src/theme/portal.rs b/src/theme/portal.rs index 17225ccc..e3dc7511 100644 --- a/src/theme/portal.rs +++ b/src/theme/portal.rs @@ -1,7 +1,7 @@ use ashpd::desktop::settings::{ColorScheme, Contrast}; use ashpd::desktop::Color; use iced::futures::{self, select, FutureExt, SinkExt, StreamExt}; -use iced_futures::{stream, subscription}; +use iced_futures::stream; use tracing::error; #[derive(Debug, Clone)] @@ -27,7 +27,7 @@ pub fn desktop_settings() -> iced_futures::Subscription { .await; #[cfg(not(feature = "tokio"))] { - pending::<()>().await; + futures::future::pending::<()>().await; unreachable!(); } attempts += 1; diff --git a/src/widget/wayland/tooltip/widget.rs b/src/widget/wayland/tooltip/widget.rs index 9c50cbac..033ad0f3 100644 --- a/src/widget/wayland/tooltip/widget.rs +++ b/src/widget/wayland/tooltip/widget.rs @@ -483,8 +483,14 @@ pub fn update<'a, Message: Clone + 'static, TopLevelMessage: Clone + 'static>( let view = view.clone(); let is_hovered = is_hovered.clone(); Task::future(async move { - _ = tokio::time::sleep(delay).await; - + #[cfg(feature = "tokio")] + { + _ = tokio::time::sleep(delay).await; + } + #[cfg(feature = "async-std")] + { + _ = async_std::task::sleep(delay).await; + } let is_hovered = is_hovered.clone(); let g = is_hovered.lock().unwrap(); if !*g {