Skip to content

Instantly share code, notes, and snippets.

@whoo
Created September 5, 2025 17:46
Show Gist options
  • Select an option

  • Save whoo/2750250e06ebe4631c852867f5282c6f to your computer and use it in GitHub Desktop.

Select an option

Save whoo/2750250e06ebe4631c852867f5282c6f to your computer and use it in GitHub Desktop.
echo 'tell application "System Events"
set visibleProcesses to (every process whose visible is true)
set totalOpenWindows to 0
repeat with aProcess in visibleProcesses
try
tell aProcess
set windowCount to count of (windows whose value of attribute "AXMinimized" is false)
set totalOpenWindows to totalOpenWindows + windowCount
end tell
on error
-- Some applications may not respond to window queries, handle errors gracefully
end try
end repeat
display dialog "Total visible open windows: " & totalOpenWindows
end tell
' | osascript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment