sindresorhus / get-windows

Get metadata about the active window and open windows (title, id, bounds, owner, etc)
MIT License
783 stars 161 forks source link

active-win 8.1.0 reports empty title strings on Adobe products on macOS despite correct permissions #169

Open tom2strobl opened 1 year ago

tom2strobl commented 1 year ago

So I've been using active-win for a year now and can navigate around tricky subjects like the permissions-business, so I'm not new to the library. Lately I've discovered something awkward that my non-swift brain cannot wrap its head around:

When using Adobe Products like Illustrator or InDesign and editing a document, more often than not the window title is returned empty:

{
  title: '', // <- this should yield something like "Acme-Illustrations.indd* @ 46,12 % (RGB/Preview)"
  id: 292,
  owner: {
    path: '/Applications/Adobe InDesign 2023/Adobe InDesign 2023.app',
    name: 'InDesign',
    bundleId: 'com.adobe.InDesign',
    processId: 1597
  },
  bounds: { x: 2044, y: 293, height: 527, width: 308 },
  memoryUsage: 2288,
  platform: 'macos'
}

Things I researched so far:

I'm investigating further and will report any findings in here.

tom2strobl commented 1 year ago

So I was able to narrow it down. I wrote a super quick script that rewrites the last stdout line to process.stdout.write(`${window.title} - ${window.owner.name}`)

This way I could navigate around see live updates to what active-win is seeing. Unfortunately it seems that almost any action in Illustrator causes their window to have an empty title.

Here's the default view (you can see the correct title at the bottom of the adobe window):

adobe-regular

But when you open any dropdown field like stroke or fonts it suddenly becomes empty:

adobe-dropdown-stroke

Same when eg. just opening a toolbar:

adobe-toolbar

Or even simpler – just a context menu:

adobe-contextmenu

Is there anything we can do about this or are our hands tied since Adobe doesn't return anything here?

😬

tom2strobl commented 1 year ago

Ok, so after all it just simply seems that all those interactions technically launch sort of mini windows that obviously take the first space in the open-window-stack. Since they are launched from the "correct" window I can use activeWindow.getOpenWindows() and if the first entry is one of those empty title shenanigans I can take the second entry and if the app name matches and has a window title, I can use that one. Sounds a bit flaky, so I will run some tests, but I guess its sort of a valid way to go about it.

SCR-20230621-mrzp

Since it's not really an error on active-wins end, but rather an inconvenience by adobe, feel free to close this issue.