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

opencode-notifications

v1.0.0

Published

Smart desktop notifications for OpenCode - only notifies when terminal is not focused (Linux)

Readme

opencode-notifications

Smart desktop notifications for OpenCode - only notifies when the terminal is not in focus.

This is the key differentiator from other notification plugins: if you're already looking at OpenCode, you won't be bothered with redundant notifications.

Features

  • Smart focus detection - Only sends notifications when you're NOT looking at the terminal
  • X11 support - Focus detection via xdotool
  • Tmux support - Detects active tmux window/pane, works with multiple sessions
  • Configurable events - Enable/disable notifications for specific event types
  • Lightweight - No sound files, no complex dependencies

Installation

Add the plugin to your opencode.json or opencode.jsonc:

{
  "plugin": ["opencode-notifications"]
}

Restart OpenCode. The plugin will be automatically installed and loaded.

Requirements

X11

  • xdotool - For window focus detection
  • notify-send - For desktop notifications (usually from libnotify-bin)
# Debian/Ubuntu
sudo apt install xdotool libnotify-bin

# Fedora
sudo dnf install xdotool libnotify

# Arch
sudo pacman -S xdotool libnotify

Tmux

Tmux support works automatically when running OpenCode inside a tmux session. No additional setup is required.

When running inside tmux, notifications are suppressed only when both:

  1. The terminal window is focused (X11 level)
  2. The tmux window containing the OpenCode pane is active

This means you'll still receive notifications if:

  • You switch to a different tmux window
  • You're in a different tmux session
  • The terminal itself is not focused

Platform Support

Focus detection is supported on:

  • Linux with X11
  • Tmux (works with X11 for window and pane-level detection)

Events

The plugin notifies on these OpenCode events:

| Event | Description | |-------|-------------| | complete | Generation/task completed (session.idle) | | error | An error occurred (session.error) | | permission | Permission needed (permission.asked) |

Configuration

Create ~/.config/opencode/opencode-notifications.json to customize:

{
  "events": {
    "complete": true,
    "error": true,
    "permission": true
  }
}

Disable specific events

{
  "events": {
    "complete": true,
    "error": false,
    "permission": true
  }
}

How It Works

  1. When the plugin loads, it captures the window ID of the terminal running OpenCode
  2. Before sending any notification, it checks if that window is still focused
  3. If the terminal IS focused, the notification is skipped (you're already looking at it!)
  4. If the terminal is NOT focused, the notification is sent

This simple approach ensures you're only notified when you need to be.

Troubleshooting

Notifications not appearing

  1. Check if notify-send is installed:

    notify-send "Test" "Hello"
  2. Check your notification daemon:

    • GNOME: Notifications should work out of the box
    • KDE: Notifications should work out of the box

Focus detection not working

X11 - Check if xdotool works:

xdotool getactivewindow

If this returns an error, make sure xdotool is installed.

Notifications always showing (even when terminal is focused)

Make sure xdotool is installed and working on X11.

Tmux: Notifications showing when pane is visible

If you're getting notifications even when the tmux pane running OpenCode is visible:

  • Make sure the tmux window is active (not just visible in a split)
  • Check that TMUX_PANE environment variable is set (it should be automatic)

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.