sindresorhus/get-windows

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

Open

#109 创建于 2021年4月27日

在 GitHub 查看
 (2 评论) (0 反应) (0 负责人)JavaScript (913 star) (194 fork)user submission
enhancementhelp wanted

描述

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?

贡献者指南