nheko
nheko copied to clipboard
Dark mode "system" does not work
Describe the bug
Picking theme "system" does not switch light / dark mode according to the system setting. It's just light all the time.
To Reproduce
- In Settings > General, under "Theme" pick "System".
What happened?
Just a light theme (the system is currently in dark mode due to it being night time)
Expected behavior
Should be dark mode right now.
Screenshots

Version
0.9.3-9bac429
Operating system
Linux
Installation method
Flathub
Qt version
(included in flatpak)
C++ compiler
No response
Desktop Environment
swaywm (wayland)
Did you use profiles?
- [ ] Profiles used?
Relevant log output
Nothing present.
Backtrace
No response
Being a cross-platform app, maybe additional notes are useful:
There's currently a relatively new spec to determine whether the system should currently be in light mode or dark mode. It's queried via D-Bus using the org.freedesktop.portal.Settings interface.
It's supported on Gnome, ElementaryOS and KDE. I myself have authored and maintain darkman, a little daemon that switches dark mode / light mode for non-DE users. It implements this same spec.
I tried monitoring D-Bus when nheko runs, and its seems it's not querying the current mode at all -- so maybe this feature is not implemented for Linux?
The system theme option means that nheko will try to use whatever Qt theme you have set on your computer instead of using one of its bundled themes. To override the Qt theme, you'll want to set QT_QPA_PLATFORMTHEME to a Qt theme (e.g. breeze, kvantum, or qt5ct).
The D-Bus parameter sounds interesting, though. I might look into using it for first run theme configuration.
Oh, right. Given that the only other two choices are "dark" and "light", I though that theme simply toggled dark mode. My bad.
To override the Qt theme, you'll want to set QT_QPA_PLATFORMTHEME to a Qt theme (e.g. breeze, kvantum, or qt5ct).
I guess I could have a wrapper script that sets that based on the current mode -- but given that it's an environment variable, I can't later [programatically] change the theme at runtime.
Sounds like what I'm asking for is really a new feature, not a bug (sorry, misinterpreted what that setting does). Support for the D-Bus setting would be super :+1:
Qt6 also has an Application property if thr system is using a dark or light mode
Qt6 also has an Application property if thr system is using a dark or light mode
This sounds very reasonable. I expect Qt to use the above mentioned API... if it doesn't, then it's something I'd rather report to Qt itself.
I don't think it's necessarily a Qt issue. I'd suggest trying to make a script setup that changes the Qt theme in qt5ct, and then set your system Qt theme to qt5ct.
@WhyNotHugo your setting is "light". Theme should be light.
qt5ct breaks other applications (and their icons). I prefer to stick as close as possible to the defaults.
It seems that what I'm trying to change is known in Qt as "colour scheme", not "theme". I guess this also can't be changed at runtime?
The D-Bus parameter sounds interesting, though. I might look into using it for first run theme configuration.
There's also an associated signal to receive notifications each time it changes.
It should just work correctly once we switch to Qt6 :)
Should be fixed now :)