diff --git a/Cargo.toml b/Cargo.toml index 87ad086..c55d2c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ rust-version = "1.85" name = "cosmic" [features] -default = ["multi-window", "a11y"] +default = ["dbus-config", "multi-window", "a11y"] # Accessibility support a11y = ["iced/a11y", "iced_accessibility"] # Enable about widget @@ -27,8 +27,8 @@ applet = [ "multi-window", ] applet-token = ["applet"] -# Use the cosmic-settings-daemon for config handling -dbus-config = ["cosmic-config/dbus", "dep:zbus", "cosmic-settings-daemon"] +# Use the cosmic-settings-daemon for config handling on Linux targets +dbus-config = [] # Debug features debug = ["iced/debug"] # Enables pipewire support in ashpd, if ashpd is enabled @@ -107,7 +107,6 @@ cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-c chrono = "0.4.40" cosmic-config = { path = "cosmic-config" } cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon", optional = true } -cosmic-settings-daemon = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true } css-color = "0.2.8" derive_setters = "0.1.6" futures = "0.3" @@ -135,6 +134,12 @@ unicode-segmentation = "1.12" url = "2.5.4" zbus = { version = "5.7.1", default-features = false, optional = true } +# Enable DBus feature on Linux targets +[target.'cfg(target_os = "linux")'.dependencies] +cosmic-config = { path = "cosmic-config", features = ["dbus"] } +cosmic-settings-daemon = { git = "https://github.com/pop-os/dbus-settings-bindings" } +zbus = { version = "5.7.1", default-features = false } + [target.'cfg(unix)'.dependencies] freedesktop-icons = { package = "cosmic-freedesktop-icons", git = "https://github.com/pop-os/freedesktop-icons" } freedesktop-desktop-entry = { version = "0.7.11", optional = true } diff --git a/src/app/cosmic.rs b/src/app/cosmic.rs index c8a8dfe..9814cf7 100644 --- a/src/app/cosmic.rs +++ b/src/app/cosmic.rs @@ -101,7 +101,7 @@ where pub fn init( (mut core, flags): (Core, T::Flags), ) -> (Self, iced::Task>) { - #[cfg(feature = "dbus-config")] + #[cfg(all(feature = "dbus-config", target_os = "linux"))] { use iced_futures::futures::executor::block_on; core.settings_daemon = block_on(cosmic_config::dbus::settings_daemon_proxy()).ok(); diff --git a/src/core.rs b/src/core.rs index 4b9811e..c82aa83 100644 --- a/src/core.rs +++ b/src/core.rs @@ -89,7 +89,7 @@ pub struct Core { #[cfg(feature = "single-instance")] pub(crate) single_instance: bool, - #[cfg(feature = "dbus-config")] + #[cfg(all(feature = "dbus-config", target_os = "linux"))] pub(crate) settings_daemon: Option>, pub(crate) main_window: Option, @@ -146,7 +146,7 @@ impl Default for Core { applet: crate::applet::Context::default(), #[cfg(feature = "single-instance")] single_instance: false, - #[cfg(feature = "dbus-config")] + #[cfg(all(feature = "dbus-config", target_os = "linux"))] settings_daemon: None, portal_is_dark: None, portal_accent: None, @@ -353,7 +353,7 @@ impl Core { &self, config_id: &'static str, ) -> iced::Subscription> { - #[cfg(feature = "dbus-config")] + #[cfg(all(feature = "dbus-config", target_os = "linux"))] if let Some(settings_daemon) = self.settings_daemon.clone() { return cosmic_config::dbus::watcher_subscription(settings_daemon, config_id, false); } @@ -370,7 +370,7 @@ impl Core { &self, state_id: &'static str, ) -> iced::Subscription> { - #[cfg(feature = "dbus-config")] + #[cfg(all(feature = "dbus-config", target_os = "linux"))] if let Some(settings_daemon) = self.settings_daemon.clone() { return cosmic_config::dbus::watcher_subscription(settings_daemon, state_id, true); } diff --git a/src/theme/mod.rs b/src/theme/mod.rs index 5e335f5..9c4e7d5 100644 --- a/src/theme/mod.rs +++ b/src/theme/mod.rs @@ -18,9 +18,6 @@ use iced_runtime::{Appearance, DefaultStyle}; use std::sync::{Arc, Mutex}; pub use style::*; -#[cfg(feature = "dbus-config")] -use cosmic_config::dbus; - pub type CosmicColor = ::palette::rgb::Srgba; pub type CosmicComponent = cosmic_theme::Component; pub type CosmicTheme = cosmic_theme::Theme;