Commit graph

59 commits

Author SHA1 Message Date
Vukašin Vojinović
cf19ac665f chore: update dependencies 2026-01-27 18:07:35 -07:00
Michael Aaron Murphy
03c440b97a
chore(cargo): update all crate dependencies 2026-01-14 18:46:53 +01:00
Frederic Laing
c2b7d7847a feat: add Flatpak sandbox support for config paths
Implement get_config_dir() and get_state_dir() helper functions that detect
Flatpak sandboxing via FLATPAK_ID and use HOST_XDG_CONFIG_HOME/HOST_XDG_STATE_HOME
environment variables or fallback to HOME-based paths.

This allows libcosmic apps running in Flatpak sandboxes to properly read
system-wide COSMIC configuration (themes, corner radii, etc.) from the host.
2025-12-04 11:30:03 -07:00
Ian Douglas Scott
bb6f6e9ac8 improv(cosmic-config): Remove unneeded trait bounds for subscriptions
It looks like these functions where previously implemented in a
different way that required these traits, but now it uses
`Subscription::run_with_id`, the `id` only needs to be `Hash + 'static`.
2025-11-10 11:17:53 -08:00
Cheong Lau
bd438a8581 perf: reduce memory allocations
This also changes `widget::column::with_children` and
`widget::row::with_children` to take an `impl IntoIterator` instead
of a `Vec`, like the `iced` variants of these functions do.

This shouldn't be a breaking change since passing in a `Vec` will still
compile and function exactly as before.

