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

Auto-Type under Windows 11 won’t react if focus is on Desktop or Start Menu bar #11247

Open gitflo opened 2 months ago

gitflo commented 2 months ago

Overview

Running on Windows 11, Auto-Type won’t react if the focus is on Desktop or Start Menu bar. On Windows 10 with the same program version, configuration, and database, it works. A workaround in case of the Start Menu bar is to add “Program Manager” to the Auto-Type window assignments of the desired Keepass entry.

Steps to Reproduce

  1. Click on an empty area on the Windows 11 Desktop, or an empty area on the Windows 11 Start Menu bar
  2. Hit Auto-Type keyboard shortcut

Expected Behavior

Keepass Auto-Type window will show up.

Actual Behavior

Nothing happens.

Context

KeePassXC 2.7.9 Operating System: Windows 11 Tested on: Windows 11 Enterprise 22H2 Build 22621.4037 Windows 11 Enterprise 23H2 Build 22631.4037

droidmonkey commented 2 months ago

The reason this doesn't work on the start menu and desktop is because Windows no longer returns these as a foreground window regardless of "focus". This must be new behavior on Windows' side because this used to work fine. This is our code that returns a null string when focused on the desktop:

//
// Get foreground window title
//
QString AutoTypePlatformWin::activeWindowTitle()
{
    return windowTitle(::GetForegroundWindow());
}