keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
20.92k stars 1.44k forks source link

System theme not followed - sway #9892

Open motorto opened 12 months ago

motorto commented 12 months ago

Overview

The system theme is not respected.

Steps to Reproduce

  1. Minimal sway
  2. gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
  3. open keepassxc

Actual Behavior

The light theme is always selected.

Context

If I run

gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'

$ gsettings get org.gnome.desktop.interface color-scheme
'prefer-dark'

When opening keepassxc the dark theme should be selected.

debug info

KeePassXC - Version 2.7.6
Revision: dd21def

Qt 5.15.7
Debugging mode is disabled.

Operating system: Void Linux
CPU architecture: x86_64
Kernel: linux 6.5.5_2

Enabled extensions:
- Auto-Type
- Browser Integration
- SSH Agent
- KeeShare
- YubiKey
- Secret Service Integration

Cryptographic libraries:
- Botan 2.19.3

Operating System: Linux Desktop Env: sway Windowing System: Wayland


Open to send more information. And maybe an explanation on how the detection of system theme is done, could help me figuring whats wrong (with my setup, probably)

droidmonkey commented 12 months ago

Do you have your KeePassXC theme set to automatic?

Dark theme is determined here:

https://github.com/keepassxreboot/keepassxc/blob/develop/src/gui/osutils/nixutils/NixUtils.cpp#L88-L99

motorto commented 12 months ago

Yes.

On 23/10/02 04:53PM, Jonathan White wrote:

Do you have your KeePassXC theme set to automatic?

-- Reply to this email directly or view it on GitHub: https://github.com/keepassxreboot/keepassxc/issues/9892#issuecomment-1743934470 You are receiving this because you authored the thread.

Message ID: @.***>

phoerious commented 12 months ago

For the most part, this is Gnome being buggy, see #7817. We don't explicitly listen to org.gnome.desktop.interface color-scheme, but to the freedesktop signals. If Gnome doesn't send them anymore, we may need to add them as well.

motorto commented 12 months ago

I have the xdg-desktop-portal-gtk + xdg-desktop-portal-wlr both installed (and running) but when executing the query in https://github.com/keepassxreboot/keepassxc/issues/7817#issuecomment-1092210362, I don't have an expected output instead:

$  qdbus org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read "org.freedesktop.appearance" "color-scheme"

Cannot find 'org.freedesktop.portal.Settings.Read' in object /org/freedesktop/portal/desktop at org.freedesktop.portal.Desktop

Probably some missing functionality on the portals ?

motorto commented 12 months ago

Just to add installing the flatpak version the dark/light detection works properly !

droidmonkey commented 12 months ago

Likely flatpak portal doing a translation for us between gnome and freedesktop standards

CRCinAU commented 11 months ago

Just as a note, with both Fedora 38, and Fedora 39 + Gnome 45, I note that when KeepassXC starts with the system, it always selects the light theme.

If you close and open KeepassXC again, the correct theme is selected.

If you turn off Dark Mode, then turn it on again, the correct theme is applied to KeepassXC.

I live in Dark Mode however, so I manually changed the theme within KeepassXC to Dark.

droidmonkey commented 11 months ago

That would indicate that keepassxc is starting too soon, or we are not dynamically registering the theme detection through dbus.

CRCinAU commented 11 months ago

For what its worth, this is what it looks like set to Dark theme, and auto-started with login: image

After exiting and loading KeepassXC again, it looks like this: image

Note that both the theme, and the min / max buttons in the titlebar are wrong.

droidmonkey commented 11 months ago

Title bar color and min max styling are not controlled by KeePassXC. Those are set by the window styling of the compositor. I think you need to add a delay to starting KeePassXC to resolve this.

WhyNotHugo commented 10 months ago

I'm using darkman on sway to expose the value via org.freedesktop.portal.Settings and can confirm that it works fine.

Using gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' will only affect some GNOME applications (I have an impression that this is deprecated anyway). I believe you need xdg-desktop-portal-gnome for the setting to translate into a portal setting.

motorto commented 10 months ago

I'm using darkman on sway to expose the value via org.freedesktop.portal.Settings and can confirm that it works fine.

Using gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' will only affect some GNOME applications (I have an impression that this is deprecated anyway). I believe you need xdg-desktop-portal-gnome for the setting to translate into a portal setting.

I am using darkman also (Thanks for developing it). And yes I don't have the xdg-desktop-port-gnome installed,

I only have:

Going to give it a try ! (but shouldn't the gtk portal be agnostic and the gnome only used when using the gnome desktop env ???)

WhyNotHugo commented 10 months ago

xdg-desktop-port-gnome is gnome-specific. You're using a gnome-specific setting (org.gnome.desktop.interface color-scheme) and want it exposed via the portal interface, then you need the gnome-specific portal impl.

FWIW: darkman also exposes a portal interface. Maybe you're missing a portals.conf for it to be used? The gnome one also won't be used without a portals.conf file.

motorto commented 10 months ago

Assuming I understood correctly what you meant I don't need to install the xdg-desktop-gnome if the darkman is configured properly right ? (btw, I am the packager/maintainer of darkman for void)

The content of my /usr/share/xdg-desktop-portal/portals.conf is the following:

[preferred]
default=*

I also have the darkman portal at /usr/share/xdg-desktop-portal/portals/darkman.portal

[portal]
DBusName=org.freedesktop.impl.portal.desktop.darkman
Interfaces=org.freedesktop.impl.portal.Settings
UseIn=sway
zoechi commented 4 months ago

I'm not sure if it is relevant but I just set the environment variable NIXOS_OZONE_WL=1 to make Chrome start with OZone=Wayland and KeePassXC started with light theme this time even though it always used dark theme before. I hat to set the Dark theme explicitely in the KeePassXC settings to get it back.