Menu

#2416 CLI option -minimize causes unusable window on Linux/Wayland

KeePass_2.x
closed
nobody
None
5
2026-02-18
2026-02-15
No

When starting KeePass with mono KeePass.exe -minimize on Linux using Wayland with KDE Plasma/KWin, the application window frame appears but is empty/ghosted and unusable. The application must be restored from the tray to become usable.

This behavior is very similar to the existing Bug #1418 ("Minimizing a form while loading it doesn't work"), where minimizing the form during the
OnLoad event causes issues on Mono/X11/Wayland.

KeePass already has a workaround for Bug #1418 (checking MonoWorkarounds.IsRequired(1418)), which prevents the configuration-based "Start Minimized" setting from minimizing the window during
OnLoad. However, this workaround is currently not applied when the minimization is triggered via the command line argument -minimize.

Proposed Fix: Extend the check for MonoWorkarounds.IsRequired(1418) to the MinimizeToTrayAtStartIfEnabled method in MainForm_Functions.cs. This ensures that even when triggered by the command line, minimization is deferred until the form is fully shown (handled by OnFormShown), avoiding the rendering issue.

Proposed Patch:

--- KeePass/Forms/MainForm_Functions.cs
+++ KeePass/Forms/MainForm_Functions.cs
@@ -4513,6 +4513,9 @@

        private void MinimizeToTrayAtStartIfEnabled(bool bFormLoading)
        {

+           // Workaround for https://sourceforge.net/p/keepass/bugs/1418/
+           if(bFormLoading && MonoWorkarounds.IsRequired(1418)) return;
+
            if(GetStartMinimized())
            {
                if(bFormLoading)

Discussion

  • Dominik Reichl

    Dominik Reichl - 2026-02-17

    On which operating system have you tested this?

    I've just tested KeePass 2.60 on an up-to-date Kubuntu 25.10 system (with KDE/Wayland) and the --minimize command line option resulted in the following:

    • When the option 'Minimize to tray instead of taskbar' is turned off, the main window is displayed as usual (not minimized, but also not empty/ghosted).
    • When the option 'Minimize to tray instead of taskbar' is turned on, the main window is hidden and can be displayed via the tray icon, as expected.

    Thanks and best regards,
    Dominik

     
    • Robert Gerlach

      Robert Gerlach - 2026-02-17

      I am using KeePass 2.60 on CachyOS with Wayland/KDE. The option 'Minimize to tray instead of taskbar' is enabled.

       

      Last edit: Robert Gerlach 2026-02-17
  • Dominik Reichl

    Dominik Reichl - 2026-02-18
    • status: open --> closed
     
  • Dominik Reichl

    Dominik Reichl - 2026-02-18

    Okay, thanks! I've tested it on CachyOS now and can reproduce the issue.

    With your proposed workaround, an empty/ghosted window occurs less frequently, but it still does occur occasionally (in my tests, this happened on every tenth start on average). Therefore, I've changed the new line to if(MonoWorkarounds.IsRequired(1418)) return; such that KeePass minimizes neither to the taskbar nor to the tray at start (this is consistent with the minimization options and the documentation on https://keepass.info/help/base/cmdline.html).

    Thanks again and best regards,
    Dominik

     

Log in to post a comment.