Bug 143302 - Detect switches between dark and light GTK themes and automatically switch to the corresponding icon set when available
Summary: Detect switches between dark and light GTK themes and automatically switch to...
Status: RESOLVED DUPLICATE of bug 127138
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.0.5.2 release
Hardware: All Linux (All)
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks: UI-Theming Linux-Dark-Mode
  Show dependency treegraph
 
Reported: 2021-07-11 19:30 UTC by Jeff Fortin Tam
Modified: 2022-10-04 13:05 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Fortin Tam 2021-07-11 19:30:52 UTC
LibreOffice already has dark variants for two of its icon themes (Sifr and Breeze). I wish more of its icon themes (particularly Colibre and Sukapura) had dark variants, but this is not the issue today.

What I'm reporting today is that when the GTK theme changes, LibreOffice should detect if it's the normal version of a theme or if it's a dark variant, and then, if it has a compatible icon theme (that has a light and dark variant), switch the icon theme accordingly, automatically. Otherwise, things typically are unrecognizeable in dark mode.

This is particularly noticeable when you have systems where the OS (or a script, or an extension such as https://extensions.gnome.org/extension/2236/night-theme-switcher/). For what it's worth, Firefox does it and handles it beautifully, without needing user intervention or an app restart, when its theme is set to "system"; so it's possible, theoretically & technically speaking.
Comment 1 Heiko Tietze 2021-07-19 12:00:21 UTC
Yes, it's desirable. But can we detect whether the OS runs a dark or bright theme? Haven't looked into bug 127138 but it seems to be solved for Qt-based systems.
Comment 2 Jeff Fortin Tam 2021-07-19 14:32:01 UTC
> can we detect whether the OS runs a dark or bright theme?

I would think so, because Firefox manages to do it live without a restart. If you switch between light and dark GTK themes (or any GTK themes for that matter) and you're running the "system" toolbar style, Firefox will adapt everything as soon as you switch the GTK theme, and this also affects things like the "new tab" page. So I'm thinking, if Firefox can do it, surely there's a way for LibreOffice to do it too.
Comment 3 Jeff Fortin Tam 2022-03-20 19:33:39 UTC
Update (as further response to Heiko's previous question): this is now much more easily feasible, technically speaking, because there now is a standardized (i.e. FreeDesktop) way for LibreOffice to authoritatively know, without just trying to "guess" whether the current GTK theme is dark or not, what the user's intent is in terms of light/dark themes.

* Overview here: https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/
* Implementation tips here: https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/Dark-Style-Preference

With this knowledge of the user's intent and the system's state, LibreOffice would now be able to switch between the two in realtime with a clear standardized signal, and also it could now allow tighter integration, such as allowing the user to specify in the preferences if they want not just the UI/toolbars/icons to switch between light and dark when the system switches, but also whether they want to automatically use the "LibreOffice Dark" color scheme at the same time or if they want their documents' editing view rendering to remain black-on-white.

Many applications already support this with GNOME 42 and Elementary OS 6, even non-purely-GTK applications such as Firefox.
Comment 4 Timur 2022-10-04 09:11:09 UTC
3 notes here:

(In reply to Jeff Fortin Tam from comment #0)
> LO already has dark variants for two of its icon themes (Sifr and Breeze). 
> I wish more of its icon themes (Colibre and Sukapura) had dark variants...
Colibre has dark.

I'm in favor of marking a duplicate of bug 127138 and broadening the scope. And marking it High for a number of duplicates. 

This should also work if "Automatic" is selected, which is now Elementary icons.
Comment 5 Jeff Fortin Tam 2022-10-04 12:59:43 UTC
> Colibre has dark.

Indeed I have noticed that in the latest version, seems to be a fairly recent addition.

> I'm in favor of marking a duplicate of bug 127138 and broadening the scope. And marking it High for a number of duplicates. 

I'd suggest marking 127138 as a duplicate of this here instead, since this already has a clearer (and more searchable, from a keywords standpoint) title and description and set of recommendations. Bugzilla will make the dupes of the dupe follow along.

> This should also work if "Automatic" is selected, which is now Elementary icons.

The problem is that "Automatic" doesn't let the user set a preference for a particular theme (ex: I think the "elementary" theme is not sharp/clear enough, and I prefer to use some of the more symbolic ones, and usually Colibre is abotf the best) even if I'm on Linux.

Automatic shouldn't be an option, it should just be how it works by default; each theme should have light and dark variants, and switch between the variants automatically based on the detected system theme. Then the combobox menu of themes reverts to just being a choice of icon themes, the dark vs light notion being automatically managed behind the scenes instead of manually exposed in the GUI.
Comment 6 Timur 2022-10-04 13:05:50 UTC
(In reply to Jeff Fortin Tam from comment #5)
> I'd suggest marking 127138 as a duplicate of this here instead, since this
> already has a clearer (and more searchable, from a keywords standpoint)
> title and description and set of recommendations. Bugzilla will make the
> dupes of the dupe follow along.

It will not, all dupes remain, and that is older bug.

*** This bug has been marked as a duplicate of bug 127138 ***