node package manager

active-win

active-win Build Status

Get the title/id/etc of the active window (macOS & Linux)

PR welcome for Windows support.

Install

$ npm install --save active-win

Usage

const activeWin = require('active-win');
 
activeWin().then(result => {
    console.log(result);
    /*
    {
        title: 'npm install',
        id: 54,
        app: 'Terminal',
        pid: 368
    }
    */
});

API

activeWin()

Returns a Promise for the result Object.

activeWin.sync()

Returns the result Object.

Result

  • title - Window title
  • id - Window ID
  • app - App owning the window
  • pid - Process ID of the app owning the window

Related

License

MIT © Sindre Sorhus