Skip to content

Getting information about the active window and process

License

Notifications You must be signed in to change notification settings

pityulin/devart-active-win

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

devart-active-win

Getting information about the active window and process (title, description, path, processId, url)

Works on Windows.

Install

npm i https://github.com/pityulin/devart-active-win.git --save-optional

Usage

const activeWindow = require('devart-active-win');

(async () => {
	console.log(await activeWindow(options));
	/*
	{
		title: "Google - Google Chrome",
		platform: "windows",
		owner: {
			processId: 9064,
			path: "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
			name: "Google Chrome",
		},
		url: "https://www.google.com/",
	}
})();

API

activeWindow(options?)

options

Type: object

screenRecordingPermission (not used for compatibility)

Type: boolean\

activeWindow.sync(options?)

Result

Returns a Promise<object> with the result, or Promise<undefined> if there is no active window or if the information is not available.

  • platform (string) - 'windows'
  • title (string) - Window title
  • owner (Object) - App that owns the window
    • name (string) - Name of the app or description
    • processId (number) - Process identifier
    • path (string) - Path to the app
  • url (string?) - URL of the active browser tab if the active window is Google Chrome, Microsoft Edge, Firefox, Opera Internet Browser, Vivaldi

OS support

It works only on Windows 7+.

About

Getting information about the active window and process

Resources

License

Stars

Watchers

Forks

Packages

No packages published