Put libcosmic/desktop behind desktop feature

This commit is contained in:
Jeremy Soller 2026-04-17 12:41:02 -06:00
parent 9c0eb63b82
commit 62bfcc3550
4 changed files with 28 additions and 11 deletions

View file

@ -18,9 +18,7 @@ use cosmic::{
Application, ApplicationExt, Element,
app::{self, Core, Task, context_drawer},
cosmic_config::{self, ConfigSet},
cosmic_theme,
desktop::fde::DesktopEntry,
executor,
cosmic_theme, executor,
iced::core::widget::operation::focusable::unfocus,
iced::runtime::{clipboard, task},
iced::widget::{button::focus, scrollable::AbsoluteOffset},
@ -835,9 +833,12 @@ impl App {
// First launch apps that can be launched directly
if mime == "application/x-desktop" {
// Try opening desktop application
Self::launch_desktop_entries(&paths);
continue;
#[cfg(feature = "desktop")]
{
// Try opening desktop application
Self::launch_desktop_entries(&paths);
continue;
}
} else if mime == "application/x-executable" || mime == "application/vnd.appimage" {
// Try opening executable
for path in paths {
@ -898,7 +899,10 @@ impl App {
Task::batch(tasks)
}
#[cfg(feature = "desktop")]
fn launch_desktop_entries(paths: &[impl AsRef<Path>]) {
use cosmic::desktop::fde::DesktopEntry;
for path in paths.iter().map(AsRef::as_ref) {
match DesktopEntry::from_path::<&str>(path, None) {
Ok(entry) => match entry.exec() {