config

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Themes embed.FS

Functions

func Get

func Get(config string) error

func SetupConfigOnDisk added in v0.12.3

func SetupConfigOnDisk()

func SetupDefaultThemeOnDisk added in v0.12.3

func SetupDefaultThemeOnDisk()

Types

type AI added in v0.9.0

type AI struct {
	GeneralModule `koanf:",squash"`
	Anthropic     Anthropic `koanf:"anthropic"`
}

type ActivationLabelWidget

type ActivationLabelWidget struct {
	LabelWidget  `koanf:",squash"`
	Overlay      bool `koanf:"overlay"`
	HideModifier bool `koanf:"hide_modifier"`
}

type ActivationMode

type ActivationMode struct {
	Disabled bool   `koanf:"disabled"`
	Labels   string `koanf:"labels"`
	UseFKeys bool   `koanf:"use_f_keys"`
}

type ActivationModifiers added in v0.11.0

type ActivationModifiers struct {
	KeepOpen  string `koanf:"keep_open"`
	Alternate string `koanf:"alternate"`
}

type AiKeys added in v0.11.0

type AiKeys struct {
	ClearSession     []string `koanf:"clear_session"`
	CopyLastResponse []string `koanf:"copy_last_response"`
	ResumeSession    []string `koanf:"resume_session"`
	RunLastResponse  []string `koanf:"run_last_response"`
}

type AiListWrapper added in v0.9.2

type AiListWrapper struct {
	BoxWidget `koanf:",squash"`
	Item      LabelWidget `koanf:"item"`
}

type AiScroll added in v0.9.0

type AiScroll struct {
	Widget           `koanf:",squash"`
	List             AiListWrapper `koanf:"list"`
	OverlayScrolling bool          `koanf:"overlay_scrolling"`
	HScrollbarPolicy string        `koanf:"h_scrollbar_policy"`
	VScrollbarPolicy string        `koanf:"v_scrollbar_policy"`
}

type Anchors

type Anchors struct {
	Bottom bool `koanf:"bottom"`
	Left   bool `koanf:"left"`
	Right  bool `koanf:"right"`
	Top    bool `koanf:"top"`
}

type Anthropic added in v0.9.0

type Anthropic struct {
	Prompts []AnthropicPrompt `koanf:"prompts"`
}

type AnthropicPrompt added in v0.9.10

type AnthropicPrompt struct {
	Model            string  `koanf:"model"`
	MaxTokens        int     `koanf:"max_tokens"`
	Temperature      float64 `koanf:"temperature"`
	Label            string  `koanf:"label"`
	Prompt           string  `koanf:"prompt"`
	SingleModuleOnly bool    `koanf:"single_module_only"`
}

type ApplicationActions added in v0.9.10

type ApplicationActions struct {
	Enabled          bool `koanf:"enabled"`
	HideCategory     bool `koanf:"hide_category"`
	HideWithoutQuery bool `koanf:"hide_without_query"`
}

type Applications

type Applications struct {
	GeneralModule `koanf:",squash"`
	Actions       ApplicationActions `koanf:"actions"`
	Cache         bool               `koanf:"cache"`
	ContextAware  bool               `koanf:"context_aware"`
	PrioritizeNew bool               `koanf:"prioritize_new"`
	ShowGeneric   bool               `koanf:"show_generic"`
}

type Bar added in v0.8.0

type Bar struct {
	Entries []BarEntry `koanf:"entries"`
}

type BarEntry added in v0.8.0

type BarEntry struct {
	Exec   string `koanf:"exec"`
	Icon   string `koanf:"icon"`
	Label  string `koanf:"label"`
	Module string `koanf:"module"`
}

type BarEntryWrapper added in v0.8.0

type BarEntryWrapper struct {
	BoxWidget `koanf:",squash"`
	Icon      ImageWidget `koanf:"icon"`
	Label     LabelWidget `koanf:"label"`
}

type BarWrapper added in v0.8.0

type BarWrapper struct {
	BoxWidget `koanf:",squash"`
	Position  string          `koanf:"position"`
	Entry     BarEntryWrapper `koanf:"entry"`
}

type Blacklist added in v0.10.4

type Blacklist struct {
	Regexp string `koanf:"regexp"`
	Label  bool   `koanf:"label"`
	Sub    bool   `koanf:"sub"`

	// internal
	Reg *regexp.Regexp `koanf:"-"`
}

type BookmarkEntry added in v0.10.0

type BookmarkEntry struct {
	Label    string   `koanf:"label"`
	Url      string   `koanf:"url"`
	Keywords []string `koanf:"keywords"`
}

type BookmarkGroup added in v0.10.1

type BookmarkGroup struct {
	Label            string          `koanf:"label"`
	Prefix           string          `koanf:"prefix"`
	IgnoreUnprefixed bool            `koanf:"ignore_unprefixed"`
	Entries          []BookmarkEntry `koanf:"entries"`
}

type Bookmarks added in v0.10.0

type Bookmarks struct {
	GeneralModule `koanf:",squash"`
	Groups        []BookmarkGroup `koanf:"groups"`
	Entries       []BookmarkEntry `koanf:"entries"`
}

type Box

type Box struct {
	BoxWidget `koanf:",squash"`
	Scroll    Scroll        `koanf:"scroll"`
	AiScroll  AiScroll      `koanf:"ai_scroll"`
	Revert    bool          `koanf:"revert"`
	Search    SearchWrapper `koanf:"search"`
	Bar       BarWrapper    `koanf:"bar"`
}

type BoxWidget

type BoxWidget struct {
	Widget      `koanf:",squash"`
	Orientation string `koanf:"orientation"`
	Spacing     int    `koanf:"spacing"`
}

type Builtins

type Builtins struct {
	Applications   Applications   `koanf:"applications"`
	AI             AI             `koanf:"ai"`
	Bookmarks      Bookmarks      `koanf:"bookmarks"`
	Calc           Calc           `koanf:"calc"`
	Clipboard      Clipboard      `koanf:"clipboard"`
	Commands       Commands       `koanf:"commands"`
	CustomCommands CustomCommands `koanf:"custom_commands"`
	Dmenu          Dmenu          `koanf:"dmenu"`
	Emojis         Emojis         `koanf:"emojis"`
	Finder         Finder         `koanf:"finder"`
	Runner         Runner         `koanf:"runner"`
	SSH            SSH            `koanf:"ssh"`
	Switcher       Switcher       `koanf:"switcher"`
	Symbols        Symbols        `koanf:"symbols"`
	Websearch      Websearch      `koanf:"websearch"`
	Windows        Windows        `koanf:"windows"`
	XdphPicker     XdphPicker     `koanf:"xdph_picker"`
	Translation    Translation    `koanf:"translation"`
}

type Calc added in v0.7.0

type Calc struct {
	GeneralModule `koanf:",squash"`
	RequireNumber bool `koanf:"require_number"`
}

type Clipboard

type Clipboard struct {
	GeneralModule   `koanf:",squash"`
	AvoidLineBreaks bool   `koanf:"avoid_line_breaks"`
	ImageHeight     int    `koanf:"image_height"`
	MaxEntries      int    `koanf:"max_entries"`
	Exec            string `koanf:"exec"`
}

type Commands

type Commands struct {
	GeneralModule `koanf:",squash"`
}

type Config

type Config struct {
	ActivationMode      ActivationMode `koanf:"activation_mode"`
	AsWindow            bool           `koanf:"as_window"`
	Bar                 Bar            `koanf:"bar"`
	Builtins            Builtins       `koanf:"builtins"`
	CloseWhenOpen       bool           `koanf:"close_when_open"`
	DisableClickToClose bool           `koanf:"disable_click_to_close"`
	Keys                Keys           `koanf:"keys"`
	Disabled            []string       `koanf:"disabled"`
	Events              Events         `koanf:"events"`
	ForceKeyboardFocus  bool           `koanf:"force_keyboard_focus"`
	HotreloadTheme      bool           `koanf:"hotreload_theme"`
	IgnoreMouse         bool           `koanf:"ignore_mouse"`
	AppLaunchPrefix     string         `koanf:"app_launch_prefix"`
	List                List           `koanf:"list"`
	Locale              string         `koanf:"locale"`
	Monitor             string         `koanf:"monitor"`
	Plugins             []Plugin       `koanf:"plugins"`
	Search              Search         `koanf:"search"`
	Terminal            string         `koanf:"terminal"`
	TerminalTitleFlag   string         `koanf:"terminal_title_flag"`
	Theme               string         `koanf:"theme"`
	ThemeBase           []string       `koanf:"theme_base"`
	Timeout             int            `koanf:"timeout"`

	Available []string `koanf:"-"`
	Hidden    []string `koanf:"-"`
	IsService bool     `koanf:"-"`
}
var Cfg *Config

type CustomCommand

type CustomCommand struct {
	Cmd               string   `koanf:"cmd"`
	CmdAlt            string   `koanf:"cmd_alt"`
	Env               []string `koanf:"env"`
	Name              string   `koanf:"name"`
	Path              string   `koanf:"path"`
	Terminal          bool     `koanf:"terminal"`
	TerminalTitleFlag string   `koanf:"terminal_title_flag"`
}

type CustomCommands

type CustomCommands struct {
	GeneralModule `koanf:",squash"`
	Commands      []CustomCommand `koanf:"commands"`
}

type Dmenu

type Dmenu struct {
	GeneralModule `koanf:",squash"`
	Separator     string `koanf:"separator"`
	LabelColumn   int    `koanf:"label_column"`
}

type Emojis

type Emojis struct {
	GeneralModule   `koanf:",squash"`
	Exec            string `koanf:"exec"`
	ExecAlt         string `koanf:"exec_alt"`
	ShowUnqualified bool   `koanf:"show_unqualified"`
}

type EventType added in v0.10.12

type EventType int
const (
	EventLaunch EventType = iota
	EventSelection
	EventExit
	EventActivate
	EventQueryChange
)

type Events added in v0.10.12

type Events struct {
	OnLaunch      string `koanf:"on_launch"`
	OnSelection   string `koanf:"on_selection"`
	OnExit        string `koanf:"on_exit"`
	OnActivate    string `koanf:"on_activate"`
	OnQueryChange string `koanf:"on_query_change"`
}

type Finder

type Finder struct {
	GeneralModule   `koanf:",squash"`
	UseFD           bool `koanf:"use_fd"`
	IgnoreGitIgnore bool `koanf:"ignore_gitignore"`
	Concurrency     int  `koanf:"concurrency"`
	PreviewImages   bool `koanf:"preview_images"`
}

type GeneralModule

type GeneralModule struct {
	AutoSelect         bool        `koanf:"auto_select"`
	Blacklist          []Blacklist `koanf:"blacklist"`
	Delay              int         `koanf:"delay"`
	EagerLoading       bool        `koanf:"eager_loading"`
	ExternalConfig     bool        `koanf:"external_config"`
	Hidden             bool        `koanf:"hidden"`
	History            bool        `koanf:"history"`
	Icon               string      `koanf:"icon"`
	KeepSort           bool        `koanf:"keep_sort"`
	MinChars           int         `koanf:"min_chars"`
	Name               string      `koanf:"name"`
	Placeholder        string      `koanf:"placeholder"`
	Prefix             string      `koanf:"prefix"`
	Refresh            bool        `koanf:"refresh"`
	ShowIconWhenSingle bool        `koanf:"show_icon_when_single"`
	ShowSubWhenSingle  bool        `koanf:"show_sub_when_single"`
	SwitcherOnly       bool        `koanf:"switcher_only"`
	Theme              string      `koanf:"theme"`
	ThemeBase          []string    `koanf:"theme_base"`
	Typeahead          bool        `koanf:"typeahead"`
	Weight             int         `koanf:"weight"`
	OnSelect           string      `koanf:"on_select"`
	OutputPlaceholder  string      `koanf:"output_placeholder"`

	// internal
	HasInitialSetup bool `koanf:"-"`
	IsSetup         bool `koanf:"-"`
}

type ImageWidget

type ImageWidget struct {
	Widget    `koanf:",squash"`
	Icon      string `koanf:"icon"`
	IconSize  string `koanf:"icon_size"`
	PixelSize int    `koanf:"pixel_size"`
	Theme     string `koanf:"theme"`
}

type Keys added in v0.11.0

type Keys struct {
	AcceptTypeahead     []string            `koanf:"accept_typeahead"`
	ActivationModifiers ActivationModifiers `koanf:"activation_modifiers"`
	TriggerLabels       string              `koanf:"trigger_labels"`
	Ai                  AiKeys              `koanf:"ai"`
	Close               []string            `koanf:"close"`
	Next                []string            `koanf:"next"`
	Prev                []string            `koanf:"prev"`
	RemoveFromHistory   []string            `koanf:"remove_from_history"`
	ResumeQuery         []string            `koanf:"resume_query"`
	ToggleExactSearch   []string            `koanf:"toggle_exact_search"`
}

type LabelWidget

type LabelWidget struct {
	Widget  `koanf:",squash"`
	Justify string  `koanf:"justify"`
	XAlign  float32 `koanf:"x_align"`
	YAlign  float32 `koanf:"y_align"`
	Wrap    bool    `koanf:"wrap"`
}

type List

type List struct {
	Cycle               bool   `koanf:"cycle"`
	DynamicSub          bool   `koanf:"dynamic_sub"`
	KeyboardScrollStyle string `koanf:"keyboard_scroll_style"`
	MaxEntries          int    `koanf:"max_entries"`
	Placeholder         string `koanf:"placeholder"`
	ShowInitialEntries  bool   `koanf:"show_initial_entries"`
	SingleClick         bool   `koanf:"single_click"`
	VisibilityThreshold int    `koanf:"visibility_threshold"`
}

type ListItemWidget

type ListItemWidget struct {
	BoxWidget       `koanf:",squash"`
	Revert          bool                  `koanf:"revert"`
	ActivationLabel ActivationLabelWidget `koanf:"activation_label"`
	Icon            ImageWidget           `koanf:"icon"`
	Text            TextWrapper           `koanf:"text"`
}

type ListWrapper

type ListWrapper struct {
	AlwaysShow  bool           `koanf:"always_show"`
	Grid        bool           `koanf:"grid"`
	Item        ListItemWidget `koanf:"item"`
	MarkerColor string         `koanf:"marker_color"`
	MaxHeight   int            `koanf:"max_height"`
	MaxWidth    int            `koanf:"max_width"`
	MinHeight   int            `koanf:"min_height"`
	MinWidth    int            `koanf:"min_width"`
	Orientation string         `koanf:"orientation"`
	Placeholder LabelWidget    `koanf:"placeholder"`
	Widget      `koanf:",squash"`
}

type Margins

type Margins struct {
	Bottom int `koanf:"bottom"`
	End    int `koanf:"end"`
	Start  int `koanf:"start"`
	Top    int `koanf:"top"`
}

type Plugin

type Plugin struct {
	GeneralModule    `koanf:",squash"`
	Cmd              string            `koanf:"cmd"`
	CmdAlt           string            `koanf:"cmd_alt"`
	Entries          []util.Entry      `koanf:"entries"`
	LabelColumn      int               `koanf:"label_column"`
	Matching         util.MatchingType `koanf:"matching"`
	RecalculateScore bool              `koanf:"recalculate_score,omitempty"`
	ResultColumn     int               `koanf:"result_column"`
	Separator        string            `koanf:"separator"`
	Src              string            `koanf:"src"`
	SrcOnce          string            `koanf:"src_once"`
	Terminal         bool              `koanf:"terminal"`
	Parser           string            `koanf:"parser"`
	KvSeparator      string            `koanf:"kv_separator"`
	Output           bool              `koanf:"output"`
	Keywords         []string          `koanf:"keywords"`
}

type PromptWidget

type PromptWidget struct {
	LabelWidget `koanf:",squash"`
	ImageWidget `koanf:",squash"`
	Text        string `koanf:"text"`
	Icon        string `koanf:"icon"`
}

type Runner

type Runner struct {
	GeneralModule `koanf:",squash"`
	Excludes      []string `koanf:"excludes"`
	Includes      []string `koanf:"includes"`
	ShellConfig   string   `koanf:"shell_config"`
	GenericEntry  bool     `koanf:"generic_entry"`
	UseFD         bool     `koanf:"use_fd"`
}

type SSH

type SSH struct {
	GeneralModule `koanf:",squash"`
	ConfigFile    string `koanf:"config_file"`
	HostFile      string `koanf:"host_file"`
}

