sindresorhus/get-windows

Is it possible to get the path to the current *file* (not app)?

Open

#109 aperta il 27 apr 2021

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)JavaScript (194 fork)user submission
enhancementhelp wanted

Metriche repository

Star
 (913 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Thanks for this cool tool!

Right now, it seems like active-win returns the path to the app behind the currently active window. That's not surprising, as the ReadMe says as much. But is it possible to get the path to the file that is in the active window?

For example, if the current window is a microsoft word file titled "great-document" saved to my desktop, running console.log(await activeWindow()) returns:

{
  memoryUsage: ...,
  title: 'great-document',
  bounds: ...,
  owner: {
    name: 'Microsoft Word',
    processId: ...,
    path: '/Applications/Microsoft Word.app',
    bundleId: 'com.microsoft.Word'
  },
  id: ...,
  platform: 'macos'
}

The path that is listed here is the path to Microsoft Word, the app, itself.

I'm hoping to find the path to the file itself, which in this case would be: Users/NL33/desktop/great-document.doc

Is there a way to use active-win to do that? Is it possible in general?

Guida contributor