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

@bobfrankston/winpos

v2.0.50

Published

TypeScript implementation of winpos - Windows window positioning utility

Readme

@bobfrankston/winpos

TypeScript implementation of WinPos - A Windows window positioning utility for multi-monitor setups.

Features

  • Cross-Runtime: Works with both Node.js (24+) and Bun
  • FFI-based: Direct Windows API calls via koffi (Node.js) or bun:ffi (Bun)
  • Multi-Monitor: Full support for multiple displays
  • Flexible Matching: Find windows by exact title, prefix, or regex
  • Window State Management: Minimize, maximize, restore windows programmatically
  • Auto-Restore: Windows are automatically restored from minimized/maximized state when positioning
  • Library or CLI: Use as a command-line tool or import as a library

Installation

npm install @bobfrankston/winpos

Or with Bun:

bun add @bobfrankston/winpos

Usage

Command Line

# Move window to screen 0 at position (100, 200)
winpos "Notepad" 100 200 0

# Move window using percentages
winpos "Chrome*" 50% 50% 1

# Set window size as well
winpos "Visual Studio Code" 0 0 0 1920 1080

# List all windows
winpos *

# Get screen count
winpos -c

# Debug mode
winpos -d "Firefox" 0 0 1

Pattern Matching

  • Exact match: winpos "Notepad" 0 0 0
  • Prefix match: winpos "Chrome*" 0 0 0
  • Regex match: winpos "/Visual.*Code/" 0 0 0

As a Library

import { run } from '@bobfrankston/winpos';

// Move a window programmatically
run(['Chrome*', '0', '0', '1', '1920', '1080']);

Screen Numbering

Screens are numbered starting from 0, sorted by position:

  +---+---+
  | 2 | 3 |
  +---+---+
  | 0 | 1 |
  +---+---+
  • 0: Lower right (primary)
  • 1: Lower left
  • 2: Upper left
  • 3: Upper right

Options

  • -d - Debug mode
  • -dbg - Verbose debug output
  • -c - Return screen count
  • -v / -version - Show version
  • -title <name> - Window title/pattern (alternative to positional)
  • -pos x,y[,screen] - Position (comma-separated, screen optional)
  • -size w,h - Window size (width,height)
  • -min - Minimize window
  • -max - Maximize window
  • -load <file> - Load config from JSON file
  • -save <file> - Save config to JSON file (merges if exists)
  • * - List all windows
  • ** - List all windows including ignored

Parameters

Positional (legacy)

winpos <title> <x> <y> <screen> [<width> <height>]

Flag-based (new)

winpos <title> -pos x,y[,screen] [-size w,h]
winpos -title <name> -pos x,y,screen -size w,h
winpos <title> -min

JSON Config

winpos layout.json
winpos -load layout.json [-save output.json]

JSON Config Format

Single window:

{
  "name": "Notepad",
  "pos": { "x": 100, "y": 100, "screen": 0 },
  "size": { "w": 800, "h": 600 }
}

Multiple windows:

[
  { "name": "app1", "pos": { "x": 0, "y": 0, "screen": 0 } },
  { "name": "app2*", "pos": { "x": 100, "y": 100, "screen": 1 } },
  { "name": "pattern", "regex": true, "pos": { "x": 0, "y": 0, "screen": 2 } },
  { "name": "minimize-me", "minimize": true }
]
  • name - Window title (exact match, prefix with *, or regex if regex: true)
  • regex - If true, name is treated as a regex pattern
  • pos - Position with x, y, and optional screen index
  • size - Size with w (width) and h (height)
  • minimize / maximize - Window state

Known Issues

Windows batch file working directory

When calling winpos from a batch file without call, the working directory may not be inherited correctly due to a Windows cmd.exe quirk.

Workarounds:

  • Use call winpos instead of winpos in batch files
  • Use winpos.ps1 instead of winpos
  • Use absolute paths for config files: winpos "%~dp0config.json"

Requirements

  • Windows OS
  • Node.js 24+ or Bun 1.0+

Development

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run watch

License

MIT

Author

Bob Frankston