type Scroll

type Scroll struct {
	Widget           `koanf:",squash"`
	List             ListWrapper `koanf:"list"`
	OverlayScrolling bool        `koanf:"overlay_scrolling"`
	HScrollbarPolicy string      `koanf:"h_scrollbar_policy"`
	VScrollbarPolicy string      `koanf:"v_scrollbar_policy"`
}
type Search struct {
	ArgumentDelimiter string `koanf:"argument_delimiter"`
	Delay             int    `koanf:"delay"`
	Placeholder       string `koanf:"placeholder"`
	ResumeLastQuery   bool   `koanf:"resume_last_query"`
}

type SearchWidget

type SearchWidget struct {
	Widget `koanf:",squash"`
}

type SearchWrapper

type SearchWrapper struct {
	BoxWidget `koanf:",squash"`
	Revert    bool          `koanf:"revert"`
	Input     SearchWidget  `koanf:"input"`
	Prompt    PromptWidget  `koanf:"prompt"`
	Clear     ImageWidget   `koanf:"clear"`
	Spinner   SpinnerWidget `koanf:"spinner"`
}

type SpinnerWidget

type SpinnerWidget struct {
	Widget `koanf:",squash"`
}

type Switcher

type Switcher struct {
	GeneralModule `koanf:",squash"`
}

type Symbols added in v0.9.8

type Symbols struct {
	GeneralModule `koanf:",squash"`
	AfterCopy     string `koanf:"after_copy"`
}

type TextWrapper

type TextWrapper struct {
	BoxWidget `koanf:",squash"`
	Label     LabelWidget `koanf:"label"`
	Revert    bool        `koanf:"revert"`
	Sub       LabelWidget `koanf:"sub"`
}

type Translation added in v0.12.0

type Translation struct {
	GeneralModule `koanf:",squash"`
	Provider      string `koanf:"provider"`
}

type UI

type UI struct {
	Anchors         Anchors `koanf:"anchors"`
	Fullscreen      bool    `koanf:"fullscreen"`
	IgnoreExclusive bool    `koanf:"ignore_exclusive"`
	Window          Window  `koanf:"window"`

	// internal
	AlignMap        map[string]gtk.Align         `koanf:"-"`
	IconSizeMap     map[string]gtk.IconSize      `koanf:"-"`
	IconSizeIntMap  map[string]int               `koanf:"-"`
	JustifyMap      map[string]gtk.Justification `koanf:"-"`
	OrientationMap  map[string]gtk.Orientation   `koanf:"-"`
	ScrollPolicyMap map[string]gtk.PolicyType    `koanf:"-"`
}

func GetLayout

func GetLayout(theme string, base []string) (*UI, error)

func (*UI) InitUnitMaps

func (u *UI) InitUnitMaps()

type UICfg

type UICfg struct {
	UI UI `koanf:"ui"`
}

type Websearch

type Websearch struct {
	GeneralModule `koanf:",squash"`
	Entries       []WebsearchEntry `koanf:"entries"`
}

type WebsearchEntry added in v0.9.7

type WebsearchEntry struct {
	Name         string `koanf:"name"`
	Url          string `koanf:"url"`
	Prefix       string `koanf:"prefix"`
	SwitcherOnly bool   `koanf:"switcher_only"`
}

type Widget

type Widget struct {
	CssClasses []string `koanf:"css_classes"`
	HAlign     string   `koanf:"h_align"`
	HExpand    bool     `koanf:"h_expand"`
	Height     int      `koanf:"height"`
	Hide       bool     `koanf:"hide"`
	Margins    Margins  `koanf:"margins"`
	Name       string   `koanf:"name"`
	Opacity    float64  `koanf:"opacity"`
	VAlign     string   `koanf:"v_align"`
	VExpand    bool     `koanf:"h_expand"`
	Width      int      `koanf:"width"`
}

type Window

type Window struct {
	Widget `koanf:",squash"`
	Box    Box `koanf:"box"`
}

type Windows

type Windows struct {
	GeneralModule `koanf:",squash"`
}

type XdphPicker added in v0.11.4

type XdphPicker struct {
	GeneralModule `koanf:",squash"`
}

Jump to

Keyboard shortcuts

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