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

wallhaven-random-pi-extension

v0.1.0

Published

Wallhaven random wallpaper extension for pi

Downloads

104

Readme

Wallhaven Random (pi extension)

A pi extension that:

  • adds a get_random_wallpaper tool (pulls wallpapers from wallhaven.cc)
  • supports extension-level defaults (global + project override)
  • can show wallpapers while pi is working
  • supports static and rotate working-image effects (with fade transition + preload of next image)

Features

  • Tool: get_random_wallpaper
    • fetches wallpaper metadata + inline preview image
    • returns wallhaven page URL + full image URL
  • Config layering
    • global config: ~/.pi/agent/extensions/wallhaven-random.json
    • project config: <repo>/.pi/extensions/wallhaven-random.json
    • project config overrides global config
  • Interactive config command
    • /wallhaven-settings
    • /wallhaven-settings global
    • /wallhaven-settings show
  • Thinking-time wallpaper widget
    • shows below editor while agent is running
    • workingImageEffect: "static" | "rotate"
    • in rotate, the next wallpaper is preloaded before fade/swap
    • rotate interval has minimum of 5000ms

Requirements

  • pi with extension support
  • terminal with image support for best experience (Kitty/Ghostty/WezTerm/iTerm2)
    • non-image terminals will gracefully show text fallback
  • Wallhaven API key is optional for many SFW searches, but recommended
    • especially for NSFW/sketchy use cases

Repository contents

  • wallhaven-random.ts - extension entry file
  • wallhaven-random.example.json - sample config

Install

1) Clone this repo

git clone <YOUR_REPO_URL> wallhaven-random-pi-extension
cd wallhaven-random-pi-extension

2) Install globally (all projects)

Create extension + config directories if needed:

mkdir -p ~/.pi/agent/extensions

Copy extension:

cp wallhaven-random.ts ~/.pi/agent/extensions/wallhaven-random.ts

Copy default config (optional):

cp wallhaven-random.example.json ~/.pi/agent/extensions/wallhaven-random.json

Then run /reload in pi.


3) Install per-project (only current repo)

From your project root:

mkdir -p .pi/extensions
cp /path/to/wallhaven-random-pi-extension/wallhaven-random.ts .pi/extensions/wallhaven-random.ts
cp /path/to/wallhaven-random-pi-extension/wallhaven-random.example.json .pi/extensions/wallhaven-random.json

Then run /reload in pi.


4) Symlink workflow (easy updates)

If you prefer not copying files:

mkdir -p ~/.pi/agent/extensions
ln -sf /absolute/path/to/wallhaven-random-pi-extension/wallhaven-random.ts ~/.pi/agent/extensions/wallhaven-random.ts
ln -sf /absolute/path/to/wallhaven-random-pi-extension/wallhaven-random.example.json ~/.pi/agent/extensions/wallhaven-random.json

Now edits in this repo are picked up after /reload.


API key setup

You can set the key in either place:

Option A: environment variable (recommended)

export WALLHAVEN_API_KEY="your_api_key_here"

Add to your shell profile (~/.zshrc or ~/.bashrc) for persistence.

Option B: config file

~/.pi/agent/extensions/wallhaven-random.json (or project override):

{
  "apiKey": "your_api_key_here"
}

Verify in pi:

/wallhaven-settings show

You should see apiKey: set.


Configuration reference

Example:

{
  "apiKey": "<optional>",
  "query": "nature mountains",
  "searchType": "general",
  "purity": "sfw",
  "searchMode": "random",
  "topRange": "1M",
  "ratios": "16x9,21x9",
  "atleast": "1920x1080",
  "page": 1,
  "showWhileWorking": true,
  "workingImageEffect": "rotate",
  "rotateIntervalMs": 5000,
  "fadeDurationMs": 350
}

Keys

  • searchType: general | anime | people | all
  • purity: sfw | sketchy | nsfw
  • searchMode: random | date_added | views | favorites | toplist
  • topRange: 1d | 3d | 1w | 1M | 3M | 6M | 1y (toplist only)
  • rotateIntervalMs: 5000..60000
  • fadeDurationMs: 100..3000

Usage

In pi chat:

  • “Get me a random wallpaper”
  • “Use get_random_wallpaper with query=cyberpunk city, searchType=anime, purity=sfw
  • “Show me today’s toplist with 21:9 wallpapers”

Interactive settings:

  • /wallhaven-settings (project)
  • /wallhaven-settings global
  • /wallhaven-settings show

Troubleshooting

No image shown, only text

Your terminal likely doesn’t support inline images. The extension still works; only rendering is downgraded.

NSFW/sketchy request fails

Set WALLHAVEN_API_KEY and ensure your Wallhaven account/API settings allow requested purity.

Extension not loading

  • confirm file path is exactly one of:
    • ~/.pi/agent/extensions/wallhaven-random.ts
    • .pi/extensions/wallhaven-random.ts
  • run /reload
  • check for TypeScript syntax errors

Rotating too fast/slow

Adjust rotateIntervalMs in config. Minimum clamp is 5000 ms.


Update

If copied:

cp wallhaven-random.ts ~/.pi/agent/extensions/wallhaven-random.ts

Then /reload.

If symlinked, just pull latest and /reload.


Uninstall

Global uninstall:

rm -f ~/.pi/agent/extensions/wallhaven-random.ts
rm -f ~/.pi/agent/extensions/wallhaven-random.json

Project uninstall:

rm -f .pi/extensions/wallhaven-random.ts
rm -f .pi/extensions/wallhaven-random.json

Then /reload.