Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support live theme switching for Linux #7146

Closed
shbach opened this issue Nov 19, 2021 · 10 comments · Fixed by #7422
Closed

Support live theme switching for Linux #7146

shbach opened this issue Nov 19, 2021 · 10 comments · Fixed by #7422

Comments

@shbach
Copy link

shbach commented Nov 19, 2021

Summary

Live theme switching works for Windows and Mac but on Linux I still need to close and reopen the application for the theme to switch.

Context

Getting feature parity would be most appreciated as having to manually close the app, reopen the app, and finally unlock the database again is not ideal.

@phoerious
Copy link
Member

This is supported already, check your KeePassXC version.

@shbach
Copy link
Author

shbach commented Nov 19, 2021

@phoerious In what version was support added? I'm on 2.6.6 which is the latest available.

@phoerious
Copy link
Member

Not sure. Long ago. Live switching is supported for light and dark mode on all platforms. Only switching between our themes and the classic theme isn't, because too many components need to be redrawn and the UI ends up a complete mess.

@droidmonkey
Copy link
Member

If you are using the snap distribution that has a hard time picking up themes. That is a known problem with snaps in general.

@phoerious
Copy link
Member

phoerious commented Nov 20, 2021

To be clear: By live switching I mean clicking the desired theme option in the view menu without a restart. KeePassXC doesn't detect if your desktop theme changed, because Linux desktops don't send the appropriate signals for that. If you mean this, then there is indeed a feature imparity, which we can do absolutely nothing about.

@shbach
Copy link
Author

shbach commented Nov 20, 2021

@droidmonkey I'm not using snap/flatpack but what is available in the package manager (Solus Linux).

@phoerious I am indeed referring to detecting if the system theme changed and updating accordingly when using the "Automatic" theme option. KeePassXC is actually essentially the only app on Linux I use that doesn't update on system theme change. e.g. Firefox, Geary, all the GNOME apps, Signal, Joplin, etc all update fine without needing a restart but I guess KeePassXC is implemented differently?

If I use the "Classic" theme option, then KeePassXC actually does update on system theme change without needing a restart (for the most part) but there are elements that remain illegible:
image
image

Unless I restart:
image
image
In which case it then displays as expected.

@phoerious
Copy link
Member

The classic theme simply uses your system's Qt theme, so that it out of our hands, but tends to work.

In the other hand, it is not possible to detect that for our custom themes, because there is no real indication as to whether the new theme is a "dark" theme or not. Our way of detecting that when you choose "Automatic" is to check whether the current palette is "light-ish", but that only works once at startup before we modify the palette with our custom theme. Secondly, there isn't even a signal that we could listen for when a theme change happens. We could check if there are some global QEvents being sent around, but that is highly desktop-specific.

@shbach
Copy link
Author

shbach commented Nov 21, 2021

Oh I see. I guess it's because this uses Qt and everything else I listed as being able to do it uses GTK.

vimpostor added a commit to vimpostor/keepassxc that referenced this issue Feb 16, 2022
The new org.freedesktop.appearance.color-scheme key allows us to do this
in a reliable way.

Recently freedesktop standardized the system dark mode preference in a
desktop environment independent way in the xdg-desktop-portal
specification.

The specification can be seen here: https://github.com/flatpak/xdg-desktop-portal/blob/d7a304a00697d7d608821253cd013f3b97ac0fb6/data/org.freedesktop.impl.portal.Settings.xml#L33-L45

KDE supports this since KDE Plasma 5.24 and Gnome supports this since
Gnome 42.

Relevant blog post: https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/

Fixes keepassxreboot#7146
vimpostor added a commit to vimpostor/keepassxc that referenced this issue Feb 16, 2022
The new org.freedesktop.appearance.color-scheme key allows us to do this
in a reliable way.

Recently freedesktop standardized the system dark mode preference in a
desktop environment independent way in the xdg-desktop-portal
specification.

The specification can be seen here: https://github.com/flatpak/xdg-desktop-portal/blob/d7a304a00697d7d608821253cd013f3b97ac0fb6/data/org.freedesktop.impl.portal.Settings.xml#L33-L45

KDE supports this since KDE Plasma 5.24 and Gnome supports this since
Gnome 42.

Relevant blog post: https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/

Fixes keepassxreboot#7146
droidmonkey pushed a commit that referenced this issue Feb 18, 2022
The new org.freedesktop.appearance.color-scheme key allows us to do this
in a reliable way.

Recently freedesktop standardized the system dark mode preference in a
desktop environment independent way in the xdg-desktop-portal
specification.

The specification can be seen here: https://github.com/flatpak/xdg-desktop-portal/blob/d7a304a00697d7d608821253cd013f3b97ac0fb6/data/org.freedesktop.impl.portal.Settings.xml#L33-L45

KDE supports this since KDE Plasma 5.24 and Gnome supports this since
Gnome 42.

Relevant blog post: https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/

Fixes #7146
@shbach
Copy link
Author

shbach commented Mar 20, 2022

@phoerious

In the other hand, it is not possible to detect that for our custom themes, because there is no real indication as to whether the new theme is a "dark" theme or not.

It may be possible now:
https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/
https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/Dark-Style-Preference

@phoerious
Copy link
Member

Coming in 2.7 with #7422.

t-h-e pushed a commit to t-h-e/keepassxc that referenced this issue Sep 8, 2022
The new org.freedesktop.appearance.color-scheme key allows us to do this
in a reliable way.

Recently freedesktop standardized the system dark mode preference in a
desktop environment independent way in the xdg-desktop-portal
specification.

The specification can be seen here: https://github.com/flatpak/xdg-desktop-portal/blob/d7a304a00697d7d608821253cd013f3b97ac0fb6/data/org.freedesktop.impl.portal.Settings.xml#L33-L45

KDE supports this since KDE Plasma 5.24 and Gnome supports this since
Gnome 42.

Relevant blog post: https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/

Fixes keepassxreboot#7146
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants