yoda: soft-fork pivot — keep Cargo name "libcosmic" for dep unification

The initial hard rename (255cf7cc) broke because Cargo's [patch] with
`package = libcosmic-yoda` does NOT unify across the transitive graph.
cosmic-files (still upstream) asks for "libcosmic"; patched with a
renamed package it ends up as a separate crate, leading to two copies
of cosmic::Theme/Action with incompatible types.

Soft fork keeps the yoda identity where it counts and stays compatible:
- Cargo name  : libcosmic (for patch/unification)
- Version     : 1.0.0 (same major as upstream so [patch] semver-accepts it)
- Lib name    : cosmic (unchanged)
- Repo        : leyoda/libcosmic-yoda on Forgejo (yoda lineage)
- Branch      : main (vs upstream master)

Revert parts:
- examples/*/Cargo.toml dep refs back to libcosmic
- i18n/*/libcosmic_yoda.ftl renamed back to libcosmic.ftl

Added:
- Compat stub features: winit = [], x11 = [] — empty so Cargo can satisfy
  upstream deps asking for these, but no code is actually gated on them
  any more (all removed in Phase 2).

Ungates done to make the Wayland path self-sufficient after winit removal:
- src/lib.rs: pub mod app + pub use Application/ApplicationExt no longer
  gated on winit; prelude exports ApplicationExt unconditionally
- src/surface/action.rs: 6 functions had #[cfg(all(wayland, linux, winit))]
  triple-gates; simplified to #[cfg(all(wayland, linux))] since winit is
  no longer a meaningful gate (wayland is now the only shell)
- 12 standalone #[cfg(feature = "winit")] annotations removed from src/
  (their gated code is now always compiled)

cargo check --lib + cargo check in cosmic-yoterm both pass with a single
libcosmic v1.0.0 in the tree.
This commit is contained in:
Lionel DARNIS 2026-04-23 15:05:31 +02:00
parent 8701aa31d8
commit 6736a596ac
92 changed files with 47 additions and 42 deletions

View file

@ -1,6 +1,16 @@
[package] [package]
name = "libcosmic-yoda" # NOTE (yoda fork): Cargo package name kept as "libcosmic" — see commit
version = "0.1.0-yoda" # 255cf7cc & its follow-up. Renaming it to "libcosmic-yoda" broke transitive
# dep unification: cosmic-files (still upstream) asks for "libcosmic" and
# Cargo's [patch] with `package = "libcosmic-yoda"` does NOT unify across
# the graph, so two copies of the crate end up in the binary with
# incompatible types. Yoda identity is kept via:
# - repo: forgejo leyoda/libcosmic-yoda
# - branch: main (vs upstream master)
# - version: 0.1.0-yoda (pre-1.0 marker denotes divergent lineage)
# - [lib] name stays "cosmic" (unchanged, matches every consumer)
name = "libcosmic"
version = "1.0.0"
edition = "2024" edition = "2024"
rust-version = "1.90" rust-version = "1.90"
@ -78,16 +88,21 @@ tokio = [
"cosmic-config/tokio", "cosmic-config/tokio",
] ]
# Tokio async runtime # Tokio async runtime
# Wayland window support (yoda fork is Wayland-only; this feature is always active in default) # Wayland window support (yoda fork is Wayland-only; always active in default).
# We still need iced/winit because pop-os/iced hosts the runtime dispatcher
# (`iced_winit as shell`) there — the name is a misnomer, it's the same crate
# that provides both the winit path AND the sctk/cctk wayland path.
wayland = [ wayland = [
"ashpd?/wayland", "ashpd?/wayland",
"autosize", "autosize",
"iced/winit",
"iced/wayland", "iced/wayland",
"iced_winit/wayland", "iced_winit/wayland",
"iced_runtime/cctk", "iced_runtime/cctk",
"iced_winit/cctk", "iced_winit/cctk",
"iced_wgpu/cctk", "iced_wgpu/cctk",
"iced/cctk", "iced/cctk",
"dep:iced_winit",
"dep:cctk", "dep:cctk",
"surface-message", "surface-message",
] ]
@ -96,6 +111,11 @@ surface-message = []
multi-window = [] multi-window = []
# Render with wgpu # Render with wgpu
wgpu = ["iced/wgpu", "iced_wgpu"] wgpu = ["iced/wgpu", "iced_wgpu"]
# Compat stubs — kept empty so upstream deps (cosmic-files, cosmic-text, …)
# that still ask for `winit` / `x11` features resolve cleanly against the
# yoda fork. Activating them has no effect: no code is gated on these.
winit = []
x11 = []
# Enables XDG portal integrations # Enables XDG portal integrations
xdg-portal = ["ashpd"] xdg-portal = ["ashpd"]
qr_code = ["iced/qr_code"] qr_code = ["iced/qr_code"]

View file

@ -6,7 +6,7 @@ edition = "2021"
[dependencies] [dependencies]
open = "5.3.3" open = "5.3.3"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
path = "../../" path = "../../"
features = [ features = [
"debug", "debug",

View file

@ -12,7 +12,7 @@ tracing = "0.1"
env_logger = "0.10.2" env_logger = "0.10.2"
log = "0.4.29" log = "0.4.29"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
path = "../../" path = "../../"
default-features = false default-features = false
features = ["applet-token"] features = ["applet-token"]

View file

@ -5,12 +5,12 @@ edition = "2021"
[features] [features]
default = ["wayland"] default = ["wayland"]
wayland = ["libcosmic-yoda/wayland"] wayland = ["libcosmic/wayland"]
[dependencies] [dependencies]
env_logger = "0.11" env_logger = "0.11"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
path = "../../" path = "../../"
features = [ features = [
"debug", "debug",

View file

@ -8,6 +8,6 @@ edition = "2024"
[dependencies] [dependencies]
jiff = "0.2" jiff = "0.2"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
path = "../../" path = "../../"
features = ["debug", "winit", "tokio", "xdg-portal", "wgpu"] features = ["debug", "winit", "tokio", "xdg-portal", "wgpu"]

View file

@ -8,7 +8,7 @@ tracing = "0.1.44"
tracing-subscriber = "0.3.22" tracing-subscriber = "0.3.22"
tracing-log = "0.2.0" tracing-log = "0.2.0"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
path = "../../" path = "../../"
features = [ features = [
"debug", "debug",

View file

@ -8,7 +8,7 @@ publish = false
[dependencies] [dependencies]
apply = "0.3.0" apply = "0.3.0"
fraction = "0.15.3" fraction = "0.15.3"
libcosmic-yoda = { path = "../..", features = [ libcosmic = { path = "../..", features = [
"debug", "debug",
"winit", "winit",
"tokio", "tokio",

View file

@ -7,6 +7,6 @@ edition = "2021"
tracing = "0.1.44" tracing = "0.1.44"
tracing-subscriber = "0.3.22" tracing-subscriber = "0.3.22"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
path = "../../" path = "../../"
features = ["debug", "winit", "wgpu", "tokio"] features = ["debug", "winit", "wgpu", "tokio"]

View file

@ -8,6 +8,6 @@ tracing = "0.1.44"
tracing-subscriber = "0.3.22" tracing-subscriber = "0.3.22"
tracing-log = "0.2.0" tracing-log = "0.2.0"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
path = "../../" path = "../../"
features = ["debug", "winit", "tokio", "xdg-portal", "wgpu"] features = ["debug", "winit", "tokio", "xdg-portal", "wgpu"]

View file

@ -6,4 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
libcosmic-yoda = { path = "../..", features = ["debug", "winit", "tokio", "single-instance", "wgpu", "wayland"] } libcosmic = { path = "../..", features = ["debug", "winit", "tokio", "single-instance", "wgpu", "wayland"] }

View file

@ -8,6 +8,6 @@ tracing = "0.1.44"
tracing-subscriber = "0.3.22" tracing-subscriber = "0.3.22"
tracing-log = "0.2.0" tracing-log = "0.2.0"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
path = "../../" path = "../../"
features = ["debug", "winit", "tokio", "xdg-portal", "wgpu"] features = ["debug", "winit", "tokio", "xdg-portal", "wgpu"]

View file

@ -5,8 +5,8 @@ edition = "2021"
[features] [features]
default = ["xdg-portal"] default = ["xdg-portal"]
rfd = ["libcosmic-yoda/rfd"] rfd = ["libcosmic/rfd"]
xdg-portal = ["libcosmic-yoda/xdg-portal"] xdg-portal = ["libcosmic/xdg-portal"]
[dependencies] [dependencies]
apply = "0.3.0" apply = "0.3.0"
@ -15,6 +15,6 @@ tracing = "0.1.44"
tracing-subscriber = "0.3.22" tracing-subscriber = "0.3.22"
url = "2.5.8" url = "2.5.8"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
features = ["debug", "winit", "wgpu", "wayland", "tokio"] features = ["debug", "winit", "wgpu", "wayland", "tokio"]
path = "../../" path = "../../"

View file

@ -6,7 +6,7 @@ edition = "2021"
[dependencies] [dependencies]
fraction = "0.15.3" fraction = "0.15.3"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
features = ["debug", "wgpu", "winit", "desktop", "tokio"] features = ["debug", "wgpu", "winit", "desktop", "tokio"]
path = "../.." path = "../.."
default-features = false default-features = false

View file

@ -5,6 +5,6 @@ edition = "2024"
[dependencies] [dependencies]
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
path = "../../" path = "../../"
features = ["debug", "winit", "wgpu", "tokio", "xdg-portal"] features = ["debug", "winit", "wgpu", "tokio", "xdg-portal"]

View file

@ -9,6 +9,6 @@ tracing-subscriber = "0.3.22"
tracing-log = "0.2.0" tracing-log = "0.2.0"
chrono = "*" chrono = "*"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
features = ["debug", "wgpu", "winit", "desktop", "tokio"] features = ["debug", "wgpu", "winit", "desktop", "tokio"]
path = "../.." path = "../.."

View file

@ -8,6 +8,6 @@ tracing = "0.1.44"
tracing-subscriber = "0.3.22" tracing-subscriber = "0.3.22"
tracing-log = "0.2.0" tracing-log = "0.2.0"
[dependencies.libcosmic-yoda] [dependencies.libcosmic]
path = "../../" path = "../../"
features = ["debug", "winit", "wgpu", "tokio", "xdg-portal"] features = ["debug", "winit", "wgpu", "tokio", "xdg-portal"]

View file

@ -1,7 +1,6 @@
// Copyright 2023 System76 <info@system76.com> // Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
#[cfg(feature = "winit")]
use crate::app; use crate::app;
#[cfg(feature = "single-instance")] #[cfg(feature = "single-instance")]
use crate::dbus_activation; use crate::dbus_activation;
@ -9,7 +8,6 @@ use crate::dbus_activation;
pub const fn app<M>(message: M) -> Action<M> { pub const fn app<M>(message: M) -> Action<M> {
Action::App(message) Action::App(message)
} }
#[cfg(feature = "winit")]
pub const fn cosmic<M>(message: app::Action) -> Action<M> { pub const fn cosmic<M>(message: app::Action) -> Action<M> {
Action::Cosmic(message) Action::Cosmic(message)
} }
@ -23,7 +21,6 @@ pub const fn none<M>() -> Action<M> {
pub enum Action<M> { pub enum Action<M> {
/// Messages from the application, for the application. /// Messages from the application, for the application.
App(M), App(M),
#[cfg(feature = "winit")]
/// Internal messages to be handled by libcosmic. /// Internal messages to be handled by libcosmic.
Cosmic(app::Action), Cosmic(app::Action),
#[cfg(feature = "single-instance")] #[cfg(feature = "single-instance")]

View file

@ -27,12 +27,10 @@ pub fn set_title<M>(id: window::Id, title: String) -> iced::Task<crate::Action<M
iced::Task::none() iced::Task::none()
} }
#[cfg(feature = "winit")]
pub fn set_scaling_factor<M: Send + 'static>(factor: f32) -> iced::Task<crate::Action<M>> { pub fn set_scaling_factor<M: Send + 'static>(factor: f32) -> iced::Task<crate::Action<M>> {
iced::Task::done(crate::app::Action::ScaleFactor(factor)).map(crate::Action::Cosmic) iced::Task::done(crate::app::Action::ScaleFactor(factor)).map(crate::Action::Cosmic)
} }
#[cfg(feature = "winit")]
pub fn set_theme<M: Send + 'static>(theme: crate::Theme) -> iced::Task<crate::Action<M>> { pub fn set_theme<M: Send + 'static>(theme: crate::Theme) -> iced::Task<crate::Action<M>> {
iced::Task::done(crate::app::Action::AppThemeChange(theme)).map(crate::Action::Cosmic) iced::Task::done(crate::app::Action::AppThemeChange(theme)).map(crate::Action::Cosmic)
} }

View file

@ -432,7 +432,6 @@ impl Core {
id id
} }
#[cfg(feature = "winit")]
pub fn drag<M: Send + 'static>(&self, id: Option<window::Id>) -> crate::app::Task<M> { pub fn drag<M: Send + 'static>(&self, id: Option<window::Id>) -> crate::app::Task<M> {
let Some(id) = id.or(self.main_window) else { let Some(id) = id.or(self.main_window) else {
return iced::Task::none(); return iced::Task::none();
@ -440,7 +439,6 @@ impl Core {
crate::command::drag(id) crate::command::drag(id)
} }
#[cfg(feature = "winit")]
pub fn maximize<M: Send + 'static>( pub fn maximize<M: Send + 'static>(
&self, &self,
id: Option<window::Id>, id: Option<window::Id>,
@ -452,7 +450,6 @@ impl Core {
crate::command::maximize(id, maximized) crate::command::maximize(id, maximized)
} }
#[cfg(feature = "winit")]
pub fn minimize<M: Send + 'static>(&self, id: Option<window::Id>) -> crate::app::Task<M> { pub fn minimize<M: Send + 'static>(&self, id: Option<window::Id>) -> crate::app::Task<M> {
let Some(id) = id.or(self.main_window) else { let Some(id) = id.or(self.main_window) else {
return iced::Task::none(); return iced::Task::none();
@ -460,7 +457,6 @@ impl Core {
crate::command::minimize(id) crate::command::minimize(id)
} }
#[cfg(feature = "winit")]
pub fn set_title<M: Send + 'static>( pub fn set_title<M: Send + 'static>(
&self, &self,
id: Option<window::Id>, id: Option<window::Id>,
@ -472,7 +468,6 @@ impl Core {
crate::command::set_title(id, title) crate::command::set_title(id, title)
} }
#[cfg(feature = "winit")]
pub fn set_windowed<M: Send + 'static>(&self, id: Option<window::Id>) -> crate::app::Task<M> { pub fn set_windowed<M: Send + 'static>(&self, id: Option<window::Id>) -> crate::app::Task<M> {
let Some(id) = id.or(self.main_window) else { let Some(id) = id.or(self.main_window) else {
return iced::Task::none(); return iced::Task::none();
@ -480,7 +475,6 @@ impl Core {
crate::command::set_windowed(id) crate::command::set_windowed(id)
} }
#[cfg(feature = "winit")]
pub fn toggle_maximize<M: Send + 'static>( pub fn toggle_maximize<M: Send + 'static>(
&self, &self,
id: Option<window::Id>, id: Option<window::Id>,

View file

@ -7,7 +7,6 @@
/// Recommended default imports. /// Recommended default imports.
pub mod prelude { pub mod prelude {
#[cfg(feature = "winit")]
pub use crate::ApplicationExt; pub use crate::ApplicationExt;
pub use crate::ext::*; pub use crate::ext::*;
pub use crate::{Also, Apply, Element, Renderer, Task, Theme}; pub use crate::{Also, Apply, Element, Renderer, Task, Theme};
@ -21,9 +20,7 @@ pub use action::Action;
pub mod anim; pub mod anim;
#[cfg(feature = "winit")]
pub mod app; pub mod app;
#[cfg(feature = "winit")]
#[doc(inline)] #[doc(inline)]
pub use app::{Application, ApplicationExt}; pub use app::{Application, ApplicationExt};

View file

@ -2,7 +2,6 @@
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
use super::Action; use super::Action;
#[cfg(feature = "winit")]
use crate::Application; use crate::Application;
use iced::window; use iced::window;
@ -27,7 +26,7 @@ pub fn destroy_window(id: iced_core::window::Id) -> Action {
Action::DestroyWindow(id) Action::DestroyWindow(id)
} }
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use] #[must_use]
pub fn app_window<App: Application>( pub fn app_window<App: Application>(
settings: impl Fn(&mut App) -> window::Settings + Send + Sync + 'static, settings: impl Fn(&mut App) -> window::Settings + Send + Sync + 'static,
@ -60,7 +59,7 @@ pub fn app_window<App: Application>(
} }
/// Used to create a window message from within a widget. /// Used to create a window message from within a widget.
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use] #[must_use]
pub fn simple_window<Message: 'static>( pub fn simple_window<Message: 'static>(
settings: impl Fn() -> window::Settings + Send + Sync + 'static, settings: impl Fn() -> window::Settings + Send + Sync + 'static,
@ -92,7 +91,7 @@ pub fn simple_window<Message: 'static>(
) )
} }
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use] #[must_use]
pub fn app_popup<App: Application>( pub fn app_popup<App: Application>(
settings: impl Fn(&mut App) -> iced_runtime::platform_specific::wayland::popup::SctkPopupSettings settings: impl Fn(&mut App) -> iced_runtime::platform_specific::wayland::popup::SctkPopupSettings
@ -126,7 +125,7 @@ pub fn app_popup<App: Application>(
} }
/// Used to create a subsurface message from within a widget. /// Used to create a subsurface message from within a widget.
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use] #[must_use]
pub fn simple_subsurface<Message: 'static, V>( pub fn simple_subsurface<Message: 'static, V>(
settings: impl Fn() -> iced_runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings settings: impl Fn() -> iced_runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings
@ -155,7 +154,7 @@ pub fn simple_subsurface<Message: 'static, V>(
} }
/// Used to create a popup message from within a widget. /// Used to create a popup message from within a widget.
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use] #[must_use]
pub fn simple_popup<Message: 'static>( pub fn simple_popup<Message: 'static>(
settings: impl Fn() -> iced_runtime::platform_specific::wayland::popup::SctkPopupSettings settings: impl Fn() -> iced_runtime::platform_specific::wayland::popup::SctkPopupSettings
@ -186,7 +185,7 @@ pub fn simple_popup<Message: 'static>(
) )
} }
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))] #[cfg(all(feature = "wayland", target_os = "linux"))]
#[must_use] #[must_use]
pub fn subsurface<App: Application>( pub fn subsurface<App: Application>(
settings: impl Fn( settings: impl Fn(