active-win-cli

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

Usage no npm install needed!

<script type="module">
  import activeWinCli from 'https://cdn.skypack.dev/active-win-cli';
</script>

README

active-win-cli Build Status

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

Install

$ npm install --global active-win-cli

Usage

$ active-win --help

  Usage
    $ active-win [property]

    Returns title, id, app, pid, or the specified property

  Examples
    $ active-win
    npm install
    54
    Terminal
    368
    $ active-win app
    Terminal

Tip

You can use the id property with the builtin screencapture CLI tool to screenshot the active window:

$ screencapture -l$(active-win id) screenshot.png

Related

License

MIT © Sindre Sorhus