palette

package
v1.0.260758 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eval

func Eval(expr string) (string, error)

Eval evaluates a simple integer expression: + - * / % ** & | ^ << >> ( ) and 0x hex.

func FormatInt

func FormatInt(n int64) string

FormatInt formats calc results.

func HistoryPath

func HistoryPath() string

HistoryPath is ~/.config/ttypedesk/palette_history.json

func LoadHistory

func LoadHistory(max int) []string

LoadHistory reads recent palette queries (newest first).

func SaveHistory

func SaveHistory(items []string, max int)

SaveHistory writes recent queries.

Types

type Env

type Env struct {
	Query      string
	Max        int
	Launch     func(action string) error
	OpenPath   func(path string) error
	Focus      func(id string)
	OpenFind   func(query string)
	Quit       func()
	Notify     func(title, body string)
	CopyText   func(text string)
	ApplyTheme func(id string) // theme pack id: xp, scarlet, bumble, bubble, sprout
	// Confirm asks the user to confirm a dangerous recipe. Return false to abort.
	// Implementations may keep the palette open for a second Enter.
	Confirm    func(prompt, action string) bool
	Windows    []Win
	Icons      []Icon
	Programs   []Program
	Recipes    []Recipe
	History    []string // recent queries, newest first
	AsciiIcons bool     // draw ASCII substitutes instead of emoji
}

Env is everything providers need from the desk (no UI).

type Hit

type Hit struct {
	Title    string
	Subtitle string
	Icon     string
	Score    int
	Run      func()
}

Hit is one ranked result in the command palette.

func Search(env Env) []Hit

Search returns ranked hits for the current query.

type Icon

type Icon struct {
	Label, Action, Glyph string
}

Icon is a desktop shortcut.

type Program

type Program struct {
	ID, Name, Action, Icon string
}

Program is a user-registered launcher.

type Recipe

type Recipe struct {
	Match   string
	Action  string
	Confirm bool
}

Recipe is a user-defined phrase → action.

type Win

type Win struct {
	ID, Title string
	Minimized bool
}

Win is a minimal window descriptor for focus hits.

Jump to

Keyboard shortcuts

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