notify

package
v0.3.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package notify — OS desktop notifications for the office: a look-away nudge when a permission ask blocks the floor or the boss's turn lands while the terminal is unfocused.

Zero NEW dependencies, same shape as internal/sound/player.go: a resolved platform binary, fire-and-forget exec, and total fail-silence (no binary, a non-zero exit, or a wedged process all degrade to nothing — the office must never break because a notification daemon did).

  • darwin: osascript -e 'display notification "<body>" with title "<title>" sound name "Glass"'
  • linux: notify-send <title> <body> ("permission" kind rides -u critical)
  • other / not found: resolve to "" — every Send is a graceful no-op.

CLICK-TO-FOCUS IS NOT AVAILABLE without new deps: AppleScript's `display notification` carries NO click action (Notification Center click actions need a bundled .app + UNUserNotificationCenter), and notify-send action hints are desktop-environment flavored. The banner is a pure heads-up — the member's way back stays the terminal bell + the in-app [blocked] surfacing (the sound bus, untouched).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveNotifier

func ResolveNotifier() string

ResolveNotifier finds the platform notifier, or "" when none exists.

  • darwin: osascript
  • linux: notify-send
  • other: none

Types

type Bus

type Bus struct {
	// contains filtered or unexported fields
}

Bus routes look-away nudges to the OS notification daemon. Modes:

"on"  — fire through the resolved platform notifier
"off" — silence

Env override: THEFLOOR_NO_NOTIFY=1 forces "off" above whatever config asked for.

func NewBus

func NewBus(cfgNotifications string) *Bus

NewBus builds a Bus for the config mode ("on"|"off"|""). "" defaults to "on"; anything unrecognized turns OFF — a brain.json typo must never spam the desk. The notifier lookup happens once here; an empty resolution keeps every Send a graceful no-op.

func (*Bus) Mode

func (b *Bus) Mode() string

Mode returns the effective mode after env overrides and any live SetMode.

func (*Bus) NotifierPath

func (b *Bus) NotifierPath() string

NotifierPath returns the resolved notifier command path, or "" if none.

func (*Bus) Send

func (b *Bus) Send(kind, title, body string)

Send fires one banner without blocking the caller. It never errors and never panics: mode off, no notifier resolved, a throttled kind, or a spawn failure all degrade silently (the office is the product, the banner is the garnish).

func (*Bus) SetMode

func (b *Bus) SetMode(mode string)

SetMode flips the mode live (/notify's SetMode seam — /power's live governor twin). Unknown values are refused so a busted toggle can never silently mute or unmute the desk.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL