Commit graph

1821 commits

Author SHA1 Message Date
c118f5a2f6 yoda: bump iced submodule ref → yoda-wayland-only HEAD 8f6be798
Picks up two commits on leyoda/iced-yoda yoda-wayland-only branch:
- winit workspace dep default-features = false (drops winit/x11 backend)
- iced_wgpu gated x11 backend behind opt-in feature

Companion to libcosmic-yoda 8d1d8739 (drop x11 defaults on iced_winit +
iced_tiny_skia) for the yoda-v4 Wayland-only cut.
2026-04-24 06:41:28 +02:00
8d1d873918 yoda: drop x11 defaults on iced_winit + iced_tiny_skia
Dep chain audit showed winit, iced_winit and iced_tiny_skia all had
"x11" in their default features. Even though our Wayland-only build
doesn't use any X11 code path, the defaults were propagating through
cargo feature unification — winit-x11, tiny-xlib, x11-dl, etc. were
all being linked.

Fix, at the dep declaration level:
- [dependencies.iced_winit] default-features = false + wayland/wayland-dlopen
- [dependencies.iced_tiny_skia] default-features = false + wayland
- iced submodule's workspace winit = { ..., default-features = false }

Result on cosmic-yoterm binary:
- size:  55.4 MB -> 53.8 MB (-1.6 MB, ~3%)
- winit symbols: 2151 -> 1340 (-811)
- x11 symbols:   1526 -> 503  (-1023)

Remaining x11 footprint (~500 symbols):
- clipboard_x11 / x11rb: window_clipboard pulls both x11 + wayland
  backends unconditionally on unix targets. Would need forking
  window_clipboard to gate x11 behind a feature.
- tiny-xlib / as-raw-xcb-connection: low-level window-handle bindings
  pulled by wgpu/softbuffer even when no X11 windows ever exist.
  Dead code at runtime, probably best left alone until wgpu/raw-window-handle
  upstream make these optional.
2026-04-24 06:00:03 +02:00
8ab7b15807 yoda-v2: color_picker Theme ref + context_menu/menu ungate winit
Two perf + correctness wins packaged as +yoda-v2 (version bump 0.1.0-yoda
-> 0.1.0-yoda.2):

1. color_picker::draw() — use the theme: &Theme parameter already passed
   to draw() instead of THEME.lock().unwrap().clone() which cloned the
   whole Theme on every redraw (src/widget/color_picker/mod.rs:622).
   Upstreamable.

2. Dropped feature = "winit" from 21 combined cfg attrs in context_menu.rs,
   menu/menu_bar.rs, menu/menu_inner.rs. These triple-gates (wayland +
   winit + surface-message) were silently disabling all context-menu and
   menubar popup creation in yoda apps (which don't activate the winit
   feature). Now the code only gates on wayland + surface-message, which
   is our actual runtime path. Matches the ungate we already did on
   surface/action.rs in Phase 3d.

cargo check --lib passes. All 4 consumer apps rebuilt + installed as
+yoda-v2 (backup of previous yoda binaries in .pre-yoda-v2 siblings).
2026-04-23 18:43:52 +02:00
aec3eb615f yoda: ungate remaining winit+wayland combined cfgs
During Phase 3d it surfaced that several widgets keep a three-clause
cfg `#[cfg(all(feature = "winit", feature = "wayland", target_os = "linux"))]`
(e.g. dropdown::widget::with_popup, widget/mod.rs menu bits,
theme/style/mod.rs). Since the yoda fork is wayland-only the "winit"
clause is vestigial — dropping it unhides these methods for Wayland
consumers (cosmic-settings needs Dropdown::with_popup on the wallpaper
page).

Also fixed a cfg asymmetry in responsive_menu_bar.rs: the fallback
block was gated `cfg(not(all(winit, wayland, linux)))` while the
primary block was `cfg(all(wayland, linux))`. With winit removed both
blocks were active and we got E0308 expected-() — aligned the cfgs so
exactly one branch compiles.
2026-04-23 17:36:21 +02:00
3e23d08728 yoda: re-apply hard rename — libcosmic → libcosmic-yoda (0.1.0-yoda)
Reverts the soft-fork pivot (6736a596). Strategy chosen with user:
full cascade fork. Every consumer (leyoda/cosmic-files + each leyoda/app)
depends on libcosmic-yoda by explicit path, so there are no transitive
deps left asking for the upstream 'libcosmic' crate — no [patch]
unification issues, no two-version traps.

Changes:
- Cargo.toml: name = libcosmic-yoda, version = 0.1.0-yoda
- i18n/*/libcosmic.ftl -> libcosmic_yoda.ftl (71 locales)
- examples/*/Cargo.toml dep refs back to libcosmic-yoda
- compat stub features (winit=[], x11=[]) kept for upstream deps that
  might still request them during the migration window

cargo check --lib passes.
2026-04-23 15:32:29 +02:00
6736a596ac 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.
2026-04-23 15:05:31 +02:00
8701aa31d8 feat(yoda): Wayland-only cut — drop winit and x11 features
Part of the yoda fork direction: libcosmic-yoda is Wayland-only going forward.

