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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@k5z/window-manager

v1.0.1

Published

Wrapper for a Swift CLI to manage windows on MacOS

Downloads

290

Readme

@k5z/window-manager

A Node.js TypeScript wrapper for managing macOS windows through a Swift CLI.

Installation

npm install @k5z/window-manager
# or
pnpm add @k5z/window-manager

Note: This package is macOS-only and requires either:

  • A pre-built binary (included in npm releases)
  • Xcode and Command Line Tools for building from source

Usage

TypeScript/JavaScript

import { WindowManager } from '@k5z/window-manager';
// or
const { WindowManager } = require('@k5z/window-manager');

const wm = new WindowManager();

// List all windows
const windows = await wm.list();
console.log(windows);

// Focus a window by ID
await wm.focus(12345);

// Move a window
await wm.move(12345, 100, 200);

// Resize a window
await wm.resize(12345, 800, 600);

// Find windows by application name
const chromeWindows = await wm.findByApplication('Chrome');

// Find windows by title
const codeWindows = await wm.findByTitle('index.ts');

Synchronous API

All methods also have synchronous versions:

const windows = wm.listSync();
wm.focusSync(12345);
wm.moveSync(12345, 100, 200);
wm.resizeSync(12345, 800, 600);

Custom Binary Path

If you need to specify a custom path to the window-manager binary:

import { createWindowManager } from '@k5z/window-manager';

const wm = createWindowManager({
  binaryPath: '/custom/path/to/window-manager'
});

Permissions

This package requires Accessibility permissions on macOS to function properly.

Grant permissions in: System Settings > Privacy & Security > Accessibility

Add your terminal app or the Node.js process to the allowed applications.

API

WindowManager

Methods

  • list(): Promise<WindowInfo[]> - List all windows
  • listSync(): WindowInfo[] - List all windows (synchronous)
  • focus(windowID: number): Promise<void> - Focus a window
  • focusSync(windowID: number): void - Focus a window (synchronous)
  • move(windowID: number, x: number, y: number): Promise<void> - Move a window
  • moveSync(windowID: number, x: number, y: number): void - Move a window (synchronous)
  • resize(windowID: number, width: number, height: number): Promise<void> - Resize a window
  • resizeSync(windowID: number, width: number, height: number): void - Resize a window (synchronous)
  • findByApplication(appName: string): Promise<WindowInfo[]> - Find windows by app name
  • findByTitle(title: string): Promise<WindowInfo[]> - Find windows by title

WindowInfo

interface WindowInfo {
  windowID: number;
  applicationName: string;
  processName: string;
  windowTitle: string;
}

Development

Building from source

# Install dependencies
pnpm install

# Build TypeScript and Swift binary
pnpm run build

# Build only TypeScript
pnpm run build:ts

# Build only Swift binary
pnpm run build:binary

Requirements for building

  • macOS (10.14+)
  • Xcode and Command Line Tools
  • Node.js 14+
  • Swift 5.0+

License

ISC