Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tom2strobl opened this issue Jun 21, 2023 · 2 comments

Comments

@tom2strobl
Copy link

tom2strobl commented Jun 21, 2023

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.

@tom2strobl
Copy link
Author

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant