frontmost-app

1.0.0 • Public • Published

frontmost-app

npm version Build Status Coverage Status

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

Use npm.

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

Package Sidebar

Install

npm i frontmost-app

Weekly Downloads

3

Version

1.0.0

License

ISC

Unpacked Size

13.4 kB

Total Files

5

Last publish

Collaborators

  • shinnn