Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Following system color scheme #50

Open
bragefuglseth opened this issue Jul 12, 2024 · 12 comments
Open

Following system color scheme #50

bragefuglseth opened this issue Jul 12, 2024 · 12 comments

Comments

@bragefuglseth
Copy link
Contributor

bragefuglseth commented Jul 12, 2024

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

@hepp3n
Copy link
Collaborator

hepp3n commented Aug 24, 2024

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.

@bragefuglseth
Copy link
Contributor Author

bragefuglseth commented Aug 24, 2024

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.

@hepp3n
Copy link
Collaborator

hepp3n commented Aug 24, 2024

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.

@bragefuglseth
Copy link
Contributor Author

bragefuglseth commented Aug 24, 2024

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
Copy link
Contributor Author

Seems like it does.

@hepp3n
Copy link
Collaborator

hepp3n commented Aug 24, 2024

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: pop-os/libcosmic@42ac099

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
Copy link
Collaborator

hepp3n commented Aug 24, 2024

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
Copy link
Collaborator

hepp3n commented Aug 24, 2024

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
Copy link
Collaborator

hepp3n commented Aug 24, 2024

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

@bragefuglseth
Copy link
Contributor Author

bragefuglseth commented Aug 24, 2024

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.

@hepp3n
Copy link
Collaborator

hepp3n commented Aug 24, 2024

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

@hepp3n
Copy link
Collaborator

hepp3n commented Aug 25, 2024

@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: pop-os/libcosmic#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.

@edfloreshz edfloreshz moved this to Todo in WebApps Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants