-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
KeePassXC immediately minimizes to tray when restoring from tray icon #1595
Comments
I’m observing the same behavior, also on Arch + XFCE. Basically, if I click repeatedly on the tray, I run into a flicker - restore - minimize cycle instead of a restore - minimize cycle. I tried looking in the code, and I couldn’t figure out much, IIRC I saw that shortly after the toggleWindow call that restores the window, there’s a single changeEvent call after it where isMinimized() is still true (the calls following this return false) and this causes the code to send the window again to the tray (this is what causes the flicker). If I click the tray icon again, the isMinimized() call in changeEvent returns false correctly and the restore works. Maybe there’s a chance this is something about Qt? I saw some similar bugs in their tracker from 2014 but they closed them without much explanation. Would be nice if we had more people try out on their desktop environment to narrow the issue. |
I tested it today on Windows, and clicking on the tray icon restores the window (without the flicker effect), but clicking on it again doesn't seem to hide it. So it seems it's only useful for restoring the window on Windows... weird |
I'm using XFCE 4.12 as well but I can't reproduce this (clicking on the icon opens a menu with |
The issue only happens if bot options are enabled ("Minimize window at application startup" and "Hide window system tray when minimizes") it's like the application tries to minimize after restoring the first time from tray. |
I can reproduce it on KDE. It's something I've been noticing for a while, but haven't had the time to fix. |
As I said, I observe a spurious changeEvent() call with isMinimized()=true when restoring the window. This is followed later by another changeEvent() call with isMinimized()=false. I'm not sure what causes it, but this code seems to work around it:
Code quality stuff aside, what this does is basically cancel the single shot timer event set by a changeEvent with isMinimized()=true if it is immediately followed by a changeEvent with isMinimized()=false. I'm not sure if this kind of dirty workaround is the best we can aim for, or if there is a more clean way of solving this... By the way, it's worth remarking again that for me at least, the bug happens even without the "Minimize at startup" option, and that I can reproduce over and over by repeatedly clicking the tray icon in order to minimize/restore the window repeatedly, while the original bug seems to point to other circumstances. EDIT: Just installed LXDE in my system, and there I can reproduce the behavior pointed out in the original bug report... it only happens when both "Minimize at startup" and "Minimize to tray" are checked, and only when restoring the window for the first time. It doesn't happen any longer. In this case, I detected two relevant behavior differences:
|
qttest.zip |
Got some more results, and what may be a pretty clean solution. Excuse my long write-ups :) I set up some VMs, and I found this:
Basically there are two separate issues at play there:
This can happen both on start (this is the case of the original bug report), if
Or when clicking on the tray icon to hide the window, the window is both minimized and hidden by code on
On Windows, when clicking on the tray icon when the window is visible, Tentative fix/workaround for all those issues:
For the Linux issue, I avoid both minimizing and hiding the window at the same time by code. It should suffice to only hide the window if the event is caused by a tray icon click. For the Windows issue, I just removed the check for I have done some tests on my local system and VMs and didn't experience any regression and all the three buggy cases disappeared... can someone review this patch and/or test it on his local system? |
Thanks a lot for your thorough investigation. I think the minimize call on macOS is a relic of times when we had no tray icon on macOS. |
I have sent a PR, hopefully I didn't mess up in any of the PR process steps 😛. |
Fix/work around KeePassXC flickering and not restoring from tray on some Linux systems, which happens if the window is hidden and minimized by code at the same time (see issue #1595).
Fix unreliable check on toggleWindow() which causes Windows systems to be unable to hide the window by clicking on the tray icon (see issue #1595).
Does not seem to be fixed, see #2088 |
…oot#1595). Fix/work around KeePassXC flickering and not restoring from tray on some Linux systems, which happens if the window is hidden and minimized by code at the same time (see issue keepassxreboot#1595).
…xreboot#1595) Fix unreliable check on toggleWindow() which causes Windows systems to be unable to hide the window by clicking on the tray icon (see issue keepassxreboot#1595).
…tray (fix CI build).
When starting KeePassXC with "Minimize window at application startup" and "Hide window system tray when minimizes" immediately minimizes to tray when restoring from tray icon for the first time.
This happens with XFCE with or without composite manager (xfwm4 or compton), didn't try with other desktop environment.
Expected Behavior
Main window should minimized when restored from system tray
Current Behavior
Window always minimizes immediately when restored for the first time
Issue video demo
Steps to Reproduce (for bugs)
Debug Info
KeePassXC - Version 2.3.0
Revision: 4c0ed74
Libraries:
Operating system: Arch Linux
CPU architecture: x86_64
Kernel: linux 4.14.22-1-lts
Enabled extensions:
XFCE4 - 4.12
The text was updated successfully, but these errors were encountered: