You are not logged in.
Hello!
I'm trying to configure my system with a global dark theme. I do this on Sway (running Wayland) and want to do the config only through commands or configuration files (since this allows easier reinstall / synchronization between my computers).
For the sake of documentation, I succeeded in this mostly by taking the advice from https://wiki.archlinux.org/title/Dark_mode_switching (installing gnome-themes-extra, adwaita-qt5 and adwaita-qt6 before adding the GTK_THEME=Adwaita:dark and GTK2_RC_FILES=/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc environment variables into /etc/environment). In addition, to get vlc to be dark as well, I had to install qt5ct, ran it to select the "darker" custom theme and added QT_QPA_PLATFORMTHEME=qt5ct . Some color adjustments will be necessary for readability / fitting in with the Adwaita theme, but that's another story.
My problem is that applications which support both light and dark mode are NOT automatically set to dark mode. Rather, they seem to prefer light mode. This is the case even after several attempts of setting "gsettings set org.gnome.desktop.interface color-scheme prefer-dark". One example would be keepassxc, which, when set to automatic Design / appearance, remains in light mode. The (seemingly) relevant code for the program handling the dark / light mode check is
--(src/gui/osutils/nixutils/nixutils.cpp)------------------------------------------------------- (Repo: https://github.com/keepassxreboot/keepassxc )
bool NixUtils::isDarkMode() const
{
// prefer freedesktop "org.freedesktop.appearance color-scheme" setting
if (m_systemColorschemePrefExists) {
return m_systemColorschemePref == ColorschemePref::PreferDark;
}
if (!qApp || !qApp->style()) {
return false;
}
return qApp->style()->standardPalette().color(QPalette::Window).toHsl().lightness() < 110;
}
-------------------------------------------------------------------------------------------------------
This suggests to me that color-scheme is indeed the right key to adjust. And since the Qt color palette (seemingly the fallback below) isn't used, I assume the program does find some kind of color scheme pref, just not the right one.
Strangely, automatic dark mode selection works on my laptop! I set that machine up a year ago and don't remember the configuration steps. In any case, disabling / hiding any of my .config/gtk-x.0 config files / folders and moving over the .config/dconf (which seems to contain the gsettings) from my laptop to my current machine did not do the trick.
Any ideas on how I can proceed with this? Strictly speaking I could also set the dark themes in those applications by hand (and backup their configurations for my reinstall / synchronization scripts), but that's very unsatisfying seeing that it somehow works flawlessly on my laptop.
Last edited by Archy-223 (2023-04-14 13:10:42)
Offline
These applications likely use the XDG portal API to query this setting. You'll need to have a portal service running, for sway the proper implementation is probably xdg-desktop-portal-wlr
Offline
Thanks for the suggestion! Unfortunately, this did not solve the problem.
I installed xdg-desktop-portal-wlr (in addition to xdg-desktop-portal ). When this didn't help, I ensured that 'dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway' is executed in my sway config, as is recommended by xdg-desktop-portal-wlr on its github page. I also installed dex so that I could autorun Desktop files on startup by executing "dex -a" in my sway config. KeePassXC still goes white when switching to "Automatic" design.
Offline
So presumably the wlr portal service doesn't implement that portal interface… does installing xdg-desktop-portal-gtk help? That'd expose the gnome color-scheme setting on the portal API.
Offline
Perfect! Simple installation of xdg-desktop-portal-gtk solved the issue. Now I only need to fight for Okular to follow my dark themes... thank you!
Offline
@Archy-223 did you manage to make Okular follow your theme? if so, could you detail? Thanks!
water vapor is invisible
Offline
...I actually just gave up and didn't do it. Until you reminded me, that is!
What I did is pacman -Syu kvantum , then in qt5ct I selected the Style "kvantum" and in kvantummanager I went to the "Change / delete theme" collapse to choose a fitting theme. For me, KvGnomeDark works.
Okular should now no longer burn your eyes (apart from the list of recently opened files). Unfortunately, for whatever reason, the "Welcome to Okular" text AND the current pdf page number are both black instead of grey. An oversight on Okular's part maybe? I tried to adjust the palette in qt5ct, but it didn't seem to apply, so I'll just live with it.
Hope that worked for you. Do let me know in case you find a fix for that last little issue. Cheers!
Offline
posted with wrong account
Last edited by tgy (2023-08-13 15:14:54)
Offline
thanks a lot mate this worked!
water vapor is invisible
Offline
posted with wrong account
Let me help you with that. Multiple accounts are not allowed. Since your other account has more posts and is older, I am going to ban this one.
Offline