app

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package app provides the core TUIOS application logic and window management.

Package app provides the core TUIOS application logic and window management.

Index

Constants

View Source
const (
	LeftHalfCircle  string = string(rune(0xe0b6))
	RightHalfCircle string = string(rune(0xe0b4))
)

Deprecated: Use config.GetWindowPillLeft() instead

Variables

This section is empty.

Functions

func DeleteTapeFile added in v0.4.0

func DeleteTapeFile(path string) error

DeleteTapeFile deletes a tape file

func EnableCallbacksAfterDelay added in v0.5.0

func EnableCallbacksAfterDelay() tea.Cmd

EnableCallbacksAfterDelay returns a command that waits briefly then sends a message to re-enable callbacks after buffered output has settled.

func FuzzyMatch added in v0.0.23

func FuzzyMatch(query, target string) (bool, []int)

FuzzyMatch performs fuzzy matching on a string

func GetTapeDirectory added in v0.4.0

func GetTapeDirectory() (string, error)

GetTapeDirectory returns the XDG data directory for tape files

func ListenForClientEvents added in v0.5.0

func ListenForClientEvents(eventChan chan ClientEvent) tea.Cmd

ListenForClientEvents creates a command that listens for client join/leave events. It safely reads from the event channel and converts events to messages for the update loop.

func ListenForStateSync added in v0.5.0

func ListenForStateSync(syncChan chan *session.SessionState) tea.Cmd

ListenForStateSync creates a command that listens for state sync from other clients. It safely reads from the sync channel and converts state to messages for the update loop.

func ListenForWindowExits

func ListenForWindowExits(exitChan chan string) tea.Cmd

ListenForWindowExits creates a command that listens for window process exits. It safely reads from the exit channel and converts exit signals to messages.

func RightString

func RightString(str string, width int, color color.Color) string

RightString returns a right-aligned string with decorative borders.

func SaveTape added in v0.4.0

func SaveTape(name string, content string) (string, error)

SaveTape saves tape content to a file in the XDG data directory

func SetGlobalStyleCacheSize added in v0.0.14

func SetGlobalStyleCacheSize(size int)

SetGlobalStyleCacheSize updates the maximum size of the global cache. This should be called during initialization, not during active rendering.

func SetInputHandler

func SetInputHandler(handler InputHandler)

SetInputHandler registers the input handler function. This must be called during initialization before the Update loop runs.

func SlowTickCmd

func SlowTickCmd() tea.Cmd

SlowTickCmd creates a command that generates tick messages at 30 FPS. Used during user interactions to improve responsiveness.

func TickCmd

func TickCmd() tea.Cmd

TickCmd creates a command that generates tick messages at 60 FPS. This drives the main update loop for animations and terminal content updates.

func TriggerAltScreenRedrawCmd added in v0.5.0

func TriggerAltScreenRedrawCmd() tea.Cmd

TriggerAltScreenRedrawCmd returns a command that immediately triggers alt screen apps (vim, htop, btop) to redraw via SIGWINCH.

Types

type CPUStats

type CPUStats struct {
	// contains filtered or unexported fields
}

CPUStats holds CPU usage statistics.

type ClientEvent added in v0.5.0

type ClientEvent struct {
	Type        string // "joined" or "left"
	ClientID    string
	ClientCount int
	Width       int // only for "joined"
	Height      int // only for "joined"
}

ClientEvent represents a client join or leave event for channel-based notification.

type ClientJoinedMsg added in v0.5.0

type ClientJoinedMsg struct {
	ClientID    string
	ClientCount int
	Width       int
	Height      int
}

ClientJoinedMsg is sent when another client joins the session.

type ClientLeftMsg added in v0.5.0

type ClientLeftMsg struct {
	ClientID    string
	ClientCount int
}

ClientLeftMsg is sent when another client leaves the session.

type DockItem added in v0.1.0

type DockItem struct {
	WindowIndex int
	Label       string
	Width       int // Total width including circles
}

DockItem represents a single item in the dock

type DockLayout added in v0.1.0

type DockLayout struct {
	LeftText       string
	LeftWidth      int
	RightWidth     int
	CenterStartX   int
	ItemPositions  []ItemPosition // Position of each dock item
	TruncatedCount int            // Number of items that don't fit
	VisibleItems   []DockItem     // Items that fit and should be displayed
	ModeInfo       ModeInfo       // Mode display information for styling
}

DockLayout contains calculated layout information for the dock

type EnableCallbacksMsg added in v0.5.0

type EnableCallbacksMsg struct{}

EnableCallbacksMsg is sent after a delay to re-enable VT emulator callbacks after restoring a daemon session.

type ForceRefreshMsg added in v0.5.0

type ForceRefreshMsg struct {
	Reason string
}

ForceRefreshMsg is sent to force all clients to re-render.

type HelpBinding added in v0.0.23

type HelpBinding struct {
	Action      string   // Action name (e.g., "new_window")
	Keys        []string // Keybindings (e.g., ["n", "ctrl+n"])
	Description string   // Human-readable description
	Category    string   // Category name
}

HelpBinding represents a single keybinding for the help menu

func SearchBindings added in v0.0.23

func SearchBindings(query string, categories []HelpCategory) []HelpBinding

SearchBindings performs fuzzy search across all bindings

type HelpCategory added in v0.0.23

type HelpCategory struct {
	Name     string        // Display name
	Bindings []HelpBinding // Bindings in this category
}

HelpCategory represents a category of keybindings

func GetHelpCategories added in v0.0.23

func GetHelpCategories(registry *config.KeybindRegistry) []HelpCategory

GetHelpCategories generates all help categories from the keybind registry

type HelpDimensions added in v0.0.23

type HelpDimensions struct {
	MaxKeyWidth      int // Maximum width of key column across ALL content
	MaxActionWidth   int // Maximum width of action column across ALL content
	MaxCategoryWidth int // Maximum width of category column (for search)
	FixedRows        int // Fixed number of rows to always display (15)
}

HelpDimensions holds fixed dimensions for consistent table rendering

func CalculateHelpDimensions added in v0.0.23

func CalculateHelpDimensions(categories []HelpCategory) HelpDimensions

CalculateHelpDimensions scans all categories and calculates fixed dimensions This ensures all tables have consistent sizes and don't jump when switching tabs/searching

type InputHandler

type InputHandler func(msg tea.Msg, o *OS) (tea.Model, tea.Cmd)

InputHandler is a function type that handles input messages. This allows the Update method to delegate to the input package without creating a circular dependency.

type ItemPosition added in v0.1.0

type ItemPosition struct {
	StartX      int
	EndX        int
	WindowIndex int
}

ItemPosition holds the position and size of a dock item

type KeyEvent added in v0.4.0