(Using `iced::widget::Column::from_vec` or
`iced::widget::Row::from_vec` isn't possible, since the elements of the
`Vec` aren't checked, so the size of the resulting `Column` or `Row`
won't adapt to the size of its children. Perhaps a new function could
be added to mirror `iced`'s?)
2025-10-22 04:30:57 +02:00
Cheong Lau
a27bb5e05d chore: apply clippy suggestions 2025-10-05 04:40:51 +02:00
Vukašin Vojinović
e568122083 fix(context_drawer): title alignment
Something caused text alignment to break, so this gets around it by wrapping the text in a container.
2025-09-11 10:49:26 -04:00
Vukašin Vojinović
ea349aca82 chore: use std::syncLazyLock
Also migrates workspace members to Rust 2024.
2025-09-03 21:54:46 +02:00
Vukašin Vojinović
b72b15d719 chore: update dependencies 2025-09-03 21:54:46 +02:00
Ian Douglas Scott
66a2632e2e fix(cosmic-config): Fixes for error printing
* Use `tracing::error!` in places where `eprintln!` was used
* Loop over errors and print seperately
* Print errors with `Display` rather than `Debug`
* Don't print errors that should be ignored
  - Matches https://github.com/pop-os/libcosmic/pull/949, for same
    reasons.

With this, and the previous change, cosmic-panel no longer spams a bunch
of config errors from different applets on start.
2025-08-23 00:49:31 +02:00
Ashley Wulber
0943f131c2 refactor: track focus chain 2025-07-16 22:23:13 +02:00
8roken
52b802a11a fix(cosmic-config): Avoid dual notifications in transaction commits
When a transaction gets committed, the files gets written to a file in
the .atomicwrite[0-9a-Z] folder and then gets moved to their final
location. The watcher will emit two events:

- Modify(Name(To))
- Modify(Name(Both)

The last one will include both the source and the destination and is
essentially a duplicate of the first event. By discarding this event,
behavior seems to be the same, and all consumers of those events get
only notified once instead of twice when a configuration changes.
2025-06-27 19:57:35 +00:00
Ashley Wulber
7555d9dfd1 cargo fmt 2025-06-25 19:37:52 -04:00
Jeremy Soller
a85b369399 Fix config watching 2025-06-23 11:20:48 -06:00
Michael Aaron Murphy
1af2f4ffe5
chore: format 2025-06-23 17:50:28 +02:00
Michael Aaron Murphy
90ad3e9e1b
improv(cosmic-config): use notifier debouncer on inotify watchers 2025-06-23 17:13:58 +02:00
Ian Douglas Scott
25322e0263
feat!: update zbus from 4.x to 5.x 2025-05-23 00:02:23 +02:00
Michael Aaron Murphy
8cf372c9b9
perf: inline public getters/setters, and use non-generic inner functions
To reduce compile-times and avoid some overhead to binary size, this will modify some of our
generic functions to use non-generic inner functions where possible. The inner functions are
marked carefully with `#[inline(never)]` to prevent being inlined by LLVM at their callsites

While looking for generic functions to optimize, I have also taken the opportunity to annotate
public non-generic getters and setters with `#[inline]` to ensure that LLVM will inline them
across crate boundaries. By default, only generic functions are automatically inlined, and
only when enabling fat LTO are constant functions reliably inlined across crate boundaries.
2025-03-21 13:31:34 +01:00
Michael Aaron Murphy
92b2756e26
chore: update dependencies; including ron 0.9 2025-03-21 13:20:45 +01:00
Ashley Wulber
50d2104485 fix: include config id in subscription id 2025-03-09 06:05:01 +01:00
Michael Aaron Murphy
580db26868
fix(cosmic_config): is_err method conditions reversed 2025-02-14 22:42:50 +01:00
Michael Aaron Murphy
cd8f4ee859
fix(cosmic_config): treat errors getting key_path in get_local as NotFound 2025-02-14 22:39:09 +01:00
Michael Aaron Murphy
ccc1068d9f
feat(cosmic_config): add ConfigGet::get_{local,system_default}
Required by https://github.com/pop-os/cosmic-settings/pull/975 to a modify a config
containing a HashMap which is used to partially-override the system default config
in the compositor.
2025-02-14 21:44:08 +01:00
Victoria Brekenfeld
fdfd80f8b1 chore: Update ron to 0.9 2025-01-22 15:50:44 +01:00
Ashley Wulber
3f2ba11d56 refactor: send initial config after watching for changes 2024-12-31 11:23:28 -05:00
Ashley Wulber
0491c4baaa libcosmic updates 2024-10-18 14:04:39 -04:00
Victoria Brekenfeld
61760f8e4e cosmic-config: Update calloop 2024-06-26 16:16:31 +02:00
Michael Aaron Murphy
0d4c3db162
chore(doc): inline re-exported API docs 2024-05-20 17:19:42 +02:00
Ashley Wulber
78a137214d chore: update zbus 2024-05-17 00:00:24 +02:00
Ashley Wulber
6a97435263 fix(cosmic-config): attempt to reconnect to the settings daemon 2024-05-12 21:27:22 +02:00
Ashley Wulber
dd952bbfdb feat: custom config path 2024-04-09 22:36:18 +02:00
Victoria Brekenfeld
cc439b2cea chore: Update calloop 2024-03-26 14:51:33 +01:00
Ashley Wulber
d6b87a0222 chore: update gtk4-output for the theme to set adwaita named colors
This is still a bit incomplete, and some apps use their own custom variables as well, for example the text editor.
2024-03-18 14:49:40 -06:00
Ashley Wulber
52491e08ee fix(config): check default_path if key_path fails 2024-03-08 14:15:25 -07:00
Ashley Wulber
3e6f314c6b refactor: support loading a Config exclusively for reading the system settings 2024-03-08 12:23:54 -05:00
Gary Guo
3aef16bf9e improv(cosmic-config): remove hardcoded paths
This commit changes the hardcoded /usr/share paths in cosmic-config to
become performed via XDG lookups using the `xdg` crate.

This allows the installed files to be discovered on non-FHS Linux, e.g.
NixOS.

Hardcoded /var/lib/ is removed entirely because
1. nothing installs to it yet (only user of new_state is cosmic_bg
   currently and it does not install to /var/lib)
2. it's intended for system states, not template for user state.
3. it's not part of XDG spec.

On Windows the known folder crate is used.

Signed-off-by: Gary Guo <gary@garyguo.net>
2024-01-24 19:08:19 +01:00
Ashley Wulber
efe4ce2f5b refactor: config improvements 2024-01-18 20:19:32 -07:00
Jeremy Soller
94a1bbdaa5 cosmic-config: pretty print config file data 2024-01-12 09:57:08 -07:00
Ashley Wulber
eff22fdb34 chore(cosmic-config): update to include state and remove ping/pong 2024-01-02 15:12:14 +01:00
Ashley Wulber
e1c53277d9 cleanup 2024-01-02 15:12:14 +01:00
Ashley Wulber
06c33dcf06 refactor: optional config subscriptions using dbus 2024-01-02 15:12:14 +01:00
Ashley Wulber
a4d1b1b651 refactor: cosmic-config granular key updates and remove unused generics from cosmic-theme 2024-01-02 15:12:14 +01:00
Ashley Wulber
9202383596 chore: update to 0.12 2023-12-04 17:53:24 -05:00
danieleades
8e99406a8b
chore: fixing linter warnings 2023-11-28 20:02:08 +01:00
Jeremy Soller
be62ed4a7d Add config_state_subscription for watching config states 2023-11-27 15:09:57 -07:00
Jeremy Soller
afdac36219 Use forked atomicwrites for Redox support 2023-11-16 08:06:07 -07:00
Ashley Wulber
7cc791a3f5
feat: add support for dark / light mode switching (#178)
* feat: add support for dark / light mode switching and simultaneouscustom light / dark mode themes

* refactor(color-picker): optional initial color and fallback color

* refactor: used FixedPortion for layout of the settings item

This makes sure that the control always has at least the specified portion of the available space

* refactor: make all members of the ThemeBuilder public

* refactor: add and update palette colors

* fix(theme): typo and derive PartialEq for ThemeBuilder

* fix: update color picker usage

* feat: add more variables to the theme

* fix: radius on headerbar

* fix: Theme CosmicConfigEntry impl

* chore: specify rev of taffy

* fix: theme CosmicConfigEntry missing variables

* fix: apply theme type when theme mode changes

* wip: add plus icon to empty color picker button

* chore: fix rev and imports

* refactor(color-picker): allow custom size for the icon

* refactor(color_picker): make color_button public

* update iced
2023-10-16 16:19:04 -04:00
Michael Aaron Murphy
32eafb0c48 chore(config): apply rustfmt 2023-10-12 16:37:38 +02:00
Jeremy Soller
f0005165f3 cosmic-config: Add new_state constructor for storing state 2023-10-09 09:27:03 -06:00
Victoria Brekenfeld
f91287dec2
chore: Update calloop (#173)
* chore: Update calloop

* chore: Allow compiling without windowing system

* CI: Add test without any features
2023-10-02 17:51:33 +02:00