Following system color scheme
The app doesn't seem to follow the system color scheme (default, prefer-light, prefer-dark, etc.) Admittedly I don't know if this is an issue with the app or libcosmic, but if possible, it would be nice if it followed the system color scheme automatically (as defined by the freedesktop portal).
If I'm not wrong for COSMIC desktop it can communicate via dbus to set proper color scheme, not sure about different desktops. libcosmic should be able to follow system wide set color scheme but also don't know how it will works in sandbox.
We have a standardized way to do this; the org.freedesktop.appearance.color-scheme key in the XDG settings portal. GNOME, KDE and Pantheon uses this, so I'd be surprised if COSMIC doesn't as well. In fact, I assumed that libcosmic was following it OOTB already, but I guess that's not the case, then.
Thank you! I will follow this and look how cosmic handle it. It should be implemented in portal right?
I assumed that libcosmic was following it OOTB already, but I guess that's not the case, then.
Well, I'm not a professional programmer or something like that, just a hobbyist and doing what I'm like to doing, so I assume the issue may be on my side instead of libcosmic. Just need to look closer into it but info provided by you is helpful. Thank you.
Apps built with libadwaita just follow the portal setting without any manual work from the developer side; I assume that the same would be ideal for libcosmic as well. Does libcosmic have a way to read and interact with the system styling like Adw.StyleManager?
Seems like it does.
Yeah, if we talking about COSMIC desktop it will follow system color scheme very well including custom colors etc. The problem comes when we are working on different desktops. I made a PR for GNOME to follow preference from gsettings: https://github.com/pop-os/libcosmic/pull/412/commits/42ac0991a876e0db5cf2fceca532e22da5e9f8e7
I'm not sure how to apply this for flatpak. From what I know, for COSMIC it should communicate via dbus if I'm not wrong, but not sure about different desktops.
Ok, it seems it should be done by xdg-desktop-portals. I will look into cosmic's one and see if it's implemented.
Well, we got it in xdg-desktop-portal, so basically what you gave before. Ok. I got something, probably it should be easy to add.
@bragefuglseth, I made some changes. Can't really test it on my device since I'm using only COSMIC on my computers so everything is working, would you be able to test it somehow?
The app is still always in dark mode. I get these errors:
2024-08-24T19:07:33.809047Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTheme.Mode
2024-08-24T19:07:33.809063Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTk
2024-08-24T19:07:33.809070Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTheme.Dark
2024-08-24T19:07:34.810227Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTk
2024-08-24T19:07:34.810250Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTheme.Dark
2024-08-24T19:07:34.810264Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTheme.Mode
2024-08-24T19:07:36.810776Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTk
2024-08-24T19:07:36.812088Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTheme.Dark
2024-08-24T19:07:36.812107Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTheme.Mode
2024-08-24T19:07:40.811955Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTk
2024-08-24T19:07:40.813343Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTheme.Dark
2024-08-24T19:07:40.813366Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTheme.Mode
2024-08-24T19:07:48.813264Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTk
2024-08-24T19:07:48.815123Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTheme.Dark
2024-08-24T19:07:48.815153Z ERROR cosmic_config::dbus: Failed to create watcher for com.system76.CosmicTheme.Mode
I'm running Fedora Silverblue 39, and tested the app both by building it in a toolbox and by building the flatpak.
Thank you for your testing. Tomorrow im gonna fix and will test it better. At least we have some errors ^^
@bragefuglseth, Hello again. I found an issue and solution for this :P
Those errors comes from dbus-config feature flag. We need to have configured cosmic-settings-daemon with dbus to make it work. Instead of this, I patched libcosmic: https://github.com/pop-os/libcosmic/pull/584 (so we should wait) and made a change for Quick WebApps. If they merge this PR, it should works as expected.
In this implementation we just losing changing color scheme on runtime. But it will require more work to fix it. For now I think this should do the job.
Implemented in #129 — Running app status indicators via /proc scanning.