How to List All Open Windows on a Desktop

I would like to be able to create a snapshot list of where I am when I have to put a project aside for a while. Bookmarking all my open Chrome tabs I have handled. But how to automatically generate a list of all other open windows on any particular desktop?

I found one KBM token that comes close, %WindowName%All%, but it just lists all the windows of the current app in the current desktop. I want to expand that to list all the windows of all apps in the current desktop.

And I'm stuck at where to go.

I imagine KBM has a built-in way to do it, but I haven't been able to find it.

Any suggestions?

Hey August,

Not as far as I know.

Keyboard Maestro can list apps and the windows of the front app, but I don't think it can list windows of arbitrary apps.

System Events can though.

# Auth: Christopher Stone
# dCre: 2021/09/17 17:11
# dMod: 2021/09/17 17:11 
# Appl: System Events
# Task: List All Windows of All Applications in the Current Desktop (Space).
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @System_Events, @List, @Windows, @Desktop

tell application "System Events"
   tell (application processes whose background only is false)
      set appNameList to name
      set appWindowNameList to name of windows
   end tell
end tell

set _cntr to 1

repeat with appName in appNameList
   set contents of appName to {"# " & appName & " #" & linefeed} & item _cntr of appWindowNameList & ""
   set _cntr to _cntr + 1
end repeat

set AppleScript's text item delimiters to linefeed

return appNameList as text