Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#79739 - [telegram-desktop] Auto night mode missing

Attached to Project: Arch Linux
Opened by Victor Zamanian (victorz) - Tuesday, 19 September 2023, 20:24 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:19 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Felix Yan (felixonmars)
Jiachen Yang (farseerfc)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

The telegram-desktop package doesn't show the "Auto night mode/Match system settings" option anymore.

I could swear this was available before, but now it's missing.

The official builds from the telegram website work properly in this regard.

Additional info:
* package version(s):
telegram-desktop 4.9.8-1

* config and/or log files etc.
Not sure how to acquire logs from telegram-desktop...

* link to upstream bug report, if any:
https://github.com/telegramdesktop/tdesktop/issues/26782

Steps to reproduce:

1. Start telegram
2. Go to Chat settings
3. There should be a setting that allows you to match the system setting for dark/light theme, but it's gone now. See attached screenshot comparison.
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:19 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/telegram-desktop/issue s/2
Comment by q rty (q234rty) - Friday, 22 September 2023, 16:03 GMT Comment by Victor Zamanian (victorz) - Monday, 25 September 2023, 13:12 GMT
If I run Telegram like this:

> QT_QPA_PLATFORMTHEME=xdgdesktopportal telegram-desktop

I do get the option back in the chat settings. Could that be a solution? To use that launch command if the optional dependency `xdg-desktop-portal` is installed?
Comment by Victor Zamanian (victorz) - Monday, 25 September 2023, 13:20 GMT
Ugh, never mind. I get the option back to being visible in the settings, but enabling the option doesn't actually trigger the dark/light theme change on dark/light mode switching.
Comment by q rty (q234rty) - Monday, 25 September 2023, 13:28 GMT Comment by Victor Zamanian (victorz) - Tuesday, 26 September 2023, 08:26 GMT
So in all honesty, I don't know if I understand fully yet. Is this something we can expect to be fixed in QT in the not-so-distant future, or do we need to patch this for the foreseeable future? Thanks, and sorry if this isn't the "ask questions" kind of medium.
Comment by Antonio Rojas (arojas) - Tuesday, 26 September 2023, 08:45 GMT
We are not going to patch Qt with unofficial patches from third party projects. It is upstream's responsibility to get their changes merged in Qt. If someone relies on features that require a patched Qt, they should switch to flatpak for now.
Comment by q rty (q234rty) - Tuesday, 26 September 2023, 08:48 GMT
We could maybe patch telegram instead like I mentioned in the first comment?
Comment by q rty (q234rty) - Tuesday, 26 September 2023, 08:52 GMT
Alternatively, those who want to get this working now using extra/telegram-desktop could use a platform theme that provides the necessary code for dark mode switching to work, e.g. qgnomeplatform (which unfortunately has just been dropped from the official repos).
Comment by Victor Zamanian (victorz) - Tuesday, 26 September 2023, 11:14 GMT
I've switched to flatpak for now, because I get flash-banged every time I open Telegram at night these days. x_x Thank you for your replies! I'll keep an eye on the conversation here though, because ideally I'd just like to use the Arch package. <3
Comment by Sven-Hendrik Haase (Svenstaro) - Tuesday, 26 September 2023, 12:01 GMT
We tried a static patched version of qt once but it gave us all kinds of other issues. I'm really not sure what the best way forward would be here.
Comment by q rty (q234rty) - Tuesday, 26 September 2023, 12:03 GMT
I would just patch telegram instead...
Comment by Sven-Hendrik Haase (Svenstaro) - Tuesday, 26 September 2023, 13:09 GMT
Perhaps, if that is maintainable over longer periods of time. Care to make a patch against the current package?
Comment by q rty (q234rty) - Tuesday, 26 September 2023, 15:29 GMT
Beware that this is untested though, as I do not yet have the resources to build tdesktop.
Comment by Ilya Fedin (ilya-fedin) - Wednesday, 27 September 2023, 00:26 GMT
Patching tdesktop would get rid of xsettingsd dark mode support (with QT_QPA_PLATFORMTHEME=gtk3). Why patching tdesktop and getting rid of the advantages of Qt plugin architecture when you can encourage developers of such plugins like qt6ct to support this feature? That's against Arch Linux philosophy after all.
Comment by Sven-Hendrik Haase (Svenstaro) - Wednesday, 27 September 2023, 00:35 GMT
Ilya, it was my assumption that you guys already tried to upstream this but somehow upstream didn't take it and as such you patched Qt6 downstream. If this hasn't happened yet, we could try to get the ball rolling from Arch but generally speaking, it'd be better if application developers communicated their needs directly with the toolkit devs. Distros are just the ducttape/middlemen.
Comment by Ilya Fedin (ilya-fedin) - Wednesday, 27 September 2023, 00:44 GMT
Well, it's not a proper fix to be upstreamed, the proper fix would be for Qt to watch for portal changes. I'm also afraid submitting the None == Light mapping cause all the bureaucracy they have. My personal hope is that the initial implementer (https://codereview.qt-project.org/c/qt/qtbase/+/396655) will step up and finish the implementation. Personally I'm tired of their bureaucracy for a while, so don't expect me to upstream anything that big in near months. You can also try to report this to Qt bugtracker and mass-upvote the report so maybe they will prioritize this and fix in a way they would like.

The current situation doesn't look that bad for me: the gtk3 plugin supports this properly and qt6ct could get an implementation if someone would actually care.
Comment by q rty (q234rty) - Wednesday, 27 September 2023, 02:54 GMT
> the gtk3 plugin supports this properly

In my testing w/ extra/telegram-desktop and `QT_QPA_PLATFORMTHEME=gtk3` dynamic switching works both ways when tdesktop was started in light theme, but when tdesktop was started in dark theme it doesn't work at all, maybe it's a bug in tdesktop somewhere?
Comment by Ilya Fedin (ilya-fedin) - Wednesday, 27 September 2023, 03:20 GMT
QT_LOGGING_RULES=qt.qpa.gtk.debug=true should show what Qt thinks about your color scheme
Comment by q rty (q234rty) - Wednesday, 27 September 2023, 07:57 GMT
OK the reason for that seems to be gtk-application-prefer-dark-theme=1 in my gtk-3.0/settings.ini, which is of course not reloaded when the system theme changes. Removing that line fixed dynamic switching with the gtk3 platform theme, but 1) the GNOME control center dark mode toggle does not change the gtk3 theme 2) the gtk3 platform theme forces the gtk3 filechooser which does not have grid view, unlike the gtk4 x-d-p-gnome or other portals like -lxqt or -kde.

Now, my two cents:

Short term we can patch telegram to optionally force the old behavior via a runtime env var instead of a build time switch, or we can package qgnomeplatform for a bit longer and tell people on GNOME to use that instead.

Long term, ideally a portal listener could be upstreamed (there's already one in https://invent.kde.org/qt/qt/qtbase/-/blob/dev/src/gui/platform/unix/qgenericunixthemes.cpp?ref_type=heads, maybe it can be somehow reused?) But unknown->light should still be handled inside telegram, though I'd say that the portal platformtheme shouldn't fallback to the base theme in the case of None.
Comment by Ilya Fedin (ilya-fedin) - Wednesday, 27 September 2023, 08:02 GMT
Qt::ColorScheme::Unknown is documented as "The appearance is unknown." and so handled accordingly (unsupported -> the checkbox is hidden)

The portal's no-precedence (-> None -> Unknown) has another meaning: use app's default mode. There's no 1:1 mapping in Qt.

Mapping Unknown as Light on Telegram level will lead to problems when there's no portal and on other platforms without system dark mode support.
Comment by Ilya Fedin (ilya-fedin) - Wednesday, 27 September 2023, 08:13 GMT
> there's already one in https://invent.kde.org/qt/qt/qtbase/-/blob/dev/src/gui/platform/unix/qgenericunixthemes.cpp?ref_type=heads, maybe it can be somehow reused?

Yeah, it's a weird one, they create a listener but never use it. I created QTBUG-116197 a while ago about that but given their philosophy of highly relying on XDG_CURRENT_DESKTOP it might be that xdgdesktopportal will never be used outside of flatpak/snap and this QGenericUnixTheme may never evolve. A way forward might be for someone to contribute a GTK4+libadwaita QPT to support these modern GNOME things.
Comment by Ilya Fedin (ilya-fedin) - Wednesday, 27 September 2023, 08:14 GMT
For now, the gtk3 QPT behavior is the intended one from their PoV, even if you don't like it.
Comment by Ilya Fedin (ilya-fedin) - Wednesday, 27 September 2023, 08:16 GMT
> Short term we can patch telegram to optionally force the old behavior via a runtime env var instead of a build time switch, or we can package qgnomeplatform for a bit longer and tell people on GNOME to use that instead.

Or you can create a small custom QPT. Or you can add support to qt6ct. Such won't be that small anymore and all the other options don't require patching.
Comment by Ilya Fedin (ilya-fedin) - Wednesday, 27 September 2023, 08:17 GMT
*Such patch

Loading...