domain

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package domain defines the core domain models, constants, and shared types for the Neru application.

This package contains the fundamental building blocks that define the Neru domain, including mode definitions, action types, and other shared constants and types that are used across multiple packages in the application.

Index

Constants

View Source
const (
	ModeNameIdle     = "idle"
	ModeNameHints    = "hints"
	ModeNameGrid     = "grid"
	ModeNameScroll   = "scroll"
	ModeNameQuadGrid = "quadgrid"
)

Mode names as strings.

View Source
const (
	CommandPing              = "ping"
	CommandStart             = "start"
	CommandStop              = "stop"
	CommandAction            = "action"
	CommandStatus            = "status"
	CommandConfig            = "config"
	CommandReloadConfig      = "reload"
	CommandHealth            = "health"
	CommandMetrics           = "metrics"
	CommandToggleScreenShare = "toggle-screen-share"
)

IPC Commands.

View Source
const (
	UnknownAction = "unknown"
	UnknownMode   = "unknown"
)

Mode-related constants.

View Source
const (
	BundleIDDock               = "com.apple.dock"
	BundleIDNotificationCenter = "com.apple.notificationcenterui"
)

Bundle ID constants for macOS system applications.

View Source
const (
	DefaultHintCharacters = "asdfghjkl"
	DefaultExitKey        = "escape"
)

Default values.

View Source
const (
	SubgridRows = 3
	SubgridCols = 3
)

Grid subgrid dimensions.

View Source
const (
	ShellCommandTimeout = 30 * time.Second
)

Timeout constants.

Variables

This section is empty.

Functions

func ActionFromString

func ActionFromString(actionStr string) (action.Type, bool)

ActionFromString converts a string to its action.Type representation.

func ActionString

func ActionString(actionType action.Type) string

ActionString converts an action.Type to its string representation.

func ModeString

func ModeString(mode Mode) string

ModeString converts a Mode to its string representation.

Types

type BaseManager added in v1.11.0

type BaseManager struct {
	Logger *zap.Logger
	// contains filtered or unexported fields
}

BaseManager provides common functionality for domain managers. It contains shared fields and methods used across different domain managers.

func (*BaseManager) CurrentInput added in v1.11.0

func (m *BaseManager) CurrentInput() string

CurrentInput returns the current input string.

func (*BaseManager) Reset added in v1.11.0

func (m *BaseManager) Reset()

Reset resets the base manager to its initial state.

func (*BaseManager) SetCurrentInput added in v1.11.0

func (m *BaseManager) SetCurrentInput(input string)

SetCurrentInput sets the current input string.

type Mode

type Mode int

Mode is the current mode of the application.

const (
	// ModeIdle represents the idle mode.
	ModeIdle Mode = iota
	// ModeHints represents the hints mode.
	ModeHints
	// ModeGrid represents the grid mode.
	ModeGrid
	// ModeScroll represents the scroll mode.
	ModeScroll
	// ModeQuadGrid represents the quad-grid navigation mode.
	ModeQuadGrid
)

type Router added in v1.17.0

type Router struct {
	Logger       *zap.Logger
	ModeExitKeys []string // Keys that exit the mode
}

Router provides common routing functionality for mode-based key handling. It can be embedded by specific routers (grid, hint) to share common logic.

func NewRouter added in v1.17.0

func NewRouter(logger *zap.Logger) *Router

NewRouter creates a new base router with the specified logger.

func NewRouterWithExitKeys added in v1.17.0

func NewRouterWithExitKeys(logger *zap.Logger, exitKeys []string) *Router

NewRouterWithExitKeys creates a new base router with custom exit keys.

func (*Router) IsExitKey added in v1.17.0

func (r *Router) IsExitKey(key string) bool

IsExitKey checks if the given key is an exit key. Returns true if the key should trigger mode exit.

Directories

Path Synopsis
Package action defines domain models for user actions.
Package action defines domain models for user actions.
Package element provides domain models for UI elements.
Package element provides domain models for UI elements.
Package grid provides domain models and logic for grid-based navigation.
Package grid provides domain models and logic for grid-based navigation.
Package hint provides hint generation algorithms for UI elements.
Package hint provides hint generation algorithms for UI elements.
Package quadgrid provides recursive quadrant-based navigation for screen coordinates.
Package quadgrid provides recursive quadrant-based navigation for screen coordinates.
Package state provides centralized state management for the Neru application.
Package state provides centralized state management for the Neru application.

Jump to

Keyboard shortcuts

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