npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jsgetwindow

v1.0.2

Published

a cross platform module to obtain GUI information and controlling application's windows (inspired from PyGetWindow)

Downloads

4

Readme

JsGetWindow

A cross-platform module designed for retrieving GUI information and managing application windows. Inspired from the pyGetWindow module.

Still under development. Currently only the Windows platform is implemented.

Installation

Install jsGetWindow with npm

  npm i jsgetwindow

API Reference

Functions

| Function Name | Output | Description | | :------------- | :---- | :---------- | | getAllTitles() | String[] | Retrieves titles of all visible windows. | | getAllWindows() | BaseWindow[] | Retrieves details of all visible windows. | | getActiveWindow() | BaseWindow | Retrieves details of the currently active window. | | getActiveWindowTitle() | String | Retrieves the title of the currently active window. | | getCursorPosition() | { x: number, y: number } | Retrieves the position of the cursor. | | getWindowsAt(x:number, y:number) | BaseWindow[] | Retrieves details of windows at the given coordinates. | | getWindowsWithTitle(title:String) | BaseWindow[] | Retrieves details of windows with the specified title. |

Window Methods:

const window = getActiveWindow(); //BaseWindow object
window.close();

| Method | Description | | :-------- | :---------- | | close() | Closes the window. | | minimize() | Minimizes the window. | | maximize() | Maximizes the window. | | restore() | Restores the window. | | show() | Shows the window. | | hide() | Hides the window. | | focus() | Focuses on the window. | | resizeTo(width:number, height:number) | Resizes the window to the given width and height. | | resizeOffset(widthOffset:number, heightOffset:number) | Resizes the window by the given width and height offsets. | | moveTo(x:number, y:number) | Moves the window to the given x, y coordinates. | | moveOffset(xOffset:number, yOffset:number) | Moves the window by the given x, y offsets. |

Window Properties

const window = getActiveWindow(); //BaseWindow object
console.log(window.isActive); // true

| Property | Output | Description | | :-------- | :----- | :---------- | | resolution | { width: number, height: number } | Gets the resolution of the window (width, height). | | x | number | Gets the x coordinate of the window. | | y | number | Gets the y coordinate of the window. | | isMaximized | boolean | Checks if the window is maximized. | | isMinimized | boolean | Checks if the window is minimized. | | isActive | boolean | Checks if the window is active. | | isVisible | boolean | Checks if the window is visible. |

BaseWindow object

{

    title: String,
    rect: Rect {
        left: number,
        top: number,
        right: number,
        bottom: number
    },
    handle: number

}

Function Example

> const gw = require("jsGetWindow");
undefined

> gw.getAllTitles();
[ 'new.js - test - Visual Studio Code',  'readme.so - Google Chrome', 'main.js - libProj - Visual Studio Code', 'Hannibal (2013) - S01E12 - Relevés (1080p BluRay x265 RCVR).mkv - PotPlayer', 'Realtek Audio Console', 'Command Prompt - py  reader1.py',  'Settings',  'Settings', 'Windows Input Experience' 'Program Manager' ]

> gw.getActiveWindow()
BaseWindow {
  title: 'new.js - test - Visual Studio Code',
  rect: Rect { left: -7, top: -7, right: 1714, bottom: 920 },
  handle: 328462
}

> gw.getWindowsWithTitle("chrome")
[
BaseWindow {
    title: 'woustachemaxd/JsGetWindow - Google Chrome',
    rect: Rect { left: -7, top: -7, right: 1714, bottom: 920 },
    handle: 198404
  },
    BaseWindow {
    title: 'Toby - Google Chrome',
    rect: Rect { left: -7, top: -7, right: 1714, bottom: 920 },
    handle: 2361776
  }
]

> gw.getActiveWindow().title
'new.js - test - Visual Studio Code'

> gw.getAllWindows();
[
  BaseWindow {
    title: 'new.js - test - Visual Studio Code',
    rect: Rect { left: -7, top: -7, right: 1714, bottom: 920 },
    handle: 328462
  },
  BaseWindow {
    title: 'readme.so - Google Chrome',
    rect: Rect { left: -7, top: -7, right: 1714, bottom: 920 },
    handle: 198404
  },
    ...
  BaseWindow {
    title: 'Program Manager',
    rect: Rect { left: 0, top: 0, right: 1707, bottom: 960 },
    handle: 65942
  }
]

>

Method and Properties Example

> chromeWindow = gw.getWindowsWithTitle("chrome")[0]
> chromeWindow.isMaximized
False
> chromeWindow.maximize()
> chromeWindow.isMaximized
True
> chromeWindow.minimize()
> chromeWindow.restore()
> chromeWindow.activate()
> chromeWindow.resizeOffset(10, 10) # increase by 10, 10
> chromeWindow.resizeTo(100, 100) # set size to 100x100
> chromeWindow.moveOffset(10, 10) # move 10 pixels right and 10 down
> chromeWindow.moveTo(10, 10) # move window to 10, 10
> chromeWindow.close()