-
-
Notifications
You must be signed in to change notification settings - Fork 250
feat(linux): Add support for system color scheme using xdg-desktop-portal #1141
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
base: dev
Are you sure you want to change the base?
Conversation
Package Changes Through 03ca810There are 1 changes which include tao with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
62c01be to
adc4e82
Compare
adc4e82 to
efc732b
Compare
I downgraded |
|
1.77 is fine since that's tauri's msrv |
|
the real problem though is the dependence on tokio or smol as we try or tried to keep tao and wry runtime agnostic and using dbus/zbus would also make it harder to get back to winit rust-windowing/winit#1549 🤔 really not sure how to proceed so i'll wait for feedback from the others. does ashpd require the |
Ah, good to know! But let's wait for others feedback first before making any further changes.
I could switch to tokio, but that would likely require async-compat then, as it's not possible to spawn tokio futures directly from glib. But yes, ashpd either requires the |
|
hmm that sucks 😅 |
|
@FabianLars if the dependency on any async runtime is truly a blocker, we could also directly call the portal with dbus. That would suck though, since we'd basically re-implement parts of ashpd then. You mentioned that you'll wait for feedback from others, who specifically do you mean? |
|
@amrbashir is the closest we have to a tao maintainer though idk how active he is at the moment. If he's unavail or has no opinion we could also ask @lucasfernog and @Legend-Master . If they don't have an opinion either i'll have to follow whatever winit decides/decided on 🤷 |
|
If we are going with the async runtime route, I think it'll have to be in feature flags, defaults could be discussed though |
|
What would be your preference @Legend-Master? Reimplement with dbus-rs or using ashpd? |
I don't know how much work would it take to re-implement it in |
3e5b826 to
7c04b06
Compare
|
Reimplemented using dbus-rs instead of ashpd/zbus 👍 |
|
sorry i was away over the weekend. we actually deliberately got rid of dbus-rs in the past eg tauri-apps/tauri#6332 so idk how to feel about this. I think i'll pull myself out of this PR (i'm away for 2 weeks anyway). |
|
I will wait with further changes until it is clear what is desired and what is not :/ To summarize, the current available options are:
|
Do you remember the reason for that? (also it seems like tauri currently doesn't depend on dbus nor zbus)
Personally I would prefer this, but take my opinion with a pinch of salt, I'm not the most familiar with the Linux ecosystem Also I feel like we shouldn't be as strict as winit when considering these things, that's part of the reason why we branched out right? And, I'm travelling from 11th to ~25th this month so I probably can't reply between this time period |
Linked in the PR. basically linking to a system library was a pain 🤷
correct, a few plugins use zbus (single-instance and notification come to mind)
to a degree yes, but we're also looking to get back to winit. as long as we still use webkitgtk we still need our own linux backend though (much work on their side going on to make that possible next release(s))
Safe travels and have fun :) |
|
Hey folks, I hope you had a great vacation / time off! :) I wanted to follow up to see if there is any new info on how we are proceeding with this PR so that Linux will get dark mode support as well. I summarized the possible options in #1141 (comment) - let me know what you think. |
|
I believe re-introducing dbus-rs should be avoided if possible. Knowing the zbus community we probably would get a PR "fixing" that later on :D Also whatever we'll use we should put the dependency behind a feature flag. Speaking of, how about we mirror rfd's approach and offer both zbus-tokio and zbus-smol/async-std ? I'd really love to avoid the latter in tauri downstream (even considering the downsides of the tokio version you mentioned) but it may help other tao consumers not using tauri.
btw, without this i would have turned down this PR in favor of something downstream (easy to do but obv would keep ThemeChange noop on linux) |
If we can't use |
Alright,
Just to make sure, if I understood you correctly, I would add a |
|
yep. though i don't care which flag will be the default, we could even have neither in the defaults 🤷 |
If possible, it would be great, of course if the system color scheme would just work without developers manually opting in to it 😀 |
595fdc3 to
27d1020
Compare
|
It's now possible to choose between If you don't choose anything, or have This means that if consumers of |
|
Thanks for implementing the feature flags!
This is a bit of a no-go since we have to keep a tokio & asyncstd free option for a few users. Should be an easy fix though by marking the 3 deps as optional and having both feature flags enable it. plus a few
I get the sentiment but the lockfile change is a bit intense so we shouldn't take that decision lightly. |
3270532 to
a7104e7
Compare
Done 👍
I understand your concerns, but I fear that if this is not enabled by default on Tauri's side, hardly any developers will actively opt in - which would be a shame, because Tauri is one of the few remaining frameworks that does not yet support the new system “color-scheme” standard on Linux environments. |
|
it will be enabled on the tauri side (without opt-out probably) which is also why i wanted a tokio option cause that would make the most sense there. my concerns were only about tao (and wry) for those hardcore users (or those building frameworks on top of it like dioxus) |
|
I am happy to hear that, seems like we misunderstood your intentions :) |
Use the Linux XDG Desktop Portal to add support for the system color scheme. This works independently of the Linux distribution, desktop environment or toolkit used. If the system colour scheme changes to "dark mode", the window will adjust automatically.
For reference: https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Settings.html
Screencast.From.2025-08-29.09-30-17.webm
Closes: