npm.io
0.1.39 • Published 10 months ago

mezon-active-windows

Licence
MIT
Version
0.1.39
Deps
1
Size
16 kB
Vulns
0
Weekly
0
Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)

Mezon Active Window

Node C++ N-API module to get information on the currently selected window and the user idle time on Linux, MacOS and Windows.

Currently only supports Windows and Linux / Xorg.

Work in progress. Not on every platform all information are supported.

Building / Installation

npm install

Usage

const activeWindows = require('active-windows');

console.log(activeWindows.getActiveWindow());

See sample.js for more information.

Return-Value
{
  // Operating system (linux | windows | macos)
  os: 'linux',
  // Process name (chromium.exe on windows)
  windowClass: 'chromium',
  // Blog | bytee.net
  windowName: 'Blog | bytee.net - Chromium',
  // Desktop on which the window is displayed (Linux only)
  windowDesktop: '2',
  // Window Type (Linux only)
  windowType: '340',
  // Process ID of the window
  windowPid: '34218',
  // Idle Time in seconds
  idleTime: '42',
}

{
  os: 'macos',
  windowClass: 'Visual Studio Code',
  windowName: '',
  windowDesktop: '0',
  windowType: '0',
  windowPid: '279',
  idleTime: '0'
}

Build linux

yarn config set nodedir ~/.cache/node-gyp/18.19.0

Keywords