Score:1

GTK File Picker can't be set to dark mode on 23.04

in flag

I've tried both the vanilla GNOME session and the Ubuntu session, I've tried using the toggle or the command line ('gsettings set org.gnome.desktop.interface color-scheme prefer-dark'), I've tried .deb apps and Flatpak ones and while all apps respect the light/dark setting, bringing up the file picker in any of them will bring up a light mode version of it even when using dark mode.

Is everyone having the same problem? And if so, have you found a solution?

Edit: Upon further experimentation, some of what I said above seems to not be accurate. For one, some .deb programs will indeed call the dark mode file picker (for example, gnome-text-editor), but they have to be programs that use libadwaita to call on the new file picker, ie. the one that has a thumbnail view. So gnome-text-editor will call the new one, while gedit will call the old one.

But other .debs (notably Chrome) as well as all Flatpaks and Snaps (including libadwaita apps and the Firefox Snap) will call the light mode file picker no matter what. So what I assume is happening is probably a bug with xdg-desktop-portal not being able to detect the light/dark mode preference. I'll keep digging but this lowers my hopes of finding a fix fox this...

Edit 2: I have found this bug which matches the issue. Hopefully it gets activity, so at least it will be useful for tracking. Haven't found a corresponding bug upstream, so I'm now making a VM to see if I can reproduce the issue on other distros using GNOME 44.

Edit 3: Testing on a Fedora Silverblue 38 VM, the issue was not reproducible, so this does seem like an Ubuntu issue.

starkus avatar
de flag
There is an option you can set using `tweaks`. It's under the `appearance` tab. It's about using the dark theme for older applications. Maybe turning on this option let's you get rid of your trouble.
Philippe Lepaffe avatar
in flag
Do you mean by setting a dark GTK theme for older applications? That's something I had already done, but is not related to this issue (it only applies to GTK3 programs, and the new file picker is made in GTK4).
starkus avatar
de flag
Yap, that's what I thought could help. Hope you'll find a fix...
Score:2
ng flag

This is happening due to the Ubuntu version of libadwaita not respecting the light/dark choice, probably because of this change https://git.launchpad.net/ubuntu/+source/libadwaita-1/commit/?id=5dadba0afcf778a84aa82a7449ea1e395745b57e.

Here's a lauchpad bug: https://bugs.launchpad.net/ubuntu/+source/libadwaita-1/+bug/2013126

I sent a patch to it, hope it can help

In the meantime, adding ADW_DEBUG_COLOR_SCHEME=prefer-dark to /etc/environment and rebooting should help.

Philippe Lepaffe avatar
in flag
Adding the variable to /etc/profile didn't help in my case, but I might be doing it wrong. Thanks for sending the patch, hopefully it will get the ball rolling on getting it fixed !
Gregory Khvatsky avatar
ng flag
Hm, that's strange. Could you try running `ADW_DEBUG_COLOR_SCHEME=prefer-dark /usr/libexec/xdg-desktop-portal-gtk -v -r` in a terminal, keep it in the background, and then testing the offending apps?
Philippe Lepaffe avatar
in flag
This command does not work for me either, however `ADW_DEBUG_COLOR_SCHEME=prefer-dark /usr/libexec/xdg-desktop-portal-gnome -v -r` did. Both Chrome and various Flatpaks properly called on the dark file chooser after doing this (and went back to calling the light mode file chooser upon closing the terminal session). As for adding the variable to `/etc/profile`, again I may just have not done so properly, dealing with environment variables isn't something I do often.
Gregory Khvatsky avatar
ng flag
I thunk you should use `export ADW_DEBUG_COLOR_SCHEME=prefer-dark` in /etc/profile (https://unix.stackexchange.com/questions/117467/how-to-permanently-set-environmental-variables). Sorry for the confusion, I was just doing a lot of experiments with different portals on my machine.
Philippe Lepaffe avatar
in flag
That didn't work either, however adding `ADW_DEBUG_COLOR_SCHEME=prefer-dark` in `/etc/environment` did ! I think the reason it didn't work your way is because I use zsh as my shell, not bash. But this works, as far as I can tell. Thanks for pointing me in the right direction ! I won't mark this as solved quite yet, as I want to wait and see what comes out of the bug report on Launchpad first, but again thanks for the help !
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.