From 999e2ba4e5f5b2679c0068167c266b572026b00f Mon Sep 17 00:00:00 2001 From: leyoda Date: Thu, 23 Apr 2026 17:33:22 +0200 Subject: [PATCH] yoda: rebase onto libcosmic-yoda via path deps + macOS controls toggle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fresh rewiring from upstream master (78644a3) — the previous attempt on 051f4f9 was 137 commits behind and hit API drift (cosmic::iced_futures, Subscription::run_with_id). Upstream master uses the newer API (cosmic::iced::stream + Subscription::run_with) which our libcosmic-yoda already supports. Yoda wiring: - [workspace.dependencies.libcosmic] (git pop-os) -> libcosmic-yoda { path, wayland } - cosmic-config + iced_winit workspace deps -> path to libcosmic-yoda submodule - [patch.pop-os/libcosmic] redirects transitive cosmic-config + cosmic-theme + iced_futures + iced_winit to our local paths so the graph resolves to a single copy (cosmic-bg/comp/idle/panel configs unify cleanly against master) - subscriptions/sound + page + cosmic-settings inner Cargo.toml: libcosmic -> libcosmic-yoda (workspace + direct variants) - winit feature dropped from libcosmic-yoda deps (our fork is Wayland-only) Cherry-picked from leyoda/local/window-controls-position @ 52ce463: - cosmic-settings/src/pages/desktop/window_management.rs — macOS toggle UI - i18n/en + fr/cosmic_settings.ftl — translations Installed at /usr/bin/cosmic-settings (yoda build, 78 MB). Pre-yoda pacman version kept at /usr/bin/cosmic-settings.pre-yoda-fork. --- Cargo.lock | 27 +++------------ Cargo.toml | 34 +++++++++---------- cosmic-settings/Cargo.toml | 14 ++++---- .../src/pages/desktop/window_management.rs | 22 ++++++++++++ i18n/en/cosmic_settings.ftl | 1 + i18n/fr/cosmic_settings.ftl | 1 + page/Cargo.toml | 2 +- subscriptions/sound/Cargo.toml | 2 +- 8 files changed, 54 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 582fce1..5ecab30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1391,7 +1391,6 @@ dependencies = [ [[package]] name = "cosmic-config" version = "1.0.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "atomicwrites", "cosmic-config-derive", @@ -1412,7 +1411,6 @@ dependencies = [ [[package]] name = "cosmic-config-derive" version = "1.0.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "quote", "syn 2.0.117", @@ -1588,7 +1586,7 @@ dependencies = [ "itertools 0.14.0", "itoa", "jiff", - "libcosmic", + "libcosmic-yoda", "locale1", "locales-rs", "mime 0.3.17", @@ -1737,7 +1735,7 @@ version = "1.0.7" dependencies = [ "derive_setters", "downcast-rs 2.0.2", - "libcosmic", + "libcosmic-yoda", "regex", "slab", "slotmap", @@ -1762,7 +1760,7 @@ dependencies = [ "cosmic-pipewire", "futures", "intmap", - "libcosmic", + "libcosmic-yoda", "numtoa", "rustix 1.1.4", "tokio", @@ -1827,7 +1825,6 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "1.0.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "almost", "configparser", @@ -3250,7 +3247,6 @@ dependencies = [ [[package]] name = "iced" version = "0.14.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "dnd", "iced_accessibility", @@ -3271,7 +3267,6 @@ dependencies = [ [[package]] name = "iced_accessibility" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "accesskit", "accesskit_winit", @@ -3280,7 +3275,6 @@ dependencies = [ [[package]] name = "iced_core" version = "0.14.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "bitflags 2.11.1", "bytes", @@ -3305,7 +3299,6 @@ dependencies = [ [[package]] name = "iced_debug" version = "0.14.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "iced_core", "iced_futures", @@ -3315,7 +3308,6 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.14.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "futures", "iced_core", @@ -3329,7 +3321,6 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.14.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "bitflags 2.11.1", "bytemuck", @@ -3350,7 +3341,6 @@ dependencies = [ [[package]] name = "iced_program" version = "0.14.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "iced_graphics", "iced_runtime", @@ -3359,7 +3349,6 @@ dependencies = [ [[package]] name = "iced_renderer" version = "0.14.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -3371,7 +3360,6 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.14.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "bytes", "cosmic-client-toolkit", @@ -3387,7 +3375,6 @@ dependencies = [ [[package]] name = "iced_tiny_skia" version = "0.14.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "bytemuck", "cosmic-text", @@ -3404,7 +3391,6 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.14.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "as-raw-xcb-connection", "bitflags 2.11.1", @@ -3435,7 +3421,6 @@ dependencies = [ [[package]] name = "iced_widget" version = "0.14.2" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "cosmic-client-toolkit", "dnd", @@ -3455,7 +3440,6 @@ dependencies = [ [[package]] name = "iced_winit" version = "0.14.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" dependencies = [ "cosmic-client-toolkit", "cursor-icon", @@ -4565,9 +4549,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f" [[package]] -name = "libcosmic" -version = "1.0.0" -source = "git+https://github.com/pop-os/libcosmic#c423ad1bfc25057922406c687f2ddc75ead5ab67" +name = "libcosmic-yoda" +version = "0.1.0-yoda" dependencies = [ "apply", "ashpd 0.12.3", diff --git a/Cargo.toml b/Cargo.toml index c42187c..ca0a1cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,21 +9,23 @@ rust-version = "1.90" [workspace.dependencies] cosmic-randr = { git = "https://github.com/pop-os/cosmic-randr" } tokio = { version = "1.49.0", features = ["macros"] } -iced_winit = { git = "https://github.com/pop-os/libcosmic", default-features = false } +# Yoda fork: direct path dep on iced_winit in libcosmic-yoda's submodule. +iced_winit = { path = "/home/lionel/Devels/libcosmic/iced/winit", default-features = false } -[workspace.dependencies.libcosmic] +# Yoda fork — libcosmic-yoda by path, replaces upstream git dep. +[workspace.dependencies.libcosmic-yoda] features = [ "dbus-config", "desktop", "multi-window", - "winit", + "wayland", "tokio", "qr_code", ] -git = "https://github.com/pop-os/libcosmic" +path = "/home/lionel/Devels/libcosmic" [workspace.dependencies.cosmic-config] -git = "https://github.com/pop-os/libcosmic" +path = "/home/lionel/Devels/libcosmic/cosmic-config" [workspace.dependencies.cosmic-bg-config] git = "https://github.com/pop-os/cosmic-bg" @@ -69,19 +71,15 @@ cosmic-client-toolkit = { git = "https://github.com/pop-os/cosmic-protocols//", # [patch.'https://github.com/pop-os/cosmic-settings-daemon'] # cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon//", branch = "input_nobuild" } -# For development and testing purposes -# [patch.'https://github.com/pop-os/libcosmic'] -# libcosmic = { path = "../libcosmic" } -# cosmic-config = { path = "../libcosmic/cosmic-config" } -# cosmic-theme = { path = "../libcosmic/cosmic-theme" } -# iced_futures = { path = "../libcosmic/iced/futures" } -# iced_winit = { path = "../libcosmic/iced/winit" } - -# libcosmic = { git = "https://github.com/pop-os/libcosmic//" } -# cosmic-config = { git = "https://github.com/pop-os/libcosmic//" } -# cosmic-theme = { git = "https://github.com/pop-os/libcosmic//" } -# iced_futures = { git = "https://github.com/pop-os/libcosmic//" } -# iced_winit = { git = "https://github.com/pop-os/libcosmic//" } +# Yoda fork: redirect every transitive dep that asks for pop-os/libcosmic +# (cosmic-bg-config, cosmic-comp-config, cosmic-idle-config, cosmic-panel-config, +# cosmic-settings-config, cosmic-settings-daemon-config) to our local paths so +# the whole graph resolves against a single cosmic-config / cosmic-theme / iced_*. +[patch.'https://github.com/pop-os/libcosmic'] +cosmic-config = { path = "/home/lionel/Devels/libcosmic/cosmic-config" } +cosmic-theme = { path = "/home/lionel/Devels/libcosmic/cosmic-theme" } +iced_futures = { path = "/home/lionel/Devels/libcosmic/iced/futures" } +iced_winit = { path = "/home/lionel/Devels/libcosmic/iced/winit" } # [patch.'https://github.com/pop-os/dbus-settings-bindings'] # cosmic-dbus-networkmanager = { path = "../dbus-settings-bindings/networkmanager" } diff --git a/cosmic-settings/Cargo.toml b/cosmic-settings/Cargo.toml index 03c7a70..c5e3cca 100644 --- a/cosmic-settings/Cargo.toml +++ b/cosmic-settings/Cargo.toml @@ -59,7 +59,7 @@ image = { version = "0.25", default-features = false, features = [ indexmap = "2.13.0" itertools = "0.14.0" itoa = "1.0.17" -libcosmic.workspace = true +libcosmic-yoda.workspace = true iced_winit.workspace = true locale1 = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true } sysinfo = { version = "=0.38.0", optional = true } @@ -187,12 +187,12 @@ page-window-management = ["cosmic-comp-config", "dep:cosmic-settings-config"] page-workspaces = ["cosmic-comp-config"] # Other features -a11y = ["libcosmic/a11y"] +a11y = ["libcosmic-yoda/a11y"] ashpd = ["dep:ashpd"] cosmic-comp-config = ["dep:cosmic-comp-config"] -dbus-config = ["libcosmic/dbus-config", "cosmic-config/dbus"] -single-instance = ["libcosmic/single-instance"] +dbus-config = ["libcosmic-yoda/dbus-config", "cosmic-config/dbus"] +single-instance = ["libcosmic-yoda/single-instance"] test = [] -wayland = ["libcosmic/wayland", "dep:cosmic-panel-config", "dep:cosmic-randr", "iced_winit/cctk"] -wgpu = ["libcosmic/wgpu"] -xdg-portal = ["ashpd", "libcosmic/xdg-portal"] +wayland = ["libcosmic-yoda/wayland", "dep:cosmic-panel-config", "dep:cosmic-randr", "iced_winit/cctk"] +wgpu = ["libcosmic-yoda/wgpu"] +xdg-portal = ["ashpd", "libcosmic-yoda/xdg-portal"] diff --git a/cosmic-settings/src/pages/desktop/window_management.rs b/cosmic-settings/src/pages/desktop/window_management.rs index b93e0f8..7b68acc 100644 --- a/cosmic-settings/src/pages/desktop/window_management.rs +++ b/cosmic-settings/src/pages/desktop/window_management.rs @@ -27,6 +27,7 @@ pub enum Message { ShowActiveWindowHint(bool), ShowMaximizeButton(bool), ShowMinimizeButton(bool), + WindowControlsPositionStart(bool), SetEdgeSnapThreshold(u32), Surface(surface::Action), } @@ -177,6 +178,19 @@ impl Page { .set_show_minimize(&config, value); } } + Message::WindowControlsPositionStart(left) => { + if let Ok(config) = cosmic::config::CosmicTk::config() { + let position = if left { + cosmic::widget::WindowControlsPosition::Start + } else { + cosmic::widget::WindowControlsPosition::End + }; + let _res = cosmic::config::COSMIC_TK + .write() + .unwrap() + .set_window_controls_position(&config, position); + } + } Message::ShowActiveWindowHint(value) => { self.show_active_hint = value; if let Err(err) = self.comp_config.set("active_hint", value) { @@ -274,6 +288,7 @@ pub fn window_controls() -> Section { maximize = fl!("window-controls", "maximize"); minimize = fl!("window-controls", "minimize"); active_window_hint = fl!("window-controls", "active-window-hint"); + position_start = fl!("window-controls", "position-start"); }); Section::default() @@ -296,6 +311,13 @@ pub fn window_controls() -> Section { settings::item::builder(&descriptions[minimize]) .toggler(cosmic::config::show_minimize(), Message::ShowMinimizeButton), ) + .add(settings::item::builder(&descriptions[position_start]).toggler( + matches!( + cosmic::config::window_controls_position(), + cosmic::widget::WindowControlsPosition::Start + ), + Message::WindowControlsPositionStart, + )) .apply(Element::from) .map(crate::pages::Message::WindowManagement) }) diff --git a/i18n/en/cosmic_settings.ftl b/i18n/en/cosmic_settings.ftl index 535477b..f5a614e 100644 --- a/i18n/en/cosmic_settings.ftl +++ b/i18n/en/cosmic_settings.ftl @@ -484,6 +484,7 @@ window-controls = Window controls .maximize = Show maximize button .minimize = Show minimize button .active-window-hint = Show active window hint + .position-start = Place buttons on the left (macOS style) focus-navigation = Focus navigation .focus-follows-cursor = Focus follows cursor diff --git a/i18n/fr/cosmic_settings.ftl b/i18n/fr/cosmic_settings.ftl index 419dc72..098a741 100644 --- a/i18n/fr/cosmic_settings.ftl +++ b/i18n/fr/cosmic_settings.ftl @@ -322,6 +322,7 @@ window-controls = Contrôles des fenêtres .maximize = Afficher le bouton maximiser .minimize = Afficher le bouton minimiser .active-window-hint = Afficher l'indice de la fenêtre active + .position-start = Placer les boutons à gauche (style macOS) focus-navigation = Navigation par le focus .focus-follows-cursor = Le focus suit le curseur .focus-follows-cursor-delay = Délai de suivi du focus en ms diff --git a/page/Cargo.toml b/page/Cargo.toml index 7547599..d45d828 100644 --- a/page/Cargo.toml +++ b/page/Cargo.toml @@ -7,7 +7,7 @@ edition = "2024" derive_setters = "0.1.9" regex = "1.12.3" slotmap = "1.1.1" -libcosmic = { workspace = true } +libcosmic-yoda = { workspace = true } downcast-rs = "2.0.2" url = "2.5.8" slab = "0.4.12" diff --git a/subscriptions/sound/Cargo.toml b/subscriptions/sound/Cargo.toml index adf5891..e8c81e2 100644 --- a/subscriptions/sound/Cargo.toml +++ b/subscriptions/sound/Cargo.toml @@ -10,7 +10,7 @@ publish = true cosmic-pipewire = { path = "../../crates/cosmic-pipewire" } futures = "0.3.32" intmap = "3.1.3" -libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = false } +libcosmic-yoda = { path = "/home/lionel/Devels/libcosmic", default-features = false } numtoa = "1.0.0-alpha1" rustix = "1.1.3" tokio = { version = "1.49.0", features = ["process", "rt", "time"] }