Skip to content

fix: Improve window filtering logic to include fullscreen applications#205

Merged
sindresorhus merged 2 commits into
sindresorhus:mainfrom
mrcolak:main
Mar 8, 2026
Merged

fix: Improve window filtering logic to include fullscreen applications#205
sindresorhus merged 2 commits into
sindresorhus:mainfrom
mrcolak:main

Conversation

@mrcolak
Copy link
Copy Markdown
Contributor

@mrcolak mrcolak commented Mar 8, 2026

Fix for the the issue #161

Cause

Fullscreen apps often do not have a caption/title bar (WS_CAPTION) and are implemented as popup windows (WS_POPUP). The old filter dropped these windows from openWindows() results even though they are valid top-level visible windows.

What changed

openWindows() now includes fullscreen apps that were previously missing, while preserving existing filters for tool windows and child windows.

  • Updated EnumDekstopWindowsProc in main.cc.
  • Added style checks:
    • hasCaption = (dwStyle & WS_CAPTION) == WS_CAPTION
    • hasPopup = (dwStyle & WS_POPUP) == WS_POPUP
  • Replaced the strict caption requirement with:
    • (hasCaption || hasPopup)

@sindresorhus
Copy link
Copy Markdown
Owner

sindresorhus commented Mar 8, 2026

I think this is too broad. WS_POPUP is not really a synonym for fullscreen app window; Microsoft documents it as the style used for dialog boxes, message boxes, and other temporary windows too. So changing the filter from hasCaption to hasCaption || hasPopup will start admiting visible transient popups as open windows as long as they are not child windows or tool windows.

That may fix one fullscreen case, but it does it by weakening the filter globally. If we want to include borderless fullscreen apps, I think we need an extra heuristic here to separate real app windows from owned/transient popups, not just check WS_POPUP on its own.

@mrcolak
Copy link
Copy Markdown
Contributor Author

mrcolak commented Mar 8, 2026

It is now filtering out the transient/owned popups.
Note: The list also excludes the owner when an owned dialog visible but that is due to IsWindowEnabled(hwnd) check since Windows disables the owner when there's a child visible. So that would be an expected behaviour

@sindresorhus sindresorhus merged commit b2919bd into sindresorhus:main Mar 8, 2026
1 check passed
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.

2 participants