nheko icon indicating copy to clipboard operation
nheko copied to clipboard

Dark mode "system" does not work

Open WhyNotHugo opened this issue 3 years ago • 8 comments

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

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

image

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

WhyNotHugo avatar Apr 28 '22 19:04 WhyNotHugo

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.

WhyNotHugo avatar Apr 28 '22 19:04 WhyNotHugo

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?

WhyNotHugo avatar Apr 28 '22 19:04 WhyNotHugo

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

LorenDB avatar May 01 '22 12:05 LorenDB

The D-Bus parameter sounds interesting, though. I might look into using it for first run theme configuration.

LorenDB avatar May 01 '22 12:05 LorenDB

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:

WhyNotHugo avatar May 01 '22 15:05 WhyNotHugo

Qt6 also has an Application property if thr system is using a dark or light mode

deepbluev7 avatar May 01 '22 16:05 deepbluev7

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.

WhyNotHugo avatar May 01 '22 17:05 WhyNotHugo

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.

LorenDB avatar May 01 '22 20:05 LorenDB

@WhyNotHugo your setting is "light". Theme should be light.

JeanPaulLucien avatar Jan 03 '23 14:01 JeanPaulLucien

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.

WhyNotHugo avatar Mar 28 '23 15:03 WhyNotHugo

It should just work correctly once we switch to Qt6 :)

deepbluev7 avatar Mar 28 '23 17:03 deepbluev7

Should be fixed now :)

deepbluev7 avatar Jun 08 '23 21:06 deepbluev7