active-win 8.1.0 reports empty title strings on Adobe products on macOS despite correct permissions
tom2strobl opened this issue · comments
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:
- permissions are properly set up (both accessibility and screen recording are enabled for the app)
- it happens both on Intel and Silicon
- it happens on both monterey and ventura
- it can't be an issue with
disableScreenRecordingPermission
in https://github.com/sindresorhus/active-win/blob/27221e5da0a64025bdec8759605694ea84ff9f68/Sources/ActiveWinCLI/main.swift#LL49C20-L49C52 since it reports other apps just fine (eg. Figma) - I am fully aware that sometimes eg. when editing a color swatch in InDesign, InDesign opens a temporary window "Colour Swatches", interestingly these are seemingly always caught just fine. I'm primarly talking about the regular editing of files, what a user will be doing ~90% of the time
- If I understand correctly, cases like transparent windows and tiny windows would return null altogether instead of an empty title string, right? So it shouldn't be any of those cases
- So after all I'm assuming those are cases where
kCGWindowName
is simply empty? Is there a simple way for me to confirm that? - My go-to method of checking the title of a window is by going into mac Mission Control and hovering the window; interestingly I can always see the regular title of the adobe products in mission control, so I don't really think their window titles are empty, so they must be doing some weird window shenanigans?
I'm investigating further and will report any findings in here.
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):
But when you open any dropdown field like stroke or fonts it suddenly becomes empty:
Same when eg. just opening a toolbar:
Or even simpler – just a context menu:
Is there anything we can do about this or are our hands tied since Adobe doesn't return anything here?
😬
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](https://private-user-images.githubusercontent.com/557074/247543522-2f523a03-3b72-41ed-8116-7f3d37b820f6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3OTUzNDQsIm5iZiI6MTcyMzc5NTA0NCwicGF0aCI6Ii81NTcwNzQvMjQ3NTQzNTIyLTJmNTIzYTAzLTNiNzItNDFlZC04MTE2LTdmM2QzN2I4MjBmNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxNlQwNzU3MjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00MTM5ZWQ1MTY2ZGJjZTU4ZTNkN2I0NTQwYmUxYTQ5YmFkOTQ2NjQwMDEyYjQ2ZGMxYzZhNjgyMDFlOTJkNWQzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.auFG4Tz9erj2Yk_FYewDXJJVUJPsfLhUgkUUW8pfS1g)
Since it's not really an error on active-win
s end, but rather an inconvenience by adobe, feel free to close this issue.