web-apps icon indicating copy to clipboard operation
web-apps copied to clipboard

Following system color scheme

Open bragefuglseth opened this issue 2 years ago • 13 comments

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).

bragefuglseth avatar Jul 12 '24 18:07 bragefuglseth

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.

hepp3n avatar Aug 24 '24 14:08 hepp3n

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.

bragefuglseth avatar Aug 24 '24 14:08 bragefuglseth

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.

hepp3n avatar Aug 24 '24 14:08 hepp3n

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?

bragefuglseth avatar Aug 24 '24 14:08 bragefuglseth

Seems like it does.

bragefuglseth avatar Aug 24 '24 14:08 bragefuglseth

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.

hepp3n avatar Aug 24 '24 14:08 hepp3n

Ok, it seems it should be done by xdg-desktop-portals. I will look into cosmic's one and see if it's implemented.

hepp3n avatar Aug 24 '24 15:08 hepp3n

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.

hepp3n avatar Aug 24 '24 15:08 hepp3n

@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?

hepp3n avatar Aug 24 '24 15:08 hepp3n

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.

bragefuglseth avatar Aug 24 '24 19:08 bragefuglseth

Thank you for your testing. Tomorrow im gonna fix and will test it better. At least we have some errors ^^

hepp3n avatar Aug 24 '24 19:08 hepp3n

@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.

hepp3n avatar Aug 25 '24 17:08 hepp3n

Implemented in #129 — Running app status indicators via /proc scanning.

olafkfreund avatar Feb 13 '26 17:02 olafkfreund