Documentation
¶
Index ¶
Constants ¶
const PlaceholderGlyph = "□"
Variables ¶
var ErrNoTerminal = errors.New("launcher: no terminal found")
var ErrServiceClosed = errors.New("launcher: service closed")
Functions ¶
This section is empty.
Types ¶
type History ¶
type History struct {
// contains filtered or unexported fields
}
History stores launcher usage for ranking and persists successful activations.
func DefaultHistory ¶
DefaultHistory loads usage history from $XDG_STATE_HOME/sysc-launch/history.gob, falling back to $HOME/.local/state/sysc-launch/history.gob. The logf argument receives history load and save diagnostics; nil suppresses those diagnostics.
type Provider ¶
type Provider struct {
Name string
Prefix string
Glyph string
Description string
Query func(query string) []Result
}
Provider is one launcher source behind a "/" prefix. The registry is an ordered slice; the first entry is the default provider for bare queries. Later providers append without any layout or routing change.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service owns the collector and query goroutines (D12). All state crosses goroutine boundaries as immutable snapshots through channels; no Wayland types appear in this package.
func NewService ¶
func NewService(cfg ServiceConfig) *Service
func (*Service) Activate ¶
Activate spawns the entry (or one of its desktop actions) through `niri msg action spawn` on the service goroutine and records usage only when the spawn succeeds (D6/D9).
func (*Service) Open ¶
func (s *Service) Open()
Open triggers a rescan when the entry snapshot is stale.
type ServiceConfig ¶
type ServiceConfig struct {
Scan func() []Entry
History *History
Rank func(entries []Entry, query string, boost func(query, identifier string) int) []Result
Run func(ctx context.Context, argv []string) error
Getenv func(string) string
LookPath func(string) (string, error)
Now func() time.Time
Logf func(string, ...any)
StaleAfter time.Duration
ActivateTimeout time.Duration
}
ServiceConfig wires the launcher service. Nil Scan, Rank, Run, Getenv, LookPath, and Now use the XDG desktop scanner, built-in ranker, Niri spawn, os.Getenv, exec.LookPath, and time.Now. Non-positive StaleAfter and ActivateTimeout use one minute and five seconds. Nil History disables usage persistence and boosting; nil Logf suppresses scanner diagnostics.