sindresorhus / get-windows

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

Question about Firefox #153

Closed Srini-B closed 3 months ago

Srini-B commented 1 year ago

Hi, can anyone confirm me if URLs from Firefox are captured, It doesn't work for me. I also have userchrome.css enabled which modifies the UI, maybe it's the cause. I'm on macOS 13.0.1

anis-dr commented 1 year ago

I'm having the same issue, URLs are not captured from Firefox

vojtabohm commented 4 months ago

This is because it does not work with the approach this library uses (which is to use AppleScript to 'tell' the browser to return it's url). I solved this a while ago on my macOS project. You can actually use Accessibility API to get it.

  1. You need to set AXManualAccessibility on the Firefox process, which will enable it's DOM to be visible (this property tells the app a 'Screen reader' is present on the screen, so this is a sort of a hack).
  2. Traverse the Firefox's DOM (consisting of AXUIElement) using BFS until you find a node that has a url attribute and read that.

It's a hassle to add this, but unfortunately, no better way to do this for Firefox. I read their forums a while back.

sindresorhus commented 3 months ago

Duplicate of #172