Skip to content

kernel-oops/opencode-wayland-permission-notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

OpenCode Wayland Permission Notify

A dependency-free OpenCode TUI plugin that sends actionable desktop notifications for permission requests on Linux graphical desktops.

It is designed for a remote OpenCode server: the plugin runs in the local opencode attach TUI, so notifications use the local user's session D-Bus instead of the server's non-graphical environment.

Features

  • Desktop actions for Approve once, Always allow, and Deny.
  • Supports both legacy and v2 OpenCode permission events.
  • Routes a permission request only to the attached TUI currently displaying that session.
  • Uses a per-session Unix-socket lock, preventing duplicate banners when the same session is open in more than one TUI.

Requirements

  • Linux with a running graphical-session D-Bus.
  • A notification daemon implementing org.freedesktop.Notifications.
  • gdbus and dbus-monitor on PATH (normally supplied by GLib and D-Bus).
  • OpenCode with TUI plugin support. Developed and tested with OpenCode 1.17.18.

GNOME on Wayland is a supported target. The plugin may also work with other Linux desktops that implement the standard notification D-Bus interface.

Install

Copy wayland-permission-notify.js into a directory available to the local TUI, then register it in the TUI configuration used by opencode attach:

{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": [
    "./plugins/wayland-permission-notify.js"
  ]
}

Launch or restart the local attached TUI with that file as its TUI config:

OPENCODE_TUI_CONFIG=/path/to/tui.json opencode attach http://server:4096

Do not put this plugin in the remote server's opencode.json. It needs the local graphical session's DBUS_SESSION_BUS_ADDRESS, which a remote OpenCode service normally does not have.

Behaviour

When an OpenCode permission request arrives, the local notification displays the requested action or resource and supplies three actions:

  • Approve once replies with once.
  • Always allow replies with always.
  • Deny replies with reject.

Only the TUI currently displaying the requested session handles its notification. Attachments for other projects ignore it. If the same session is open in more than one TUI, the first one to claim that session's ownership socket handles it; another can take over after it exits.

Logs are written to ~/.opencode-permission-notify.log for troubleshooting.

Validation

Check syntax without dependencies:

node --check wayland-permission-notify.js

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages