Skip to content

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

Notifications You must be signed in to change notification settings

jmtame/electron-active-window

 
 

Repository files navigation

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, Linux / Xorg and MacOS

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

Building / Installation

yarn install

or

npm install

Usage

const activeWindows = require('electron-active-window');

activeWindows().getActiveWindow().then((result)=>{
    console.log(result)
});

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',
}

MacOS return value

{
  os: 'macos',
  windowClass: 'com.microsoft.VSCode',
  windowName: 'Code',
  windowDesktop: null,
  windowType: null,
  windowPid: '7531',
  atTime: '2020-05-08 16:34:00',
  launchDate: '(null)',
  isTerminated: 0
}

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 47.7%
  • Makefile 33.9%
  • C++ 14.0%
  • JavaScript 4.4%