fix: proper feature gate

This commit is contained in:
Ashley Wulber 2025-06-18 14:12:00 -04:00 committed by Ashley Wulber
parent 720caa5dba
commit 36a5ce2002
3 changed files with 18 additions and 17 deletions

View file

@ -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"]

View file

@ -1,7 +1,7 @@
// Copyright 2023 System76 <info@system76.com>
// 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<Entity>),
ExtractTo(Option<Entity>),
ExtractToResult(DialogResult),
#[cfg(all(feature = "desktop", feature = "wayland"))]
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
Focused(window::Id),
Key(Modifiers, Key, Option<SmolStr>),
LaunchUrl(String),
@ -339,7 +339,7 @@ pub enum Message {
OpenWithBrowse,
OpenWithDialog(Option<Entity>),
OpenWithSelection(usize),
#[cfg(all(feature = "desktop", feature = "wayland"))]
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
Overlap(OverlapNotifyEvent, window::Id),
Paste(Option<Entity>),
PasteContents(PathBuf, ClipboardPaste),
@ -401,7 +401,7 @@ pub enum Message {
DndDropTab(Entity, Option<ClipboardPaste>, DndAction),
DndDropNav(Entity, Option<ClipboardPaste>, 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<u64, (Operation, Controller, String)>,
search_id: widget::Id,
size: Option<Size>,
#[cfg(feature = "wayland")]
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
surface_ids: HashMap<WlOutput, WindowId>,
#[cfg(feature = "wayland")]
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
surface_names: HashMap<WindowId, String>,
toasts: widget::toaster::Toasts<Message>,
watcher_opt: Option<(Debouncer<RecommendedWatcher, FileIdMap>, HashSet<PathBuf>)>,
@ -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) => {

View file

@ -63,7 +63,7 @@ pub fn desktop() -> Result<(), Box<dyn std::error::Error>> {
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);
}