keepassxreboot / keepassxc

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

Incorrect auto theme when starting minimized #10947

Open SinnySupernova opened 5 months ago

SinnySupernova commented 5 months ago

Overview

Auto theme doesn't respect dark system theme when KeePassXC is started with "Minimize window at application startup" enabled

Steps to Reproduce

  1. Enable "Minimize window at application startup" in Settings -> General
  2. Relaunch KeePassXC and open the UI by clicking the tray icon

Expected Behavior

Auto theme inherits dark system theme

Actual Behavior

Auto theme is light

Context

Everything works as expected when "Minimize window at application startup" is disabled

KeePassXC - Version 2.7.9 Revision: 8f6dd13

Qt 5.15.14 Debugging mode is disabled.

Operating system: Artix Linux (Arch based) CPU architecture: x86_64 Kernel: linux 6.9.5-zen1-1-zen Desktop Env: KDE Plasma 6 Windowing System: Wayland

droidmonkey commented 5 months ago

I can't replicate this

image

SinnySupernova commented 5 months ago

I tried to record a video of it. And it's even weirder - it's inconsistent. Sometimes it works and applies the dark theme, sometimes it does not.

Edit: Moreover, it does not seem to depend on the setting being enabled

Is there any way I could gather and provide more information?

droidmonkey commented 5 months ago

This is most certainly related in some way to your desktop environment and/or theme and/or wayland. You might be running keepassxc in X11 through xwayland which could certainly mess with stuff.

SinnySupernova commented 5 months ago

It was indeed running through XWayland. After installing qt5-wayland (which doesn't seem to be in optional dependencies of the keepassxc package) KeePassXC is running in Wayland native mode.

But the theme issue is still happening all the same, unfortunately I couldn't figure out any pattern yet. When I repeatedly close/reopen the program without changing any settings, the theme that's set is seemingly random.

Screencast_20240624_181017.webm

The program seems to apply the correct application theme every time after a restart, however if I log out and log in (same user), the tray menu icons theme is wrong and the app theme is correct: image

In this scenario, when not minimized on start, KeePassXC seems to first set the light app theme, then changes it to dark shortly, but the tray icons don't reflect that change.

droidmonkey commented 5 months ago

@phoerious may need a periodic check for linux

phoerious commented 5 months ago

Rather than doing that we should check for the org.freedesktop.appearance.color-scheme DBus interface. I don't know whether all desktops implement this yet, but that'd be the way to go.