Code Monkey home page Code Monkey logo

list-open-windows's Introduction

List Open Windows

A native Node.js module for listing the currently open application windows on Windows. Can be paired with activate-previous-window to create a task switcher.

Why

It's easy enough to get a list of open windows using the EnumWindows function. The problem is that EnumWindows returns a lot of other things that are not what you would expect: tooltips, background windows, hidden windows, etc. This module uses a few heuristics to filter the list from EnumWindows to include only what you would see when you press Alt+Tab.

Installation

npm install @josephuspaye/list-open-windows --save

Usage

const { listOpenWindows } = require('@josephuspaye/list-open-windows');

// Get the list of open windows
const windows = listOpenWindows();

// Do something with the list
windows.forEach(console.log);

listOpenWindows() takes no parameter and returns a list of window objects with the following properties:

  • handle (number) the window handle (HWND)
  • zOrder (number) the window position in z-order
  • className (string) the window class name, as retrieved from GetClassName
  • caption (string) the window title/caption, as retrieved from GetWindowText
  • processId (string) the id of the thread that the window belongs to, as retrieved from GetWindowThreadProcessId
  • processPath (string) the path to the executable of the process that the window belongs to, as retrieved from GetModuleFileNameEx

Licence

MIT

list-open-windows's People

Contributors

alon42 avatar josephuspaye avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.