frontmost-app
v1.0.0
Published
Get information of the frontmost app – the app that receives key events
Downloads
4
Maintainers
Readme
frontmost-app
Get information of the frontmost app – the app that receives key events
const frontmostApp = require('frontmost-app');
(async () => {
await frontmostApp(); /*=> {
localizedName: 'Safari',
bundleId: 'com.apple.Safari',
bundlePath: '/Applications/Safari.app',
executablePath: '/Applications/Safari.app/Contents/MacOS/Safari',
isLaunched: true,
pid: 30096
} */
})();
This module only supports macOS.
Installation
npm install frontmost-app
API
const frontmostApp = require('frontmost-app');
frontmostApp()
Return: Promise<Object>
The resultant object has the following properties:
localizedName
Type: string
The localized name of the frontmost application.
bundleId
Type: string
The bundle identifier of the frontmost application.
bundlePath
Type: string
The path to the frontmost application's bundle.
executablePath
Type: string
The path to the frontmost application's executable.
isLaunched
Type: boolean
Whether the frontmost application has finished launching.
pid
Type: integer
The process identifier of the frontmost application.
License
ISC License © 2018 Shinnosuke Watanabe