type KeyEvent struct {
	Key       string    // The key string representation
	Modifiers []string  // Modifier names (Ctrl, Shift, Alt, Cmd)
	Timestamp time.Time // When the key was pressed
	Count     int       // Number of consecutive identical keys
	Action    string    // Resolved action name (optional)
}

KeyEvent represents a captured keyboard event for the showkeys overlay.

type LogMessage

type LogMessage struct {
	Time    time.Time
	Level   string // INFO, WARN, ERROR
	Message string
}

LogMessage represents a log entry with timestamp and level.

type Mode

type Mode int

Mode represents the current interaction mode of the application.

const (
	// WindowManagementMode allows window manipulation and navigation.
	WindowManagementMode Mode = iota
	// TerminalMode passes input directly to the focused terminal.
	TerminalMode
)

type ModeInfo added in v0.1.0

type ModeInfo struct {
	Block     string // The character to display (e.g., "█")
	Color     string // Hex color for the block
	CursorPos string // Cursor position for copy mode (empty otherwise)
	IsTiling  bool   // Whether tiling mode is active
	NextSplit string // Next split direction when tiling ("V" or "H")
}

ModeInfo contains mode display information

type Notification

type Notification struct {
	ID        string
	Message   string
	Type      string // "info", "success", "warning", "error"
	StartTime time.Time
	Duration  time.Duration
	Animation *ui.Animation
}

Notification represents a temporary notification message.

type OS

type OS struct {
	Dragging           bool
	Resizing           bool
	ResizeCorner       ResizeCorner
	PreResizeState     terminal.Window
	ResizeStartX       int
	ResizeStartY       int
	DragOffsetX        int
	DragOffsetY        int
	DragStartX         int // Track where drag started
	DragStartY         int // Track where drag started
	TiledX             int // Original tiled position X
	TiledY             int // Original tiled position Y
	TiledWidth         int // Original tiled width
	TiledHeight        int // Original tiled height
	DraggedWindowIndex int // Index of window being dragged
	Windows            []*terminal.Window
	FocusedWindow      int
	Width              int
	Height             int
	X                  int
	Y                  int
	Mode               Mode

	LastMouseX         int
	LastMouseY         int
	HasActiveTerminals bool
	ShowHelp           bool
	InteractionMode    bool                       // True when actively dragging/resizing
	MouseSnapping      bool                       // Enable/disable mouse snapping
	WindowExitChan     chan string                // Channel to signal window closure
	StateSyncChan      chan *session.SessionState // Channel for thread-safe state sync from callbacks
	ClientEventChan    chan ClientEvent           // Channel for thread-safe client join/leave notifications
	Animations         []*ui.Animation            // Active animations
	CPUHistory         []float64                  // CPU usage history for graph
	LastCPUUpdate      time.Time                  // Last time CPU was updated
	RAMUsage           float64                    // Cached RAM usage percentage
	LastRAMUpdate      time.Time                  // Last time RAM was updated
	AutoTiling         bool                       // Automatic tiling mode enabled
	MasterRatio        float64                    // Master window width ratio for tiling (0.3-0.7)
	// BSP tiling state
	WorkspaceTrees        map[int]*layout.BSPTree // BSP tree per workspace
	PreselectionDir       layout.PreselectionDir  // Pending preselection direction (0 = none)
	TilingScheme          layout.AutoScheme       // Default auto-insertion scheme
	SplitTargetWindowID   string                  // Window ID to split (set before AddWindow for splits)
	WindowToBSPID         map[string]int          // Maps window UUID to stable BSP integer ID
	NextBSPWindowID       int                     // Next BSP window ID to assign (starts at 1)
	RenamingWindow        bool                    // True when renaming a window
	RenameBuffer          string                  // Buffer for new window name
	PrefixActive          bool                    // True when prefix key was pressed (tmux-style)
	WorkspacePrefixActive bool                    // True when Ctrl+B, w was pressed (workspace sub-prefix)
	MinimizePrefixActive  bool                    // True when Ctrl+B, m was pressed (minimize sub-prefix)
	TilingPrefixActive    bool                    // True when Ctrl+B, t was pressed (tiling/window sub-prefix)
	DebugPrefixActive     bool                    // True when Ctrl+B, D was pressed (debug sub-prefix)
	LastPrefixTime        time.Time               // Time when prefix was activated
	HelpScrollOffset      int                     // Scroll offset for help menu
	HelpCategory          int                     // Current help category index (for left/right navigation)
	HelpSearchMode        bool                    // True when help search is active
	HelpSearchQuery       string                  // Current search query in help menu
	CurrentWorkspace      int                     // Current active workspace (1-9)
	NumWorkspaces         int                     // Total number of workspaces
	WorkspaceFocus        map[int]int             // Remembers focused window per workspace
	WorkspaceLayouts      map[int][]WindowLayout  // Stores custom layouts per workspace
	WorkspaceHasCustom    map[int]bool            // Tracks if workspace has custom layout
	WorkspaceMasterRatio  map[int]float64         // Stores master ratio per workspace
	ShowLogs              bool                    // True when showing log overlay
	LogMessages           []LogMessage            // Store log messages
	LogScrollOffset       int                     // Scroll offset for log viewer
	Notifications         []Notification          // Active notifications
	SelectionMode         bool                    // True when in text selection mode
	ClipboardContent      string                  // Store clipboard content from tea.ClipboardMsg
	ShowCacheStats        bool                    // True when showing style cache statistics overlay
	ShowQuitConfirm       bool                    // True when showing quit confirmation dialog
	QuitConfirmSelection  int                     // 0 = Yes (left), 1 = No (right)
	// Pending resize tracking for debouncing PTY resize during mouse drag
	PendingResizes map[string][2]int // windowID -> [width, height] of pending PTY resize

	// SSH mode fields
	SSHSession ssh.Session // SSH session reference (nil in local mode)
	IsSSHMode  bool        // True when running over SSH
	// Daemon mode fields
	IsDaemonSession   bool               // True when running as part of a persistent daemon session
	DaemonClient      *session.TUIClient // Client for daemon communication (nil in local mode)
	SessionName       string             // Name of the daemon session (if attached)
	RestoredFromState bool               // True after RestoreFromState, cleared after first resize
	// Multi-client effective size (min of all clients in session)
	EffectiveWidth  int // Effective width for rendering (min of all clients, 0 = use terminal size)
	EffectiveHeight int // Effective height for rendering (min of all clients, 0 = use terminal size)
	// Keyboard enhancement support (Kitty protocol)
	KeyboardEnhancementsEnabled bool // True when terminal supports keyboard enhancements
	// Keybind registry for user-configurable keybindings
	KeybindRegistry *config.KeybindRegistry
	// Showkeys feature
	ShowKeys          bool       // True when showkeys overlay is enabled
	RecentKeys        []KeyEvent // Ring buffer of recently pressed keys
	KeyHistoryMaxSize int        // Maximum number of keys to display (default: 5)
	// Tape scripting support
	ScriptPlayer       any       // *tape.Player - script playback engine
	ScriptMode         bool      // True when running a tape script
	ScriptPaused       bool      // True when script playback is paused
	ScriptConverter    any       // *tape.ScriptMessageConverter - converts tape commands to tea.Msg
	ScriptExecutor     any       // *tape.CommandExecutor - executes tape commands
	ScriptSleepUntil   time.Time // When to resume after a sleep command
	ScriptFinishedTime time.Time // When the script finished (for auto-hide)
	// Tape manager UI
	ShowTapeManager   bool              // True when showing tape manager overlay
	TapeManager       *TapeManagerState // Tape manager state
	TapeRecorder      *tape.Recorder    // Tape recorder for recording sessions
	TapeRecordingName string            // Name of current recording
	TapePrefixActive  bool              // True when Ctrl+B, T was pressed (tape sub-prefix)
	// Remote command processing
	ProcessingRemoteKeys bool // True when processing remote send-keys (disables animations)
	// Remote tape script progress (used instead of ScriptPlayer for tape exec)
	RemoteScriptIndex int // Current command index (0-based)
	RemoteScriptTotal int // Total commands in remote script
	// contains filtered or unexported fields
}

OS represents the main application state and window manager. It manages all windows, workspaces, and user interactions.

func (*OS) AddDaemonWindow added in v0.5.0

func (m *OS) AddDaemonWindow(title string) *OS

AddDaemonWindow creates a new window using a daemon-managed PTY. This is the daemon-mode equivalent of AddWindow.

func (*OS) AddWindow

func (m *OS) AddWindow(title string) *OS

AddWindow adds a new window to the current workspace. In daemon mode, this creates a daemon-managed PTY and window.

func (*OS) AddWindowToBSPTree added in v0.4.4

func (m *OS) AddWindowToBSPTree(window *terminal.Window)

AddWindowToBSPTree adds a window to the BSP tree and applies the layout. This should be called when a new window is created in tiling mode.

func (*OS) AdjustTilingNeighbors added in v0.2.2

func (m *OS) AdjustTilingNeighbors(resized *terminal.Window, newX, newY, newWidth, newHeight int)

AdjustTilingNeighbors adjusts ALL windows on affected split lines with constraint-based positioning This is the core tiling resize algorithm used by both mouse and keyboard resize operations

func (*OS) AdjustTilingNeighborsVisual added in v0.3.3

func (m *OS) AdjustTilingNeighborsVisual(resized *terminal.Window, newX, newY, newWidth, newHeight int)

AdjustTilingNeighborsVisual is like AdjustTilingNeighbors but uses visual-only resize. This defers PTY resize operations until the drag completes, improving responsiveness during mouse resize operations while still constraining window sizes appropriately.

func (*OS) ApplyBSPLayout added in v0.4.4

func (m *OS) ApplyBSPLayout()

ApplyBSPLayout applies the BSP tree layout to all windows in the current workspace

func (*OS) ApplyStateSync added in v0.5.0

func (m *OS) ApplyStateSync(state *session.SessionState) error

ApplyStateSync applies a state update from another client. This handles window creation, deletion, and property updates.

func (*OS) BuildBSPTreeFromCurrentLayout added in v0.4.4

func (m *OS) BuildBSPTreeFromCurrentLayout()

BuildBSPTreeFromCurrentLayout creates a BSP tree from the current window geometry. This is used when enabling tiling mode to preserve the existing layout structure.

func (*OS) BuildSessionState added in v0.5.0

func (m *OS) BuildSessionState() *session.SessionState

BuildSessionState creates a serializable SessionState from the current OS state. This is called progressively during Update() to sync state to the daemon. For windows with active animations, it uses the final (target) positions so other clients see the end state immediately without animation jitter.

func (*OS) CalculateDockLayout added in v0.1.0

func (m *OS) CalculateDockLayout() DockLayout

CalculateDockLayout calculates the layout for the dock including positions of all items. This function is shared between rendering (render.go) and mouse handling (mouse.go) to ensure consistent positioning.

func (*OS) CaptureKeyEvent added in v0.4.0

func (m *OS) CaptureKeyEvent(msg tea.KeyPressMsg)

CaptureKeyEvent captures a keyboard event for the showkeys overlay. It handles key formatting, modifier extraction, and history management.

func (*OS) ClampWindowsToView added in v0.5.0

func (m *OS) ClampWindowsToView()

ClampWindowsToView ensures all floating windows are visible within the current terminal bounds. This is called when reattaching with a smaller terminal or when the terminal shrinks. Windows that would be off-screen are repositioned to remain visible.

func (*OS) Cleanup added in v0.0.16

func (m *OS) Cleanup()

Cleanup performs cleanup operations when the application exits.

func (*OS) CleanupExpiredKeys added in v0.4.0

func (m *OS) CleanupExpiredKeys(timeout time.Duration)

CleanupExpiredKeys removes keys from the history that have expired based on timeout. Keys older than the timeout duration are removed.

func (*OS) CleanupNotifications

func (m *OS) CleanupNotifications()

CleanupNotifications removes expired notifications.

func (*OS) ClearPreselection added in v0.4.4

func (m *OS) ClearPreselection()

ClearPreselection clears any active preselection

func (*OS) CloseWindow added in v0.4.0

func (m *OS) CloseWindow(windowID string) error

CloseWindow closes a window.

func (*OS) CloseWindowByName added in v0.5.0

func (m *OS) CloseWindowByName(name string) error

CloseWindowByName closes all windows with the given name.

func (*OS) CompleteAllAnimations added in v0.1.0

func (m *OS) CompleteAllAnimations()

CompleteAllAnimations immediately completes all active animations This is used in tiling mode to prevent state conflicts when starting a new drag

func (*OS) CompleteWindowAnimations added in v0.1.0

func (m *OS) CompleteWindowAnimations(windowIndex int)

CompleteWindowAnimations immediately completes all animations for a specific window This is used when starting a new drag to avoid conflicts with pending animations

func (*OS) CreateMinimizeAnimation

func (m *OS) CreateMinimizeAnimation(i int) *ui.Animation

CreateMinimizeAnimation creates a minimize animation for the window at index i

func (*OS) CreateNewWindow added in v0.4.0

func (m *OS) CreateNewWindow() error

CreateNewWindow creates a new window with an optional name.

func (*OS) CreateNewWindowReturningID added in v0.5.0

func (m *OS) CreateNewWindowReturningID(name string) (windowID string, displayName string, err error)

CreateNewWindowReturningID creates a new window and returns its ID and display name. This is safe because Bubble Tea's Update runs on a single goroutine.

func (*OS) CreateNewWindowWithName added in v0.5.0

func (m *OS) CreateNewWindowWithName(name string) error

CreateNewWindowWithName creates a new window with a specific name.

func (*OS) CreateRestoreAnimation

func (m *OS) CreateRestoreAnimation(i int) *ui.Animation

CreateRestoreAnimation creates a restore animation for the window at index i

func (*OS) CreateSnapAnimation

func (m *OS) CreateSnapAnimation(i int, quarter SnapQuarter) *ui.Animation

CreateSnapAnimation creates a snap animation for the window at index i

func (*OS) CycleToNextVisibleWindow

func (m *OS) CycleToNextVisibleWindow()

CycleToNextVisibleWindow cycles focus to the next visible window in the current workspace.

func (*OS) CycleToPreviousVisibleWindow

func (m *OS) CycleToPreviousVisibleWindow()

CycleToPreviousVisibleWindow cycles focus to the previous visible window in the current workspace.

func (*OS) DeleteDaemonWindow added in v0.5.0

func (m *OS) DeleteDaemonWindow(i int) *OS

DeleteDaemonWindow removes a daemon-mode window and cleans up its PTY.

func (*OS) DeleteWindow

func (m *OS) DeleteWindow(i int) *OS

DeleteWindow removes the window at the specified index. In daemon mode, this also cleans up the daemon-managed PTY.

func (*OS) DisableAnimations added in v0.4.4

func (m *OS) DisableAnimations() error

DisableAnimations disables UI animations.

func (*OS) DisableTiling added in v0.4.0

func (m *OS) DisableTiling() error

DisableTiling disables tiling mode.

func (*OS) EnableAnimations added in v0.4.4

func (m *OS) EnableAnimations() error

EnableAnimations enables UI animations.

func (*OS) EnableTiling added in v0.4.0

func (m *OS) EnableTiling() error

EnableTiling enables tiling mode.

func (*OS) EnterTerminalMode added in v0.0.16

func (m *OS) EnterTerminalMode() tea.Cmd

EnterTerminalMode switches from window management to terminal mode. In terminal mode, raw input bypasses Bubbletea and goes directly to the PTY.

func (*OS) EqualizeSplits added in v0.4.4

func (m *OS) EqualizeSplits()

EqualizeSplits resets all split ratios to 0.5 (equal splits)

func (*OS) EqualizeSplitsExec added in v0.4.4

func (m *OS) EqualizeSplitsExec() error

EqualizeSplitsExec equalizes all split ratios.

func (*OS) ExecuteCommand added in v0.4.0

func (m *OS) ExecuteCommand(_ *tape.Command) error

ExecuteCommand executes a tape command.

func (*OS) ExitTerminalMode added in v0.0.16

func (m *OS) ExitTerminalMode() tea.Cmd

ExitTerminalMode switches from terminal to window management mode. In window management mode, Bubbletea handles input parsing.

func (*OS) FlushPTYBuffersAfterResize added in v0.3.3

func (m *OS) FlushPTYBuffersAfterResize()

FlushPTYBuffersAfterResize flushes buffered PTY content and forces content polling after a resize operation completes. This ensures that shell prompt redraws in response to SIGWINCH are properly processed and displayed.

func (*OS) FocusDirection added in v0.5.0

func (m *OS) FocusDirection(direction string) error

FocusDirection focuses a window in a direction (for BSP tiling).

func (*OS) FocusNextVisibleWindow

func (m *OS) FocusNextVisibleWindow()

FocusNextVisibleWindow focuses the next visible window in the current workspace.

func (*OS) FocusNextVisibleWindowInWorkspace

func (m *OS) FocusNextVisibleWindowInWorkspace()

FocusNextVisibleWindowInWorkspace focuses the next visible window in the workspace.

func (*OS) FocusWindow

func (m *OS) FocusWindow(i int) *OS

FocusWindow sets focus to the window at the specified index.

func (*OS) FocusWindowByID added in v0.4.0

func (m *OS) FocusWindowByID(windowID string) error

FocusWindowByID focuses a specific window by ID.

func (*OS) FocusWindowByName added in v0.5.0

func (m *OS) FocusWindowByName(name string) error

FocusWindowByName focuses a window by name. Errors if multiple windows match.

func (*OS) GetBSPBounds added in v0.4.4

func (m *OS) GetBSPBounds() layout.Rect

GetBSPBounds returns the bounds for BSP layout calculation

func (*OS) GetCPUGraph

func (m *OS) GetCPUGraph() string

GetCPUGraph returns a formatted string with CPU usage graph and percentage.

func (*OS) GetCanvas

func (m *OS) GetCanvas(render bool) *lipgloss.Canvas

func (*OS) GetDockbarContentYPosition added in v0.3.0

func (m *OS) GetDockbarContentYPosition() int

GetDockbarContentYPosition returns the Y position of the dockbar

func (*OS) GetFocusedWindow

func (m *OS) GetFocusedWindow() *terminal.Window

GetFocusedWindow returns the currently focused window.

func (*OS) GetFocusedWindowData added in v0.5.0

func (m *OS) GetFocusedWindowData() (map[string]interface{}, error)

GetFocusedWindowData returns data about the currently focused window.

func (*OS) GetFocusedWindowID added in v0.4.0

func (m *OS) GetFocusedWindowID() string

GetFocusedWindowID returns the ID of the focused window.

func (*OS) GetOrCreateBSPTree added in v0.4.4

func (m *OS) GetOrCreateBSPTree() *layout.BSPTree

GetOrCreateBSPTree returns the BSP tree for the current workspace, creating it if needed

func (*OS) GetRAMUsage added in v0.0.16

func (m *OS) GetRAMUsage() string

GetRAMUsage returns RAM usage as a formatted string. Cached to avoid expensive gopsutil calls on every render.

func (*OS) GetRenderHeight added in v0.5.0

func (m *OS) GetRenderHeight() int

GetRenderHeight returns the height to use for rendering. In multi-client mode, this is the minimum of the terminal height and the effective session height (min of all connected clients).

func (*OS) GetRenderWidth added in v0.5.0

func (m *OS) GetRenderWidth() int

GetRenderWidth returns the width to use for rendering. In multi-client mode, this is the minimum of the terminal width and the effective session width (min of all connected clients).

func (*OS) GetSessionInfoData added in v0.5.0

func (m *OS) GetSessionInfoData() map[string]interface{}

GetSessionInfoData returns data about the current session.

func (*OS) GetShowkeysDisplayText added in v0.4.0

func (m *OS) GetShowkeysDisplayText() string

GetShowkeysDisplayText generates the formatted text for the showkeys overlay. It returns a formatted string of recent key presses ready for display.

func (*OS) GetTimeYPosition added in v0.3.0

func (m *OS) GetTimeYPosition() int

GetTimeYPosition returns the Y position of the time display

func (*OS) GetTopMargin added in v0.3.0

func (m *OS) GetTopMargin() int

GetTopMargin returns the margin at the top (possibly reserved space for the dockbar)

func (*OS) GetUsableHeight

func (m *OS) GetUsableHeight() int

GetUsableHeight returns the usable height excluding the dock.

func (*OS) GetVisibleWindows

func (m *OS) GetVisibleWindows() []*terminal.Window

GetVisibleWindows returns all visible windows in the current workspace.

func (*OS) GetWindowData added in v0.5.0

func (m *OS) GetWindowData(identifier string) (map[string]interface{}, error)

GetWindowData returns data about a specific window by ID or name.

func (*OS) GetWindowListData added in v0.5.0

func (m *OS) GetWindowListData() map[string]interface{}

GetWindowListData returns data about all windows.

func (*OS) GetWorkspaceWindowCount

func (m *OS) GetWorkspaceWindowCount(workspace int) int

GetWorkspaceWindowCount returns the number of windows in a workspace.

func (*OS) HandleTapeManagerInput added in v0.4.0

func (m *OS) HandleTapeManagerInput(key string) bool

HandleTapeManagerInput handles keyboard input for the tape manager

func (*OS) HasActiveAnimations

func (m *OS) HasActiveAnimations() bool

HasActiveAnimations returns true if there are any active animations

func (*OS) HasMinimizedWindows

func (m *OS) HasMinimizedWindows() bool

HasMinimizedWindows returns true if there are any minimized windows.

func (*OS) Init

func (m *OS) Init() tea.Cmd

Init initializes the TUIOS application and returns initial commands to run. It starts the tick timer and listens for window exits. Note: Mouse tracking, bracketed paste, and focus reporting are now configured in the View() method as per bubbletea v2.0.0-beta.5 API changes.

func (*OS) InitTapeManager added in v0.4.0

func (m *OS) InitTapeManager()

InitTapeManager initializes the tape manager state

func (*OS) Log

func (m *OS) Log(level, format string, args ...any)

Log adds a new log message to the log buffer.

func (*OS) LogError

func (m *OS) LogError(format string, args ...any)

LogError logs an error message.

func (*OS) LogInfo

func (m *OS) LogInfo(format string, args ...any)

LogInfo logs an informational message.

func (*OS) LogWarn

func (m *OS) LogWarn(format string, args ...any)

LogWarn logs a warning message.

func (*OS) MarkAllDirty

func (m *OS) MarkAllDirty()

MarkAllDirty marks all windows as dirty for re-rendering.

func (*OS) MarkLayoutCustom added in v0.2.2

func (m *OS) MarkLayoutCustom()

MarkLayoutCustom marks the current workspace as having a custom layout

func (*OS) MarkTerminalsWithNewContent

func (m *OS) MarkTerminalsWithNewContent() bool

MarkTerminalsWithNewContent marks terminals that have new content as dirty.

func (*OS) MinimizeWindow

func (m *OS) MinimizeWindow(i int)

MinimizeWindow minimizes the window at the specified index.

func (*OS) MinimizeWindowByID added in v0.4.0

func (m *OS) MinimizeWindowByID(windowID string) error

MinimizeWindowByID minimizes a window.

func (*OS) MinimizeWindowByName added in v0.5.0

func (m *OS) MinimizeWindowByName(name string) error

MinimizeWindowByName minimizes a window by name. Errors if multiple windows match.

func (*OS) MoveAndFollowWorkspaceByID added in v0.4.0

func (m *OS) MoveAndFollowWorkspaceByID(windowID string, workspace int) error

MoveAndFollowWorkspaceByID moves a window to a workspace and switches to it.

func (*OS) MoveSelectionCursor

func (m *OS) MoveSelectionCursor(window *terminal.Window, dx, dy int, extending bool)

MoveSelectionCursor moves the selection cursor in the specified direction. Parameters:

  • window: The window to operate on
  • dx, dy: Direction to move cursor (-1, 0, 1)
  • extending: true if extending selection (Shift+Arrow), false if just moving cursor

func (*OS) MoveWindowToWorkspace

func (m *OS) MoveWindowToWorkspace(windowIndex int, workspace int)

MoveWindowToWorkspace moves a window to the specified workspace without changing focus.

func (*OS) MoveWindowToWorkspaceAndFollow

func (m *OS) MoveWindowToWorkspaceAndFollow(windowIndex int, workspace int)

MoveWindowToWorkspaceAndFollow moves a window to the specified workspace and switches to that workspace.

func (*OS) MoveWindowToWorkspaceByID added in v0.4.0

func (m *OS) MoveWindowToWorkspaceByID(windowID string, workspace int) error

MoveWindowToWorkspaceByID moves a window to a workspace.

func (*OS) NextWindow added in v0.4.0

func (m *OS) NextWindow() error

NextWindow focuses the next window.

func (*OS) Preselect added in v0.4.4

func (m *OS) Preselect(direction string) error

Preselect sets the preselection direction for the next window.

func (*OS) PrevWindow added in v0.4.0

func (m *OS) PrevWindow() error

PrevWindow focuses the previous window.

func (*OS) RefreshTapeFiles added in v0.4.0

func (m *OS) RefreshTapeFiles()

RefreshTapeFiles reloads the tape file list

func (*OS) RemoveWindowFromBSPTree added in v0.4.4

func (m *OS) RemoveWindowFromBSPTree(window *terminal.Window)

RemoveWindowFromBSPTree removes a window from the BSP tree and reapplies the layout. This should be called when a window is closed in tiling mode.

func (*OS) RenameWindowByID added in v0.4.0

func (m *OS) RenameWindowByID(windowID, name string) error

RenameWindowByID renames a window by its ID (sets CustomName).

func (*OS) RenameWindowByName added in v0.5.0

func (m *OS) RenameWindowByName(oldName, newName string) error

RenameWindowByName renames a window by its current name. Errors if multiple windows match.

func (*OS) RenderHelpMenu added in v0.0.23

func (m *OS) RenderHelpMenu(width, height int) string

RenderHelpMenu renders the new table-based help menu

func (*OS) RenderTapeManager added in v0.4.0

func (m *OS) RenderTapeManager(width, height int) string

RenderTapeManager renders the tape manager overlay

func (*OS) ResizeDaemonPTY added in v0.5.0

func (m *OS) ResizeDaemonPTY(window *terminal.Window, width, height int) error

ResizeDaemonPTY resizes a daemon-managed PTY.

func (*OS) ResizeFocusedWindowHeight added in v0.2.2

func (m *OS) ResizeFocusedWindowHeight(deltaPixels int)

ResizeFocusedWindowHeight resizes the focused window's height by moving the BOTTOM edge delta is in pixels (positive = grow, negative = shrink)

func (*OS) ResizeFocusedWindowHeightTop added in v0.2.2

func (m *OS) ResizeFocusedWindowHeightTop(deltaPixels int)

ResizeFocusedWindowHeightTop resizes the focused window's height by moving the TOP edge delta is in pixels (positive = shrink from top, negative = grow from top)

func (*OS) ResizeFocusedWindowWidth added in v0.2.2

func (m *OS) ResizeFocusedWindowWidth(deltaPixels int)

ResizeFocusedWindowWidth resizes the focused window's width by moving the RIGHT edge delta is in pixels (positive = grow right, negative = shrink left)

func (*OS) ResizeFocusedWindowWidthLeft added in v0.2.2

func (m *OS) ResizeFocusedWindowWidthLeft(deltaPixels int)

ResizeFocusedWindowWidthLeft resizes the focused window's width by moving the LEFT edge delta is in pixels (positive = shrink from left, negative = grow from left)

func (*OS) ResizeMasterWidth added in v0.2.2

func (m *OS) ResizeMasterWidth(delta float64)

ResizeMasterWidth adjusts the master window width ratio in tiling mode

func (*OS) RestoreFromState added in v0.5.0

func (m *OS) RestoreFromState(state *session.SessionState) error

RestoreFromState restores the OS state from a SessionState. This is called when attaching to an existing session. The caller must set up PTY output handlers after calling this.

func (*OS) RestoreMinimizedByIndex

func (m *OS) RestoreMinimizedByIndex(index int)

RestoreMinimizedByIndex restores a minimized window by its minimized index.

func (*OS) RestoreTerminalStates added in v0.5.0

func (m *OS) RestoreTerminalStates() error

RestoreTerminalStates fetches and restores terminal content (screen + scrollback) from the daemon for all windows. This should be called after RestoreFromState().

func (*OS) RestoreWindow

func (m *OS) RestoreWindow(i int)

RestoreWindow restores a minimized window at the specified index.

func (*OS) RestoreWindowByID added in v0.4.0

func (m *OS) RestoreWindowByID(windowID string) error

RestoreWindowByID restores a minimized window.

func (*OS) RestoreWindowByName added in v0.5.0

func (m *OS) RestoreWindowByName(name string) error

RestoreWindowByName restores a minimized window by name. Errors if multiple windows match.

func (*OS) RestoreWorkspaceLayout added in v0.2.2

func (m *OS) RestoreWorkspaceLayout(workspace int)

RestoreWorkspaceLayout restores saved layout when switching to a workspace

func (*OS) RetileAfterClose

func (m *OS) RetileAfterClose()

RetileAfterClose handles window close in tiling mode

func (*OS) RotateFocusedSplit added in v0.4.4

func (m *OS) RotateFocusedSplit()

RotateFocusedSplit toggles the split direction at the focused window's parent

func (*OS) RotateSplit added in v0.4.4

func (m *OS) RotateSplit() error

RotateSplit rotates the split direction at the focused window.

func (*OS) SaveCurrentLayout added in v0.2.2

func (m *OS) SaveCurrentLayout()

SaveCurrentLayout saves the current window layout for the active workspace

func (*OS) ScaleWindowsToTerminal added in v0.5.0

func (m *OS) ScaleWindowsToTerminal(oldWidth, oldHeight, newWidth, newHeight int)

ScaleWindowsToTerminal proportionally scales all windows when terminal size changes. This is called when restoring from daemon state to ensure windows fit the new terminal size. oldWidth/oldHeight are the terminal dimensions when state was saved. newWidth/newHeight are the current terminal dimensions.

func (*OS) SendInputToDaemon added in v0.5.0

func (m *OS) SendInputToDaemon(window *terminal.Window, data []byte) error

SendInputToDaemon sends input to a daemon-managed PTY.

func (*OS) SendToWindow added in v0.4.0

func (m *OS) SendToWindow(windowID string, data []byte) error

SendToWindow sends bytes to a window's PTY. This works in both local and daemon mode.

func (*OS) SetBorderStyle added in v0.5.0

func (m *OS) SetBorderStyle(style string) error

SetBorderStyle changes the window border style.

func (*OS) SetConfig added in v0.5.0

func (m *OS) SetConfig(path, value string) error

SetConfig sets a configuration option at runtime. Supported paths: appearance.dockbar_position, appearance.border_style, appearance.animations_enabled, appearance.hide_window_buttons

func (*OS) SetDockbarPosition added in v0.5.0

func (m *OS) SetDockbarPosition(position string) error

SetDockbarPosition changes the dockbar position.

func (*OS) SetMode added in v0.4.0

func (m *OS) SetMode(mode string) error

SetMode sets the interaction mode.

func (*OS) SetPreselection added in v0.4.4

func (m *OS) SetPreselection(dir layout.PreselectionDir)

SetPreselection sets the preselection direction for the next window insertion

func (*OS) SetTheme added in v0.5.0

func (m *OS) SetTheme(themeName string) error

SetTheme changes the active theme.

func (*OS) SetupPTYOutputHandlers added in v0.5.0

func (m *OS) SetupPTYOutputHandlers() error

SetupPTYOutputHandlers sets up PTY output handlers for all daemon-mode windows. This should be called after RestoreFromState() when attaching to a session.

func (*OS) ShowNotification

func (m *OS) ShowNotification(message, notifType string, duration time.Duration)

ShowNotification displays a temporary notification with animation.

func (*OS) ShowNotificationCmd added in v0.5.0

func (m *OS) ShowNotificationCmd(message, notificationType string) error

ShowNotificationCmd displays a notification in the UI.

func (*OS) Snap

func (m *OS) Snap(i int, quarter SnapQuarter) *OS

Snap snaps the window at index i to the specified position.

func (*OS) SnapByDirection added in v0.4.0

func (m *OS) SnapByDirection(direction string) error

SnapByDirection snaps a window to a direction.

func (*OS) SplitFocusedHorizontal added in v0.4.4

func (m *OS) SplitFocusedHorizontal()

SplitFocusedHorizontal splits the focused window horizontally (top/bottom) and creates a new terminal

func (*OS) SplitFocusedVertical added in v0.4.4

func (m *OS) SplitFocusedVertical()

SplitFocusedVertical splits the focused window vertically (left/right) and creates a new terminal

func (*OS) SplitHorizontal added in v0.4.4

func (m *OS) SplitHorizontal() error

SplitHorizontal splits the focused window horizontally.

func (*OS) SplitVertical added in v0.4.4

func (m *OS) SplitVertical() error

SplitVertical splits the focused window vertically.

func (*OS) SwapWindowDown

func (m *OS) SwapWindowDown()

SwapWindowDown swaps the focused window with the window below it

func (*OS) SwapWindowLeft

func (m *OS) SwapWindowLeft()

SwapWindowLeft swaps the focused window with the window to its left

func (*OS) SwapWindowRight

func (m *OS) SwapWindowRight()

SwapWindowRight swaps the focused window with the window to its right

func (*OS) SwapWindowUp

func (m *OS) SwapWindowUp()

SwapWindowUp swaps the focused window with the window above it

func (*OS) SwapWindows

func (m *OS) SwapWindows(index1, index2 int)

SwapWindows swaps the positions of two windows with animation

func (*OS) SwapWindowsInBSPTree added in v0.4.4

func (m *OS) SwapWindowsInBSPTree(window1, window2 *terminal.Window)

SwapWindowsInBSPTree swaps two windows in the BSP tree

func (*OS) SwapWindowsInstant

func (m *OS) SwapWindowsInstant(index1, index2 int)

SwapWindowsInstant swaps the positions of two windows instantly without animation

func (*OS) SwapWindowsWithOriginal

func (m *OS) SwapWindowsWithOriginal(draggedIndex, targetIndex int, origX, origY, origWidth, origHeight int)

SwapWindowsWithOriginal swaps windows where the dragged window's original position is provided

func (*OS) SwitchToWorkspace

func (m *OS) SwitchToWorkspace(workspace int)

SwitchToWorkspace switches to the specified workspace.

func (*OS) SwitchWorkspace added in v0.4.0

func (m *OS) SwitchWorkspace(workspace int) error

SwitchWorkspace switches to a workspace.

func (*OS) SyncBSPTreeFromGeometry added in v0.4.4

func (m *OS) SyncBSPTreeFromGeometry()

SyncBSPTreeFromGeometry updates the BSP tree's split ratios to match current window positions. This should be called after mouse resize operations complete.

func (*OS) SyncStateToDaemon added in v0.5.0

func (m *OS) SyncStateToDaemon()

SyncStateToDaemon sends the current state to the daemon. This should be called after state-changing operations.

func (*OS) TapeManagerCancelDelete added in v0.4.0

func (m *OS) TapeManagerCancelDelete()

TapeManagerCancelDelete cancels delete confirmation

func (*OS) TapeManagerConfirmDeleteAction added in v0.4.0

func (m *OS) TapeManagerConfirmDeleteAction()

TapeManagerConfirmDeleteAction confirms and deletes the selected tape

func (*OS) TapeManagerConfirmRecording added in v0.4.0

func (m *OS) TapeManagerConfirmRecording()

TapeManagerConfirmRecording confirms the name and starts recording

func (*OS) TapeManagerDelete added in v0.4.0

func (m *OS) TapeManagerDelete()

TapeManagerDelete initiates delete confirmation

func (*OS) TapeManagerPlaySelected added in v0.4.0

func (m *OS) TapeManagerPlaySelected()

TapeManagerPlaySelected plays the selected tape file

func (*OS) TapeManagerSelectNext added in v0.4.0

func (m *OS) TapeManagerSelectNext()

TapeManagerSelectNext moves selection down

func (*OS) TapeManagerSelectPrev added in v0.4.0

func (m *OS) TapeManagerSelectPrev()

TapeManagerSelectPrev moves selection up

func (*OS) TapeManagerStartRecording added in v0.4.0

func (m *OS) TapeManagerStartRecording()

TapeManagerStartRecording starts recording a new tape

func (*OS) TapeManagerStopRecording added in v0.4.0

func (m *OS) TapeManagerStopRecording()

TapeManagerStopRecording stops recording and saves the tape

func (*OS) TileAllWindows

func (m *OS) TileAllWindows()

TileAllWindows arranges all visible windows in a tiling layout

func (*OS) TileNewWindow

func (m *OS) TileNewWindow()

TileNewWindow arranges the new window in the tiling layout

func (*OS) TileRemainingWindows

func (m *OS) TileRemainingWindows(excludeIndex int)

TileRemainingWindows tiles all windows except the one being minimized

func (*OS) TileVisibleWorkspaceWindows

func (m *OS) TileVisibleWorkspaceWindows()

TileVisibleWorkspaceWindows tiles all visible windows in the current workspace with animations.

func (*OS) ToggleAnimations added in v0.4.4

func (m *OS) ToggleAnimations() error

ToggleAnimations toggles UI animations.

func (*OS) ToggleAutoTiling

func (m *OS) ToggleAutoTiling()

ToggleAutoTiling toggles automatic tiling mode

func (*OS) ToggleTapeManager added in v0.4.0

func (m *OS) ToggleTapeManager()

ToggleTapeManager toggles the tape manager overlay

func (*OS) ToggleTiling added in v0.4.0

func (m *OS) ToggleTiling() error

ToggleTiling toggles tiling mode.

func (*OS) TriggerAltScreenRedraws added in v0.5.0

func (m *OS) TriggerAltScreenRedraws()

TriggerAltScreenRedraws forces alt screen apps to redraw. This must be called AFTER SetupPTYOutputHandlers so that DaemonResizeFunc is available. For alt screen apps (vim, htop, etc.), this invalidates caches and triggers re-render.

func (*OS) Update

func (m *OS) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles all incoming messages and updates the application state. It processes keyboard, mouse, and timer events, managing windows and UI updates.

func (*OS) UpdateAllWindowThemes added in v0.2.0

func (m *OS) UpdateAllWindowThemes()

UpdateAllWindowThemes updates the terminal colors for all windows when the theme changes

func (*OS) UpdateAnimations

func (m *OS) UpdateAnimations()

UpdateAnimations updates all active animations and applies their effects.

func (*OS) UpdateCPUHistory

func (m *OS) UpdateCPUHistory()

UpdateCPUHistory updates the CPU usage history. This is a placeholder implementation that maintains the existing CPU history structure. In the future, this should be refactored to use the system.CPUMonitor.

func (*OS) UpdateRAMUsage added in v0.0.16

func (m *OS) UpdateRAMUsage()

UpdateRAMUsage updates the cached RAM usage.

func (*OS) View

func (m *OS) View() tea.View

type RemoteCommandMsg added in v0.5.0

type RemoteCommandMsg struct {
	CommandType string   // "tape_command", "send_keys", "set_config", "tape_script"
	TapeCommand string   // For tape commands (single command)
	TapeArgs    []string // Arguments for tape command
	TapeScript  string   // For tape_script (full script content)
	Keys        string   // For send_keys
	Literal     bool     // For send_keys (send to PTY)
	Raw         bool     // For send_keys (no splitting on space/comma)
	ConfigPath  string   // For set_config
	ConfigValue string   // For set_config
	RequestID   string   // For response tracking
}

RemoteCommandMsg represents a remote command from the CLI. This allows remote commands to be processed through the normal message handling flow.

type RemoteKeyMsg added in v0.5.0

type RemoteKeyMsg struct {
	Key           tea.KeyPressMsg   // The key to process
	RemainingKeys []tea.KeyPressMsg // Keys still to be processed
	RequestID     string            // For response tracking on last key
}

RemoteKeyMsg represents a single key to be processed from a remote send-keys command. Keys are sent one at a time to allow proper sequential processing.

type RemoteKeysDoneMsg added in v0.5.0

type RemoteKeysDoneMsg struct {
	RequestID string
}

RemoteKeysDoneMsg signals that all remote keys have been processed. This triggers a final cleanup/retile.

type RemoteTapeCommandMsg added in v0.5.0

type RemoteTapeCommandMsg struct {
	Command           tape.Command   // The command to execute
	RemainingCommands []tape.Command // Commands still to be processed
	RequestID         string         // For response tracking on last command
	CommandIndex      int            // 0-based index of current command (for progress display)
	TotalCommands     int            // Total number of commands in script
}

RemoteTapeCommandMsg represents a single tape command from a remote script. Commands are processed one at a time to allow proper sequential execution.

type RemoteTapeScriptDoneMsg added in v0.5.0

type RemoteTapeScriptDoneMsg struct {
	RequestID string
}

RemoteTapeScriptDoneMsg signals that all tape commands have been processed.

type ResizeCorner

type ResizeCorner int

ResizeCorner identifies which corner is being used for window resizing.

const (
	// TopLeft represents the top-left corner for resizing.
	TopLeft ResizeCorner = iota
	// TopRight represents the top-right corner for resizing.
	TopRight
	// BottomLeft represents the bottom-left corner for resizing.
	BottomLeft
	// BottomRight represents the bottom-right corner for resizing.
	BottomRight
)

type ScriptCommandMsg added in v0.4.0

type ScriptCommandMsg struct {
	Command *tape.Command
}

ScriptCommandMsg represents a command from a tape script to be executed. This allows tape commands to be processed through the normal message handling flow.

type SessionResizeMsg added in v0.5.0

type SessionResizeMsg struct {
	Width       int
	Height      int
	ClientCount int
}

SessionResizeMsg is sent when the effective session size changes (min of all clients).

type SnapQuarter

type SnapQuarter int

SnapQuarter represents window snapping positions.

const (
	// NoSnap indicates the window is not snapped.
	NoSnap SnapQuarter = iota
	// SnapLeft snaps window to left half of screen.
	SnapLeft
	// SnapRight snaps window to right half of screen.
	SnapRight
	// SnapTopLeft snaps window to top-left quarter.
	SnapTopLeft
	// SnapTopRight snaps window to top-right quarter.
	SnapTopRight
	// SnapBottomLeft snaps window to bottom-left quarter.
	SnapBottomLeft
	// SnapBottomRight snaps window to bottom-right quarter.
	SnapBottomRight
	// SnapFullScreen maximizes window to full screen.
	SnapFullScreen
	// Unsnap restores window to its previous position.
	Unsnap
)

type StateSyncMsg added in v0.5.0

type StateSyncMsg struct {
	State       *session.SessionState
	TriggerType string
	SourceID    string
}

StateSyncMsg is sent when another client updates session state.

type StyleCache added in v0.0.14

type StyleCache struct {
	// contains filtered or unexported fields
}

StyleCache provides thread-safe caching of lipgloss styles with automatic eviction. It significantly reduces allocation pressure by reusing style objects for identical cell attributes.

func GetGlobalStyleCache added in v0.0.14

func GetGlobalStyleCache() *StyleCache

GetGlobalStyleCache returns the global style cache instance. This is used by the rendering functions to cache styles across all windows.

func NewStyleCache added in v0.0.14

func NewStyleCache(maxSize int) *StyleCache

NewStyleCache creates a new style cache with the specified maximum size. Recommended size: 256-1024 entries (covers most terminal use cases).

func (*StyleCache) Clear added in v0.0.14

func (sc *StyleCache) Clear()

Clear removes all entries from the cache.

func (*StyleCache) Get added in v0.0.14

func (sc *StyleCache) Get(cell *uv.Cell, isCursor bool, optimized bool) lipgloss.Style

Get retrieves a cached style or builds and caches it if not found. This is the main entry point for cached style access.

func (*StyleCache) GetStats added in v0.0.14

func (sc *StyleCache) GetStats() StyleCacheStats

GetStats returns current cache statistics.

func (*StyleCache) ResetStats added in v0.0.14

func (sc *StyleCache) ResetStats()

ResetStats resets all statistics counters to zero.

type StyleCacheStats added in v0.0.14

type StyleCacheStats struct {
	Hits     uint64  // Number of cache hits
	Misses   uint64  // Number of cache misses
	Evicts   uint64  // Number of evicted entries
	Size     int     // Current cache size
	HitRate  float64 // Hit rate percentage (0-100)
	Capacity int     // Maximum cache capacity
}

StyleCacheStats holds cache statistics for monitoring and debugging.

type TapeFile added in v0.4.0

type TapeFile struct {
	Name     string    // Display name (without extension)
	Path     string    // Full path to the file
	Size     int64     // File size in bytes
	Modified time.Time // Last modification time
}

TapeFile represents a tape file with metadata

func LoadTapeFiles added in v0.4.0

func LoadTapeFiles() ([]TapeFile, error)

LoadTapeFiles loads all tape files from the XDG data directory

type TapeManagerMode added in v0.4.0

type TapeManagerMode int

TapeManagerMode represents the current mode of the tape manager

const (
	// TapeManagerList shows the list of tape files
	TapeManagerList TapeManagerMode = iota
	// TapeManagerRecording is recording a new tape
	TapeManagerRecording
	// TapeManagerPlaying is playing back a tape
	TapeManagerPlaying
	// TapeManagerConfirmDelete asks for deletion confirmation
	TapeManagerConfirmDelete
	// TapeManagerNaming is entering a name for a new tape
	TapeManagerNaming
)

type TapeManagerState added in v0.4.0

type TapeManagerState struct {
	Mode           TapeManagerMode
	Files          []TapeFile
	SelectedIndex  int
	ScrollOffset   int
	NameBuffer     string // Buffer for naming new tapes
	DeleteConfirm  bool   // Whether delete is confirmed
	ErrorMessage   string // Error message to display
	SuccessMessage string // Success message to display
	MessageTime    time.Time
}

TapeManagerState holds the state for the tape manager UI

type TickerMsg

type TickerMsg time.Time

TickerMsg represents a periodic tick event for updating the UI. This is exported so it can be used by the input package.

type TriggerAltScreenRedrawMsg added in v0.5.0

type TriggerAltScreenRedrawMsg struct{}

TriggerAltScreenRedrawMsg triggers alt screen apps to redraw.

type WindowExitMsg

type WindowExitMsg struct {
	WindowID string
}

WindowExitMsg signals that a terminal window process has exited. This is exported so it can be used by the input package.

type WindowLayout added in v0.2.2

type WindowLayout struct {
	WindowID string
	X        int
	Y        int
	Width    int
	Height   int
}

WindowLayout stores a window's position and size for workspace persistence

Jump to

Keyboard shortcuts

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