telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.23k stars 5.2k forks source link

Follow system theme #27888

Closed PanderMusubi closed 5 months ago

PanderMusubi commented 5 months ago

Is your feature request related to a problem?

Other software, including direct messaging desktop applications such as Signal and WhatsApp, have an option for the theme to follow the system theme. That is the theme set by the desktop environment. In this way the user can switch theme for all applications in one place.

Describe the solution you'd like

That Telegram Desktop application has an option (preferably the default) to follow the system theme (GNOME / Pop!_OS / COSMIC / KDE). If a theme needs to be mapped, map Day on Light and Tinted on Dark.

Screenshot from 2024-05-07 16-26-26

Screenshot from 2024-05-07 16-26-19

Describe alternatives you've considered

Changing the theme manually, but is a low of work if you need to change the theme a few times per day when switching physical working location (indoor/outdoor e.g.)

Additional context

Implementing this would make Telegram Desktop more complaint to what is industry standard regarding this and save the user a lot of unneed actions.

ilya-fedin commented 5 months ago

There is automatic night mode which you can enable in Settings -> Chat Settings (needs support for your system in Qt though).

Regarding full system theme support, this is not possible without a full rewrite, sorry.

PanderMusubi commented 5 months ago

The automatic night mode is what I was looking for.

When switching in gnome-settings, like the screenshot above, Telegram indeed changes to and from night mode.

However, version Telegram Desktop 4.16.8 it does not switch to and from night mode when the appearance is changed via the command line. Other apps do switch after running these commands. I'm using:

gsettings set org.gnome.desktop.interface gtk-theme Pop
gsettings set org.gnome.desktop.interface gtk-theme Pop-dark

Also to test with are:

gsettings set org.gnome.desktop.interface gtk-theme Default
gsettings set org.gnome.desktop.interface gtk-theme HighContrast

Can automatic night mode also pick upchanges made like this via the command line?

ilya-fedin commented 5 months ago

@PanderMusubi no, you're changing gtk theme with those commands, not the light/dark mode, while tdesktop written not in gtk and so can't inherit its theme. You should find commands to switch between light and dark mode like what you do in the UI.

PanderMusubi commented 5 months ago

Thanks, this led me to:

#!/usr/bin/env sh

if test "$(gsettings get org.gnome.desktop.interface color-scheme)" = "'prefer-light'"; then
  gsettings set org.gnome.desktop.interface color-scheme prefer-dark
  gsettings set org.gnome.desktop.interface gtk-theme 'Pop-dark'
else
  gsettings set org.gnome.desktop.interface color-scheme prefer-light
  gsettings set org.gnome.desktop.interface gtk-theme 'Pop'
fi

And now Telegram Desktop follow like via the UI.