Cargo.toml changes:
- default features: remove winit, x11, iced-wayland, multi-window -> add wayland
- applet feature: remove winit dep
- merge iced-wayland into wayland (simpler feature graph)
- remove winit, winit_debug, winit_tokio, winit_wgpu, x11, iced-wayland features
- keep iced_winit dep (it's a misnomer — also hosts the wayland/cctk runtime)

Workspace:
- examples/* excluded (many depend on winit/x11) — revisited in a later phase

Behavior:
- Library builds clean in release with default features (cargo check + cargo build --release --lib OK)
- 58 lines in src/ gated on feature "winit" become unreachable (dead-code warnings — cleanup deferred)
- 108 lines gated on feature "wayland" now always active via default

--all-features is known-broken because tokio/async-std/smol are mutually
exclusive — this is pre-existing, not a Phase 2 regression.
2026-04-23 14:29:08 +02:00
255cf7cc0b rename: libcosmic → libcosmic-yoda (fork 0.1.0-yoda)
Fork point: pop-os/libcosmic 1.0.0 + perf/quickwins-bundle + macOS
window controls feature. From here the crate diverges under the yoda
lineage with its own versioning.

Changes:
- Cargo.toml: name = libcosmic-yoda, version = 0.1.0-yoda
- [lib] name = cosmic kept unchanged — consumer code still does 'use cosmic::...'
- examples/*/Cargo.toml: updated all libcosmic dep references to libcosmic-yoda
- i18n/*/libcosmic.ftl renamed to libcosmic_yoda.ftl (71 locales) to match
  the new name expected by fluent_language_loader!() macro

cargo check --lib passes. Examples not yet validated — Phase 2 (Wayland-only
cut) will rework them anyway.
2026-04-23 07:35:22 +02:00
5c3319351c header_bar: add WindowControlsPosition (macOS-style left controls)
Adds a new public enum `WindowControlsPosition { Start, End }` and a
matching field on `HeaderBar`, allowing window controls (close / minimize
/ maximize) to be packed on the start side of the headerbar (macOS
style, icon order close → minimize → maximize) instead of the default
end side (Linux / GNOME style, minimize → maximize → close).

Wiring:
- `crate::widget::WindowControlsPosition` re-exported alongside
  `HeaderBar`.
- `HeaderBar::controls_position(Option<WindowControlsPosition>)` setter;
  when left unset, falls back to `crate::config::window_controls_position()`
  (reads `CosmicTk.window_controls_position`), mirroring how `density`
  falls back to `header_size()`.
- New `CosmicTk.window_controls_position` field with default `End` for
  backwards compatibility; serde-friendly enum so existing configs keep
  working via `#[serde(default)]` semantics.

Tested with cosmic-yoterm, cosmic-settings, cosmic-edit, cosmic-files
rebuilt against this libcosmic via a local `[patch]` override. Config
changes picked up live through the existing cosmic-config subscription.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 15:08:12 +02:00
a322516f33 segmented_button: fix internal tab reorder end-to-end
Two independent bugs prevented tab drag-and-drop reorder from working
on cosmic-comp (and likely other compositors):

1. allow_reorder required DndAction::Move to be negotiated via
   OfferEvent::SelectedAction, which cosmic-comp does not always emit
   for self-drops (the SelectedAction event either never arrives or
   arrives with DndAction::empty()). Add a fallback: accept self-drops
   whenever state.dragging_tab is set. dragging_tab is only populated
   by start_tab_drag on this same widget, so this is safe; mime match
   and on_reorder presence are checked below.

2. reorder_event_for_drop preferred drop_hint.side over positional
   swap, producing counter-intuitive no-ops: dropping A (pos 0) on the
   left half of B (pos 1) resolved to "Before B" which, after removing
   A, lands at pos 0 again — the tab appeared not to move. Always use
   default_insert_position, which derives direction from dragged vs
   target positions (Konsole/Firefox/Chrome-style swap semantics).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 11:09:46 +02:00
108441ef61 segmented_button: add on_double_click callback
Fires in addition to on_activate when the same entity is left-clicked
twice within 400 ms. Lets applications bind quick actions (e.g. rename
a tab) without blocking the normal single-click activation path.

- New Widget::on_double_click builder mirroring on_activate/on_close.
- last_click field on LocalState for timestamp tracking.
- Detection branch in the mouse handler after on_activate fires, so the
  target entity is already focused when the callback runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 21:26:35 +02:00
1d98eee6de perf(widget): avoid VecDeque clone in segmented_button/table Model::clear
Model::clear() cloned the entire order VecDeque to iterate while
remove() mutated it, producing an O(n) allocation proportional to the
number of items — needless on a clear() which is going to drop all of
them anyway.

Replace the clone with std::mem::take(&mut self.order): we iterate the
taken VecDeque (transferring ownership), and the inner self.order.remove(index)
in each remove() call now finds position()==None and no-ops, since
self.order has been swapped with an empty default.

Same semantics, zero allocation. Noticeable on large nav/table models
(>100 items) and on apps that reset state frequently (settings pages,
file lists, context menus).
2026-04-19 16:29:02 +02:00
77262dd0af perf(malloc): throttle malloc_trim to 1 Hz in hot paths
malloc_trim(0) was called at the end of every update() and view(),
reaching 60-200 Hz during typical scrolling, resize, or animation.
Each call walks the glibc heap (10 us to several ms depending on
fragmentation) and could consume a substantial fraction of the frame
budget in worst cases.

Throttle trim() to once per second using a thread-local Instant,
preserving the existing API. RSS stays bounded (1 Hz is enough to
release collectable pages soon after) while per-frame cost becomes
a single thread-local check plus a duration comparison.

No call-site changes required; the three existing trim(0) invocations
in src/app/cosmic.rs (update, view multi-window, view single-window)
now fall under the throttle transparently.
2026-04-19 15:14:22 +02:00
Vukašin Vojinović
95756b1a57 improv(circular): prevent caps from touching
Some checks failed
Continuous Integration / format (push) Has been cancelled
Continuous Integration / tests (--no-default-features --features "") (push) Has been cancelled
Continuous Integration / tests (--no-default-features --features "applet") (push) Has been cancelled
Continuous Integration / tests (--no-default-features --features "desktop,smol") (push) Has been cancelled
Continuous Integration / tests (--no-default-features --features "desktop,tokio") (push) Has been cancelled
Continuous Integration / tests (--no-default-features --features "wayland") (push) Has been cancelled
Pages / pages (push) Has been cancelled
Continuous Integration / tests (--no-default-features --features "winit") (push) Has been cancelled
Continuous Integration / tests (--no-default-features --features "winit_debug") (push) Has been cancelled
Continuous Integration / tests (--no-default-features --features "winit_tokio") (push) Has been cancelled
Continuous Integration / tests (--no-default-features --features "winit_wgpu") (push) Has been cancelled
Continuous Integration / tests (-p cosmic-theme) (push) Has been cancelled
Continuous Integration / examples (application) (push) Has been cancelled
Continuous Integration / examples (context-menu) (push) Has been cancelled
Continuous Integration / examples (nav-context) (push) Has been cancelled
Continuous Integration / examples (open-dialog) (push) Has been cancelled
2026-04-18 16:08:34 -04:00
Vukašin Vojinović
c423ad1bfc improv(about): use ListButton 2026-04-17 13:52:08 +02:00
Vukašin Vojinović
8d7bcab258 fix(list_column): add back divider_padding
Also matches previous behavior of both paddings being applied to subsequent items, rather than globally.
2026-04-17 13:17:23 +02:00
Hojjat
c162a1f24a fix(animated-image): update frames and fix compilation errors 2026-04-16 19:58:39 +02:00
Vukašin Vojinović
3f9e93067b fix(item builder): remove unnecessary lifetime bound for radio 2026-04-16 18:26:17 +02:00
Vukašin Vojinović
917af9fda2 feat(radio): internal method for radio without label
Also adds the related settings item builder.
2026-04-16 17:19:36 +02:00
Vukašin Vojinović
9b465a8b5c feat(list_column): button list items 2026-04-16 17:19:36 +02:00
Vukašin Vojinović
9cac422c24 fix(toggler): animate external changes 2026-04-16 17:19:36 +02:00
Hojjat
0fc4638af3 fix: register image_extras in run_single_instance too 2026-04-15 23:59:57 +02:00
Hojjat
3d8d8915be chore: enable ico and xpm image support for desktop feature 2026-04-15 13:10:25 +02:00
Ian Douglas Scott
46d9f0c344 widget/icon: Bundle icons on macOS, not just Windows 2026-04-14 21:46:05 +02:00
Jeremy Soller
0d69cd9183
i18n: translation update from Hosted Weblate (#1177)
Translations update from [Hosted Weblate](https://hosted.weblate.org)
for [Pop
OS/libcosmic](https://hosted.weblate.org/projects/pop-os/libcosmic/).



Current translation status:

![Weblate translation
status](https://hosted.weblate.org/widget/pop-os/libcosmic/horizontal-auto.svg)
2026-04-14 09:52:02 -06:00
Hojjat
52116d2f36 chore: update iced 2026-04-13 22:26:33 +02:00
Hosted Weblate
0e72508dcc
i18n: translation updates from weblate
Co-authored-by: Amadɣas <massiin@proton.me>
Co-authored-by: Asier Saratsua Garmendia <asier.sarasua@gmail.com>
Co-authored-by: ButterflyOfFire <boffire@users.noreply.hosted.weblate.org>
Co-authored-by: Ettore Atalan <atalanttore@googlemail.com>
Co-authored-by: Geeson Wan <wang14240@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: 麋麓 BigELK176 <BigELK176@gmail.com>
Co-authored-by: 김유빈 <k.sein1016@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/pop-os/libcosmic/de/
Translate-URL: https://hosted.weblate.org/projects/pop-os/libcosmic/kab/
Translate-URL: https://hosted.weblate.org/projects/pop-os/libcosmic/ko/
Translate-URL: https://hosted.weblate.org/projects/pop-os/libcosmic/zh_Hant/
Translation: Pop OS/libcosmic
2026-04-12 18:50:19 +02:00
Jeremy Soller
1d7113a244
chore: update iced (#1240)
- [x] I have disclosed use of any AI generated code in my commit
messages.
- If you are using an LLM, and do not fully understand the changes it is
making to the code base, do not create a PR.
- In our experience, AI generated code often results in overly complex
code that lacks enough context for a proper fix or feature inclusion.
This results in considerably longer code reviews. Due to this, AI
authored or partially authored PRs may be closed without comment.
- [x] I understand these changes in full and will be able to respond to
review comments.
- [x] My change is accurately described in the commit message.
- [x] My contribution is tested and working as described.
- [x] I have read the [Developer Certificate of
Origin](https://developercertificate.org/) and certify my contribution
under its conditions.
2026-04-11 06:27:56 -06:00
Hojjat
e287a789c1 chore: update iced 2026-04-10 20:53:43 -06:00
Hojjat
6caccaba33 fix: icon color when window is maximized 2026-04-09 12:54:32 -04:00
Ashley Wulber
a44cff8011 fix(text_input): always clip input text with the text bounds
this issue seems unique to tiny-skia
2026-04-08 17:05:40 +02:00
Ashley Wulber
47ab72be50
fix!(progress_bar): remove unused generic Message type 2026-04-08 07:38:18 +02:00
Adam Cosner
c7093beca3 fix(ci): cargo now running properly 2026-04-08 07:34:13 +02:00
Adam Cosner
77b37f2246 fix(ci) removed the smithay and wayland protocol docs builds 2026-04-08 07:04:54 +02:00
Adam Cosner
6df3f76a33 ci: Added a few more enabled dependency docs 2026-04-08 07:04:54 +02:00
Adam Cosner
12d2233c6b fix(ci): Added an inline doc to cctk reexport 2026-04-08 07:04:54 +02:00
Adam Cosner
e5955b568d ci: Updated pages.yml workflow
Use nightly channel to enable docs generating feature badges, plus enabled more features in the docs build, and building the cctk docs also
2026-04-08 07:04:54 +02:00
Adam Cosner
5d1dfc4c54
refactor!: remove cosmic::iced_* re-exports 2026-04-08 03:12:10 +02:00
Ashley Wulber
d9121d6f0d refactor: better helpers for the progress_bar 2026-04-07 21:47:46 +02:00
Ashley Wulber
b963fbfea9
feat(widget): progress bars 2026-04-07 17:02:58 +02:00
Hojjat
724351727a feat: select until char and double click select delimiter
adds a feature to select from the start of the sentence until the last
occurrence of a character. This can be used to select until the
extension in cosmic-files save dialog or rename pop up.

Also, it adds a feature to select until the last occurrence of a
character on double-click.
2026-04-07 13:35:26 +02:00
Hojjat
1f87cbc883 fix: do not allow cursor or keyboard activity when popup is open
traps Tab from escaping, and won't allow elements in the background to
react to hover
2026-04-07 13:32:21 +02:00
Ashley Wulber
9aa87cd66b fix(segmented_button): active font for context menu & prioritize active font over hover 2026-04-06 18:57:27 -04:00
Hojjat
ab3eedd0f2 chore: update iced
This pulls in the fix in cosmic-text to fallback to the default
SansSerif if there are missing glyphs in basic shaping.

Also removes advanced-shaping from the default features list.
2026-04-06 15:15:30 -04:00
KENZ
8e3672a7dd fix: focus detecting in IME logic 2026-04-06 15:59:18 +02:00
Hojjat
1d01054993 chore: update iced
pulls in fixes for cycling focus
2026-04-03 19:23:40 -04:00
Vukašin Vojinović
fdf3369cea chore: re-export iced row and column
This removes the custom row and column implementations and uses the iced ones directly.
2026-04-03 20:39:31 +02:00
Vukašin Vojinović
a9e0671075 fix(segmented_button): hover text style 2026-04-03 20:36:23 +02:00
Ashley Wulber
34219d1fd4 chore: wgpu cctk feature for wayland 2026-04-03 20:15:31 +02:00
Ashley Wulber
cdd825b953 fix: update iced
softbuffer released version doesn't support transparency yet
2026-04-03 16:17:44 +02:00