Documentation
¶
Index ¶
Constants ¶
const ( ExitNormal = 0 // Normal selection ExitCancelled = 1 // User cancelled (Escape) ExitCustom1 = 10 // kb-custom-1 (Alt+Return by default) ExitCustom2 = 11 // kb-custom-2 (Alt+d by default) ExitCustom3 = 12 // kb-custom-3 )
Exit codes for rofi kb-custom keybindings
Variables ¶
var ErrCancelled = errors.New("palette cancelled")
ErrCancelled is returned when the user closes the palette without selecting an item.
Functions ¶
func DetectBackend ¶
DetectBackend returns the first available palette backend found in PATH, in priority order: rofi, fuzzel, wofi, dmenu.
Types ¶
type Backend ¶
type Backend interface {
// Show displays the palette and returns the selected item.
// prompt: the prompt text shown to the user
// items: the list of items to display
// message: optional context message (shown in rofi message bar)
// Returns: selected item result with exit code, or error
Show(prompt string, items []Item, message string) (SelectResult, error)
// Capabilities returns the features supported by this backend.
Capabilities() Capabilities
}
Backend shows a palette to the user and returns the selected item.
func AutoDetect ¶
AutoDetect selects the first available backend in priority order.
func NewBackend ¶
NewBackend creates a backend by name.
Supported names: auto, rofi, fuzzel, wofi, dmenu.
func NewDmenuBackend ¶
func NewDmenuBackend() Backend
func NewFuzzelBackend ¶
func NewFuzzelBackend() Backend
func NewRofiBackend ¶
func NewRofiBackend() Backend
func NewWofiBackend ¶
func NewWofiBackend() Backend
type Capabilities ¶
type Capabilities struct {
Icons bool // Supports icon display
Markup bool // Supports pango markup in labels
NonSelectable bool // Supports non-selectable rows (headers)
CustomKeys bool // Supports kb-custom-N keybindings
IndexOutput bool // Can output selection index (not just text)
MessageBar bool // Supports message/prompt bar
RowStates bool // Supports active/urgent row highlighting
}
Capabilities describes what features a backend supports.
type Item ¶
type Item struct {
Label string // Display text
Action string // Action identifier returned on selection
Icon string // Icon name (e.g., "firefox", "folder") for rofi -show-icons
Info string // Hidden data returned on selection (for action IDs)
Meta string // Hidden search keywords (rofi meta field)
IsHeader bool // Non-selectable section header (bold)
IsDivider bool // Non-selectable divider line (dim)
IsActive bool // Highlighted as current/active (rofi active row)
IsUrgent bool // Highlighted as urgent (rofi urgent row)
}
Item is a single selectable entry in a palette menu.
type Menu ¶
type Menu struct {
// contains filtered or unexported fields
}
Menu handles hierarchical menu navigation using a palette backend.
func (*Menu) SetMessage ¶
SetMessage sets a context message to display in the palette (rofi message bar).
func (*Menu) Show ¶
func (m *Menu) Show() (MenuResult, error)
Show displays the menu and handles navigation through submenus. Returns the action string of the selected leaf item, or ErrCancelled if user exits.
type MenuItem ¶
type MenuItem struct {
Label string // Display label (can include emoji prefix)
Action string // Action identifier (empty for parent items)
Icon string // Icon name for display
Meta string // Hidden search keywords
IsHeader bool // Non-selectable section header (bold)
IsDivider bool // Non-selectable divider line (dim)
IsActive bool // Highlight as current/active
}
MenuItem represents an item in the menu hierarchy.
type MenuResult ¶
type MenuResult struct {
Action string // The action identifier of the selected item
ExitCode int // Exit code (0=normal, 10=Alt+Return, 11=Alt+d)
}
MenuResult contains the result of a menu selection.
type SelectResult ¶
type SelectResult struct {
Item Item
ExitCode int // 0=normal, 10=kb-custom-1 (Alt+Return), 11=kb-custom-2 (Alt+d)
}
SelectResult contains the result of a palette selection.