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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@winput/window

v1.0.15

Published

Windows window management for Bun - find, move, resize, and manipulate windows

Readme

@winput/window 🪟

npm

Window management for Windows - find, move, resize, and manipulate windows.

Requirements

  • OS: Windows 64-bit
  • Runtime: Bun (npm not supported)

Installation

bun add @winput/window

Usage

import { window } from "@winput/window";

const notepad = window.findWindow("Notepad");
if (notepad) {
  window.activate(notepad);
  window.center(notepad);
  window.setOpacity(notepad, 0.8);
}

const windows = window.enumWindows();
windows.forEach((w) => console.log(w.title));

API

window

Discovery

| Method | Params | Returns | Description | | ------------------------------------ | ------------------------- | ------------------------------------- | -------------------- | | getActiveWindow() | - | WindowInfo \| null | Get focused window | | findWindow(title) | string | HWND \| null | Find by title | | waitForWindow(title, timeout?) | string, number | Promise<HWND \| null> | Wait for window | | waitForWindowClose(hwnd, timeout?) | HWND, number | Promise<boolean> | Wait for close | | enumWindows() | - | WindowInfo[] | List visible windows | | enumChildWindows(parent) | HWND | WindowInfo[] | List children | | getList() | - | HWND[] | Get all HWNDs | | getCount() | - | number | Count windows |

Properties

| Method | Params | Returns | Description | | ----------------------------- | --------------- | ------------------------------- | --------------- | | getWindowTitle(hwnd) | HWND | string | Get title | | getWindowRect(hwnd) | HWND | Rect | Get bounds | | getClientRect(hwnd) | HWND | Rect | Get client area | | getWindowSize(hwnd) | HWND | Size | Get size | | getClientSize(hwnd) | HWND | Size | Get client size | | getClassName(hwnd) | HWND | string | Get class name | | getWindowProcessId(hwnd) | HWND | number | Get PID | | getProcessPath(hwnd) | HWND | string | Get exe path | | getProcessName(hwnd) | HWND | string | Get exe name | | getExtendedWindowInfo(hwnd) | HWND | ExtendedInfo | Detailed info | | getText(hwnd) | HWND | string | All window text |

State

| Method | Params | Returns | Description | | ------------------------- | --------------- | -------------- | -------------- | | isWindow(hwnd) | HWND | boolean | Handle valid | | isWindowVisible(hwnd) | HWND | boolean | Is visible | | isWindowMinimized(hwnd) | HWND | boolean | Is minimized | | isWindowMaximized(hwnd) | HWND | boolean | Is maximized | | getMinMax(hwnd) | HWND | -1 \| 0 \| 1 | Min/Normal/Max | | getStyle(hwnd) | HWND | number | Style flags | | getExStyle(hwnd) | HWND | number | Extended style |

Actions

| Method | Params | Returns | Description | | ---------------------- | --------------- | --------- | ----------------- | | activate(hwnd) | HWND | boolean | Focus and restore | | focusWindow(hwnd) | HWND | boolean | Bring to front | | showWindow(hwnd) | HWND | boolean | Show window | | hideWindow(hwnd) | HWND | boolean | Hide window | | minimizeWindow(hwnd) | HWND | boolean | Minimize | | maximizeWindow(hwnd) | HWND | boolean | Maximize | | restoreWindow(hwnd) | HWND | boolean | Restore | | closeWindow(hwnd) | HWND | boolean | Close | | kill(hwnd) | HWND | boolean | Force kill | | flashWindow(hwnd) | HWND | boolean | Flash taskbar | | minimizeAll() | - | void | Minimize all |

Manipulation

| Method | Params | Returns | Description | | ------------------------------ | --------------------------- | --------- | ---------------- | | moveWindow(hwnd, x, y, w, h) | HWND, number×4 | boolean | Move/resize | | center(hwnd) | HWND | boolean | Center on screen | | setOpacity(hwnd, opacity) | HWND, number | boolean | Set transparency | | setTopmost(hwnd, enable) | HWND, boolean | boolean | Always on top | | setEnabled(hwnd, enabled) | HWND, boolean | boolean | Enable/disable | | setTitle(hwnd, title) | HWND, string | boolean | Change title | | moveToTop(hwnd) | HWND | boolean | Top Z-order | | moveToBottom(hwnd) | HWND | boolean | Bottom Z-order | | redraw(hwnd) | HWND | boolean | Force repaint |

Coordinates

| Method | Params | Returns | Description | | ---------------------------- | ----------------------------------- | ----------------- | --------------- | | clientToScreen(hwnd, x, y) | HWND, number, number | Point | Client → screen | | screenToClient(hwnd, x, y) | HWND, number, number | Point | Screen → client |

Wait

| Method | Params | Returns | Description | | ------------------------------- | ------------------------- | ------------------ | ------------- | | waitActive(hwnd, timeout?) | HWND, number | Promise<boolean> | Wait active | | waitNotActive(hwnd, timeout?) | HWND, number | Promise<boolean> | Wait inactive |

Regions

| Method | Params | Returns | Description | | ------------------------------------------- | ------------------------------------ | --------- | ------------ | | setRegion.rect(hwnd, x, y, w, h) | HWND, number×4 | boolean | Rectangle | | setRegion.ellipse(hwnd, x, y, w, h) | HWND, number×4 | boolean | Ellipse | | setRegion.round(hwnd, x, y, w, h, rw, rh) | HWND, number×6 | boolean | Rounded rect | | setRegion.polygon(hwnd, points) | HWND, Point[] | boolean | Polygon | | setRegion.reset(hwnd) | HWND | boolean | Reset |

Types

HWND

type HWND = number; // Window handle

WindowInfo

{
  hwnd: number;
  title: string;
  rect: Rect;
  className: string;
  processId: number;
}

Rect

{
  left: number;
  top: number;
  right: number;
  bottom: number;
}

Size

{
  width: number;
  height: number;
}

Point

{
  x: number;
  y: number;
}

ExtendedInfo

{
  hwnd: number;
  title: string;
  className: string;
  processId: number;
  processName: string;
  rect: Rect;
  clientRect: Rect;
  isVisible: boolean;
  isMinimized: boolean;
  isMaximized: boolean;
}

Exports

| Export | Type | Description | | ------------ | --------------------------- | ---------------------- | | window | Window | Main window operations | | WindowInfo | WindowInfo | Window information | | Rect | Rect | Rectangle bounds |

License

MIT