Skip to content

Instantly share code, notes, and snippets.

@geberl
Created February 29, 2020 19:15
Show Gist options
  • Save geberl/647de1da6ad87f239daa58f5e01db3b1 to your computer and use it in GitHub Desktop.
Save geberl/647de1da6ad87f239daa58f5e01db3b1 to your computer and use it in GitHub Desktop.
tell application "System Events"
set procs to processes
set windowName to {}
repeat with proc in procs
# Ignore applications that are hidden altogether (cmd+H or via command from the application's menu)
# Applications open on different desktops are ignored alltogether
if (visible of proc) then
if exists (window 1 of proc) then
repeat with w in windows of proc
# Ignore application windows miniaturezed to the dock
# The description is "dialog" for those, while others are called something like "standard window" (localized)
# VS Code doesn't behave this way though, it's always "standard window"
if (w's description is not equal to "dialog") then
copy w's name to the end of windowName
end if
end repeat
end if
end if
end repeat
end tell
return windowName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment