Skip to content

Show the real cursor over password prompts drawn above the hand - #45

Open
jorgenbruntveit wants to merge 1 commit into
nilbuild:mainfrom
jorgenbruntveit:fix-secure-dialogs
Open

jorgenbruntveit wants to merge 1 commit into
nilbuild:mainfrom
jorgenbruntveit:fix-secure-dialogs

Conversation

@jorgenbruntveit

Copy link
Copy Markdown

macOS draws some system windows in front of TinyHand's overlay whatever its window level. The password prompt from SecurityAgent (for example from do shell script … with administrator privileges, or an installer asking for an admin password) reports layer 1000 but sits in front of the overlay at 1002. While the pointer is on, the hand is drawn underneath the prompt and the system cursor is hidden, so there is nothing to aim with inside it.

What it does

  • Windows that CGWindowListCopyWindowInfo lists in front of the overlay now count like open menus: over them the real cursor shows and clicks reach them.
  • The real cursor shows over them even with Keep the hand on, because the hand would be hidden under the window anyway.
  • While one is on screen, Esc reaches it, as it already does for open menus.

How

  • openMenus(overlay:) walks the front-to-back window list and also returns windows that come before the overlay's own window, below the cursor level and not owned by TinyHand. It returns those separately as well.
  • updateZones forces the real cursor when the mouse is over one of those windows.
  • The log records when such a window appears and goes, and gives window in front as the reason for the real cursor.

Testing

Built with swift build -c release on macOS 27.3. With the pointer on, I opened an admin password prompt with osascript -e 'do shell script "true" with administrator privileges'. The log showed the window being detected, the real cursor each time the mouse went inside the prompt and the hand each time it left. The hand came back as soon as the prompt closed.

🤖 Generated with Claude Code

macOS draws some system windows, like SecurityAgent's password
prompts, in front of the overlay whatever its level, so the hand was
hidden under them while the system cursor was hidden too. Windows in
front of the overlay now count like open menus: over them the real
cursor shows, even with Keep the hand on, and clicks reach them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant