config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAFKThreshold = 300

DefaultAFKThreshold is the default idle-time threshold in seconds.

View Source
const DefaultVolume = 100

DefaultVolume is the default playback volume (0-100).

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Steps []Step `json:"steps"`
}

Action holds an ordered list of steps to execute.

func Resolve

func Resolve(cfg Config, profile, action string) (*Action, error)

Resolve looks up an action by profile and action name. Falls back to the "default" profile if the requested profile doesn't contain the action.

type Config

type Config struct {
	Options  Options            `json:"config"`
	Profiles map[string]Profile `json:"profiles"`
}

Config holds the top-level configuration: global options and profiles.

func Load

func Load(explicitPath string) (Config, error)

Load reads and parses a config file. It tries, in order:

  1. explicitPath (if non-empty)
  2. notify-config.json next to the running binary
  3. ~/.config/notify/notify-config.json

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON sets defaults then decodes the JSON structure. Go's json.Unmarshal merges into existing struct fields, so only values present in JSON override the defaults.

type Credentials

type Credentials struct {
	DiscordWebhook string `json:"discord_webhook,omitempty"`
}

Credentials holds secret values for remote notification actions.

type Options

type Options struct {
	AFKThresholdSeconds int         `json:"afk_threshold_seconds,omitempty"`
	DefaultVolume       int         `json:"default_volume,omitempty"`
	Credentials         Credentials `json:"credentials,omitempty"`
}

Options holds global settings parsed from the "config" key.

type Profile

type Profile map[string]Action

Profile maps action names to actions.

type Step

type Step struct {
	Type    string `json:"type"`              // "sound" | "say" | "toast" | "discord"
	Sound   string `json:"sound,omitempty"`   // type=sound
	Text    string `json:"text,omitempty"`    // type=say
	Title   string `json:"title,omitempty"`   // type=toast
	Message string `json:"message,omitempty"` // type=toast
	Volume  *int   `json:"volume,omitempty"`  // per-step override, nil = use default
	When    string `json:"when,omitempty"`    // "afk" | "present" | "" (always)
}

Step is a single unit of work within an action.

Jump to

Keyboard shortcuts

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