From 36a5ce2002088714821d16c8116e58cd77090d3f Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 18 Jun 2025 14:12:00 -0400 Subject: [PATCH] fix: proper feature gate --- Cargo.toml | 1 + src/app.rs | 32 ++++++++++++++++---------------- src/lib.rs | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 44e6f18..1f9a0f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -97,6 +97,7 @@ default = [ ] dbus-config = ["libcosmic/dbus-config"] desktop = ["libcosmic/desktop", "dep:cosmic-mime-apps", "dep:xdg"] +desktop-applet = [] gvfs = ["dep:gio", "dep:glib"] io-uring = ["compio/io-uring", "dep:io-uring"] io-uring-bindgen = ["io-uring?/bindgen"] diff --git a/src/app.rs b/src/app.rs index e00a9ae..6a34130 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,7 +1,7 @@ // Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only -#[cfg(feature = "wayland")] +#[cfg(all(feature = "wayland", feature = "desktop-applet"))] use cosmic::iced::{ event::wayland::{Event as WaylandEvent, OutputEvent, OverlapNotifyEvent}, platform_specific::runtime::wayland::layer_surface::{ @@ -12,7 +12,7 @@ use cosmic::iced::{ }, Limits, }; -#[cfg(feature = "wayland")] +#[cfg(all(feature = "wayland", feature = "desktop-applet"))] use cosmic::iced_winit::commands::overlap_notify::overlap_notify; use cosmic::{ app::{self, context_drawer, Core, Task}, @@ -63,7 +63,7 @@ use std::{ }; use tokio::sync::mpsc; use trash::TrashItem; -#[cfg(feature = "wayland")] +#[cfg(all(feature = "wayland", feature = "desktop-applet"))] use wayland_client::{protocol::wl_output::WlOutput, Proxy}; use crate::{ @@ -312,7 +312,7 @@ pub enum Message { ExtractHere(Option), ExtractTo(Option), ExtractToResult(DialogResult), - #[cfg(all(feature = "desktop", feature = "wayland"))] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] Focused(window::Id), Key(Modifiers, Key, Option), LaunchUrl(String), @@ -339,7 +339,7 @@ pub enum Message { OpenWithBrowse, OpenWithDialog(Option), OpenWithSelection(usize), - #[cfg(all(feature = "desktop", feature = "wayland"))] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] Overlap(OverlapNotifyEvent, window::Id), Paste(Option), PasteContents(PathBuf, ClipboardPaste), @@ -401,7 +401,7 @@ pub enum Message { DndDropTab(Entity, Option, DndAction), DndDropNav(Entity, Option, DndAction), Recents, - #[cfg(feature = "wayland")] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] OutputEvent(OutputEvent, WlOutput), Cosmic(app::Action), None, @@ -583,9 +583,9 @@ pub struct App { failed_operations: BTreeMap, search_id: widget::Id, size: Option, - #[cfg(feature = "wayland")] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] surface_ids: HashMap, - #[cfg(feature = "wayland")] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] surface_names: HashMap, toasts: widget::toaster::Toasts, watcher_opt: Option<(Debouncer, HashSet)>, @@ -1939,9 +1939,9 @@ impl Application for App { failed_operations: BTreeMap::new(), search_id: widget::Id::unique(), size: None, - #[cfg(feature = "wayland")] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] surface_ids: HashMap::new(), - #[cfg(feature = "wayland")] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] surface_names: HashMap::new(), toasts: widget::toaster::Toasts::new(Message::CloseToast), watcher_opt: None, @@ -4018,7 +4018,7 @@ impl Application for App { Message::Recents => { return self.open_tab(Location::Recents, false, None); } - #[cfg(feature = "wayland")] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] Message::OutputEvent(output_event, output) => { match output_event { OutputEvent::Created(output_info_opt) => { @@ -4079,7 +4079,7 @@ impl Application for App { exclusive_zone: 0, size_limits: Limits::NONE.min_width(1.0).min_height(1.0), }), - #[cfg(feature = "wayland")] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] overlap_notify(surface_id, true), ]); } @@ -4106,7 +4106,7 @@ impl Application for App { return Task::perform(async move { cosmic }, cosmic::action::cosmic); } Message::None => {} - #[cfg(all(feature = "desktop", feature = "wayland"))] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] Message::Overlap(overlap_notify_event, w_id) => match overlap_notify_event { OverlapNotifyEvent::OverlapLayerAdd { identifier, @@ -4130,7 +4130,7 @@ impl Application for App { self.size = Some(size); self.handle_overlap(); } - #[cfg(all(feature = "desktop", feature = "wayland"))] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] Message::Focused(id) => { if let Some(w) = self.windows.get(&id) { match w { @@ -5231,14 +5231,14 @@ impl Application for App { Some(Message::ModifiersChanged(modifiers)) } Event::Window(WindowEvent::Unfocused) => Some(Message::WindowUnfocus), - #[cfg(all(feature = "desktop", feature = "wayland"))] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] Event::Window(WindowEvent::Focused) => Some(Message::Focused(window_id)), Event::Window(WindowEvent::CloseRequested) => Some(Message::WindowClose), Event::Window(WindowEvent::Opened { position: _, size }) => { Some(Message::Size(size)) } Event::Window(WindowEvent::Resized(s)) => Some(Message::Size(s)), - #[cfg(feature = "wayland")] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] Event::PlatformSpecific(event::PlatformSpecific::Wayland(wayland_event)) => { match wayland_event { WaylandEvent::Output(output_event, output) => { diff --git a/src/lib.rs b/src/lib.rs index aaa87d6..a8596d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -63,7 +63,7 @@ pub fn desktop() -> Result<(), Box> { settings = settings.size_limits(Limits::NONE.min_width(360.0).min_height(180.0)); settings = settings.exit_on_close(false); settings = settings.transparent(true); - #[cfg(feature = "wayland")] + #[cfg(all(feature = "wayland", feature = "desktop-applet"))] { settings = settings.no_main_window(true); }