Documentation
¶
Overview ¶
focus_state_machine.go - Centralized focus state management with queue-based serialization
workspace_css.go - CSS generation and styling for workspace panes
workspace_geometry_validator.go - Simplified geometry validation for split operations
workspace_hover.go - Hover handler management for workspace panes
workspace_manager.go - Core workspace management and coordination
workspace_navigation.go - Navigation and focus management for workspace panes
workspace_operations.go - Workspace operation methods with validation and safety
workspace_pane_mode.go - Backend-driven pane mode implementation
workspace_pane_ops.go - Pane creation, splitting, closing and tree operations
workspace_popup.go - Popup window handling and related pane management
workspace_stack_lifecycle.go - Stack pane lifecycle coordination without SafeWidget wrappers
workspace_tree_rebalancer.go - Simplified no-op tree rebalancer placeholder.
The original TreeRebalancer relied on SafeWidget abstractions. Until a pointer-based implementation is restored, we keep a lightweight stub so the rest of the workspace code can continue to depend on the API without carrying dead logic.
workspace_tree_validator.go - Simplified validator stub to keep API surface.
workspace_types.go - Type definitions and constants for workspace management
workspace_utils.go - Utility functions and helpers for workspace management
Index ¶
- Constants
- Variables
- func Run(assets embed.FS, version, commit, buildDate string)
- type BrowserApp
- type BrowserAppInterface
- type BrowserPane
- func (p *BrowserPane) Cleanup()
- func (p *BrowserPane) CleanupFromWorkspace(wm interface{})
- func (p *BrowserPane) ClipboardController() *control.ClipboardController
- func (p *BrowserPane) HasGUI() bool
- func (p *BrowserPane) HasGUIComponent(component string) bool
- func (p *BrowserPane) ID() string
- func (p *BrowserPane) MessageHandler() *messaging.Handler
- func (p *BrowserPane) NavigationController() *control.NavigationController
- func (p *BrowserPane) SetGUIComponent(component string, loaded bool)
- func (p *BrowserPane) SetHasGUI(has bool)
- func (p *BrowserPane) SetID(id string)
- func (p *BrowserPane) ShortcutHandler() *ShortcutHandler
- func (p *BrowserPane) UpdateLastFocus()
- func (p *BrowserPane) WebView() *webkit.WebView
- func (p *BrowserPane) ZoomController() *control.ZoomController
- type ClipboardControllerInterface
- type DebugLevel
- type FocusDebugInfo
- type FocusMetrics
- type FocusPriorityQueue
- type FocusRequest
- type FocusSource
- type FocusState
- type FocusStateMachine
- func (fsm *FocusStateMachine) AddValidator(validator FocusValidator)
- func (fsm *FocusStateMachine) ClearHistory()
- func (fsm *FocusStateMachine) ConfigureDebug(focusDebug, _ bool, metricsEnabled bool)
- func (fsm *FocusStateMachine) DumpState() FocusDebugInfo
- func (fsm *FocusStateMachine) ForceValidation() []string
- func (fsm *FocusStateMachine) GetActivePane() *paneNode
- func (fsm *FocusStateMachine) GetCurrentState() FocusState
- func (fsm *FocusStateMachine) GetMetrics() FocusMetrics
- func (fsm *FocusStateMachine) GetQueueStatus() map[string]interface{}
- func (fsm *FocusStateMachine) Initialize() error
- func (fsm *FocusStateMachine) InvalidateActivePane(node *paneNode)
- func (fsm *FocusStateMachine) RequestFocus(node *paneNode, source FocusSource) error
- func (fsm *FocusStateMachine) Shutdown()
- type FocusTransition
- type FocusValidator
- type GeometryValidator
- func (gv *GeometryValidator) GetPaneGeometry(node *paneNode) PaneGeometry
- func (gv *GeometryValidator) SetDebugMode(debug bool)
- func (gv *GeometryValidator) ValidateHorizontalSplit(node *paneNode) ValidationResult
- func (gv *GeometryValidator) ValidateSplit(node *paneNode, direction string) ValidationResult
- func (gv *GeometryValidator) ValidateStackOperation(node *paneNode) ValidationResult
- func (gv *GeometryValidator) ValidateVerticalSplit(node *paneNode) ValidationResult
- type MessageHandlerInterface
- type NavigationControllerInterface
- type PaneGeometry
- type PaneInterface
- type RebalanceOperation
- type RebalanceType
- type RequestDeduplicator
- type RingBuffer
- type ShortcutHandler
- type ShortcutHandlerInterface
- type StackLifecycleManager
- type StackedPaneManager
- func (spm *StackedPaneManager) CloseStackedPane(node *paneNode) error
- func (spm *StackedPaneManager) NavigateStack(direction string) bool
- func (spm *StackedPaneManager) StackPane(target *paneNode) (*paneNode, error)
- func (spm *StackedPaneManager) UpdateStackVisibility(stackNode *paneNode)
- func (spm *StackedPaneManager) UpdateTitleBar(webView *webkit.WebView, title string)
- type TreeMetrics
- type TreeRebalancer
- func (tr *TreeRebalancer) CalculateTreeMetrics(_ *paneNode) TreeMetrics
- func (tr *TreeRebalancer) Disable()
- func (tr *TreeRebalancer) Enable()
- func (tr *TreeRebalancer) GetRebalancingStats() map[string]interface{}
- func (tr *TreeRebalancer) RebalanceAfterClose(_ *paneNode, _ *paneNode) error
- func (tr *TreeRebalancer) SetMaxImbalance(_ int)
- type TreeSnapshot
- type TreeValidator
- type ValidationResult
- type WebViewInterface
- type WindowInterface
- type WindowShortcutHandler
- type WindowShortcutHandlerInterface
- type WorkspaceDiagnostics
- type WorkspaceManager
- func (wm *WorkspaceManager) ClosePane(node *paneNode) error
- func (wm *WorkspaceManager) DiagnosticsSnapshots() []TreeSnapshot
- func (wm *WorkspaceManager) DisableEnhancedMode()
- func (wm *WorkspaceManager) DispatchPaneFocusEvent(node *paneNode, active bool)
- func (wm *WorkspaceManager) EnableEnhancedMode()
- func (wm *WorkspaceManager) EnterPaneMode()
- func (wm *WorkspaceManager) ExitPaneMode(reason string)
- func (wm *WorkspaceManager) FocusNeighbor(direction string) bool
- func (wm *WorkspaceManager) GetActiveNode() *paneNode
- func (wm *WorkspaceManager) GetEnhancedStats() map[string]interface{}
- func (wm *WorkspaceManager) GetNodeForWebView(webView *webkit.WebView) *paneNode
- func (wm *WorkspaceManager) HandlePaneAction(action string)
- func (wm *WorkspaceManager) OnWorkspaceMessage(source *webkit.WebView, msg messaging.Message)
- func (wm *WorkspaceManager) RegisterNavigationHandler(webView *webkit.WebView)
- func (wm *WorkspaceManager) RunOnUI(fn func())
- func (wm *WorkspaceManager) SetActivePane(node *paneNode, source FocusSource)
- func (wm *WorkspaceManager) SetEnhancedDebugMode(debug bool)
- func (wm *WorkspaceManager) SetPaneCloseDebug(enabled bool)
- func (wm *WorkspaceManager) ShutdownEnhancedComponents()
- func (wm *WorkspaceManager) SplitPane(target *paneNode, direction string) (*paneNode, error)
- func (wm *WorkspaceManager) StackPane(target *paneNode) (*paneNode, error)
- func (wm *WorkspaceManager) UpdateTitleBar(webView *webkit.WebView, title string)
- func (wm *WorkspaceManager) ValidateWorkspaceIntegrity() error
- type ZoomControllerInterface
Constants ¶
const ( DirectionLeft = "left" DirectionRight = "right" DirectionUp = "up" DirectionDown = "down" )
Direction constants for pane navigation and splitting
const ( PriorityLow = 10 PriorityNormal = 50 PriorityHigh = 90 PriorityUrgent = 100 )
Priority levels for focus requests
const (
NewTabTitle = "New Tab"
)
UI string constants
const (
ThemeDefault = "default"
)
Theme constants
Variables ¶
var ( ErrFocusQueueFull = fmt.Errorf("focus request queue is full") ErrInvalidTarget = fmt.Errorf("invalid focus target") ErrInvalidStackOperation = fmt.Errorf("invalid stack operation") ErrStateMachineShutdown = fmt.Errorf("focus state machine is shutting down") )
Predefined errors
var (
ErrFailedToInitialize = fmt.Errorf("failed to initialize window shortcuts")
)
Error definitions
Functions ¶
Types ¶
type BrowserApp ¶
type BrowserApp struct {
// contains filtered or unexported fields
}
BrowserApp represents the main browser application
func (*BrowserApp) Initialize ¶
func (app *BrowserApp) Initialize() error
Initialize sets up all browser components
type BrowserAppInterface ¶ added in v0.9.0
type BrowserAppInterface interface {
GetPanes() []*BrowserPane
SetActivePane(pane *BrowserPane)
GetActivePane() *BrowserPane
AppendPane(pane *BrowserPane)
RemovePane(pane *BrowserPane)
BuildWebkitConfig() (*webkit.Config, error)
CreatePaneForView(view *webkit.WebView) (*BrowserPane, error)
}
BrowserAppInterface abstracts BrowserApp for testing
type BrowserPane ¶ added in v0.9.0
type BrowserPane struct {
// contains filtered or unexported fields
}
BrowserPane bundles the per-pane WebView and its controllers.
func (*BrowserPane) Cleanup ¶ added in v0.9.0
func (p *BrowserPane) Cleanup()
Cleanup releases pane resources
func (*BrowserPane) CleanupFromWorkspace ¶ added in v0.11.0
func (p *BrowserPane) CleanupFromWorkspace(wm interface{})
CleanupFromWorkspace removes this pane from workspace tracking maps and app.panes slice This should be called before Cleanup() to ensure proper workspace state management
func (*BrowserPane) ClipboardController ¶ added in v0.9.0
func (p *BrowserPane) ClipboardController() *control.ClipboardController
func (*BrowserPane) HasGUI ¶ added in v0.9.0
func (p *BrowserPane) HasGUI() bool
HasGUI returns whether GUI components are injected
func (*BrowserPane) HasGUIComponent ¶ added in v0.9.0
func (p *BrowserPane) HasGUIComponent(component string) bool
HasGUIComponent checks if a specific GUI component is loaded
func (*BrowserPane) ID ¶ added in v0.9.0
func (p *BrowserPane) ID() string
ID returns the unique pane identifier
func (*BrowserPane) MessageHandler ¶ added in v0.9.0
func (p *BrowserPane) MessageHandler() *messaging.Handler
func (*BrowserPane) NavigationController ¶ added in v0.9.0
func (p *BrowserPane) NavigationController() *control.NavigationController
func (*BrowserPane) SetGUIComponent ¶ added in v0.9.0
func (p *BrowserPane) SetGUIComponent(component string, loaded bool)
SetGUIComponent marks a GUI component as loaded
func (*BrowserPane) SetHasGUI ¶ added in v0.9.0
func (p *BrowserPane) SetHasGUI(has bool)
SetHasGUI marks GUI components as injected
func (*BrowserPane) SetID ¶ added in v0.9.0
func (p *BrowserPane) SetID(id string)
SetID sets the pane identifier
func (*BrowserPane) ShortcutHandler ¶ added in v0.9.0
func (p *BrowserPane) ShortcutHandler() *ShortcutHandler
func (*BrowserPane) UpdateLastFocus ¶ added in v0.9.0
func (p *BrowserPane) UpdateLastFocus()
UpdateLastFocus updates the last focus time
func (*BrowserPane) WebView ¶ added in v0.9.0
func (p *BrowserPane) WebView() *webkit.WebView
func (*BrowserPane) ZoomController ¶ added in v0.9.0
func (p *BrowserPane) ZoomController() *control.ZoomController
type ClipboardControllerInterface ¶ added in v0.9.0
type ClipboardControllerInterface interface {
}
ClipboardControllerInterface abstracts clipboard operations
type DebugLevel ¶ added in v0.11.0
type DebugLevel int
DebugLevel controls validation and safety checks
const ( // DebugOff disables all validation (production mode) DebugOff DebugLevel = iota // DebugBasic enables basic validation only (development default) DebugBasic // DebugFull enables all validation and detailed logging (testing) DebugFull )
type FocusDebugInfo ¶ added in v0.11.0
type FocusDebugInfo struct {
CurrentState FocusState `json:"current_state"`
ActivePane *paneNode `json:"active_pane,omitempty"`
QueueLength int `json:"queue_length"`
PriorityQueueSize int `json:"priority_queue_size"`
History []FocusTransition `json:"history"`
CSSState map[string]interface{} `json:"css_state"`
ValidationErrors []string `json:"validation_errors"`
Metrics FocusMetrics `json:"metrics"`
RecentRequests []string `json:"recent_requests"`
}
FocusDebugInfo contains comprehensive debug information about the focus system
type FocusMetrics ¶ added in v0.11.0
type FocusMetrics struct {
TotalRequests uint64 `json:"total_requests"`
SuccessfulRequests uint64 `json:"successful_requests"`
FailedRequests uint64 `json:"failed_requests"`
CoalescedRequests uint64 `json:"coalesced_requests"`
DuplicateRequests uint64 `json:"duplicate_requests"`
AverageProcessTime time.Duration `json:"average_process_time"`
MaxQueueDepth int `json:"max_queue_depth"`
ReconciliationCount uint64 `json:"reconciliation_count"`
}
FocusMetrics tracks performance metrics for the focus system
type FocusPriorityQueue ¶ added in v0.11.0
type FocusPriorityQueue []*FocusRequest
FocusPriorityQueue implements a priority queue for focus requests
func (FocusPriorityQueue) Len ¶ added in v0.11.0
func (pq FocusPriorityQueue) Len() int
func (FocusPriorityQueue) Less ¶ added in v0.11.0
func (pq FocusPriorityQueue) Less(i, j int) bool
func (*FocusPriorityQueue) Pop ¶ added in v0.11.0
func (pq *FocusPriorityQueue) Pop() interface{}
func (*FocusPriorityQueue) Push ¶ added in v0.11.0
func (pq *FocusPriorityQueue) Push(x interface{})
func (FocusPriorityQueue) Swap ¶ added in v0.11.0
func (pq FocusPriorityQueue) Swap(i, j int)
type FocusRequest ¶ added in v0.11.0
type FocusRequest struct {
ID string // Unique request identifier
TargetNode *paneNode // Target pane to focus
Source FocusSource // Where the request originated
Priority int // Request priority (higher = more urgent)
Timestamp time.Time // When the request was created
Context map[string]interface{} // Additional metadata
}
FocusRequest represents a request to change focus to a specific pane
type FocusSource ¶ added in v0.11.0
type FocusSource string
FocusSource identifies where a focus request originated
const ( SourceKeyboard FocusSource = "keyboard" // User keyboard navigation SourceMouse FocusSource = "mouse" // Mouse hover/click SourceProgrammatic FocusSource = "programmatic" // API call SourceSystem FocusSource = "system" // System initialization SourceSplit FocusSource = "split" // Pane split operation SourceClose FocusSource = "close" // Pane close operation )
type FocusState ¶ added in v0.11.0
type FocusState string
FocusState represents the current state of the focus management system
const ( StateInitializing FocusState = "initializing" // System startup, determining initial focus StateIdle FocusState = "idle" // No focus transition in progress, system stable StateTransitioning FocusState = "transitioning" // Processing a focus change request StateFocused FocusState = "focused" // Focus successfully applied, awaiting next request StateReconciling FocusState = "reconciling" // Fixing inconsistencies detected in CSS/focus state )
type FocusStateMachine ¶ added in v0.11.0
type FocusStateMachine struct {
// contains filtered or unexported fields
}
FocusStateMachine manages all focus operations through a centralized state machine
func NewFocusStateMachine ¶ added in v0.11.0
func NewFocusStateMachine(wm *WorkspaceManager) *FocusStateMachine
NewFocusStateMachine creates a new focus state machine
func (*FocusStateMachine) AddValidator ¶ added in v0.11.0
func (fsm *FocusStateMachine) AddValidator(validator FocusValidator)
AddValidator adds a focus request validator
func (*FocusStateMachine) ClearHistory ¶ added in v0.11.0
func (fsm *FocusStateMachine) ClearHistory()
ClearHistory clears the focus transition history (useful for debugging sessions)
func (*FocusStateMachine) ConfigureDebug ¶ added in v0.11.0
func (fsm *FocusStateMachine) ConfigureDebug(focusDebug, _ bool, metricsEnabled bool)
ConfigureDebug configures debug settings for the focus state machine
func (*FocusStateMachine) DumpState ¶ added in v0.11.0
func (fsm *FocusStateMachine) DumpState() FocusDebugInfo
DumpState returns comprehensive debug information about the focus system
func (*FocusStateMachine) ForceValidation ¶ added in v0.11.0
func (fsm *FocusStateMachine) ForceValidation() []string
ForceValidation manually triggers CSS consistency check and validation
func (*FocusStateMachine) GetActivePane ¶ added in v0.11.0
func (fsm *FocusStateMachine) GetActivePane() *paneNode
GetActivePane returns the currently active pane
func (*FocusStateMachine) GetCurrentState ¶ added in v0.11.0
func (fsm *FocusStateMachine) GetCurrentState() FocusState
GetCurrentState returns the current state of the focus system
func (*FocusStateMachine) GetMetrics ¶ added in v0.11.0
func (fsm *FocusStateMachine) GetMetrics() FocusMetrics
GetMetrics returns performance metrics for the focus system
func (*FocusStateMachine) GetQueueStatus ¶ added in v0.11.0
func (fsm *FocusStateMachine) GetQueueStatus() map[string]interface{}
GetQueueStatus returns detailed information about pending requests
func (*FocusStateMachine) Initialize ¶ added in v0.11.0
func (fsm *FocusStateMachine) Initialize() error
Initialize sets up the focus state machine and determines initial focus
func (*FocusStateMachine) InvalidateActivePane ¶ added in v0.11.0
func (fsm *FocusStateMachine) InvalidateActivePane(node *paneNode)
InvalidateActivePane clears the active pane if it matches the provided node. This is used when panes are destroyed so the focus state machine doesn't keep references to invalid widgets.
func (*FocusStateMachine) RequestFocus ¶ added in v0.11.0
func (fsm *FocusStateMachine) RequestFocus(node *paneNode, source FocusSource) error
RequestFocus queues a focus change request with priority and deduplication
func (*FocusStateMachine) Shutdown ¶ added in v0.11.0
func (fsm *FocusStateMachine) Shutdown()
Shutdown gracefully shuts down the focus state machine
type FocusTransition ¶ added in v0.11.0
type FocusTransition struct {
From *paneNode // Previous focus target
To *paneNode // New focus target
State FocusState // State during transition
Source FocusSource // Request source
Timestamp time.Time // When transition occurred
Success bool // Whether transition succeeded
Error error // Error if transition failed
Stack []byte // Stack trace for debugging
}
FocusTransition records a completed focus change for debugging
type FocusValidator ¶ added in v0.11.0
type FocusValidator func(request FocusRequest) error
FocusValidator validates focus requests before processing
type GeometryValidator ¶ added in v0.11.0
type GeometryValidator struct {
// contains filtered or unexported fields
}
GeometryValidator validates pane geometry constraints for splits and operations
func NewGeometryValidator ¶ added in v0.11.0
func NewGeometryValidator() *GeometryValidator
NewGeometryValidator creates a new geometry validator
func (*GeometryValidator) GetPaneGeometry ¶ added in v0.11.0
func (gv *GeometryValidator) GetPaneGeometry(node *paneNode) PaneGeometry
GetPaneGeometry extracts geometry information from a pane node
func (*GeometryValidator) SetDebugMode ¶ added in v0.11.0
func (gv *GeometryValidator) SetDebugMode(debug bool)
SetDebugMode enables or disables debug logging
func (*GeometryValidator) ValidateHorizontalSplit ¶ added in v0.11.0
func (gv *GeometryValidator) ValidateHorizontalSplit(node *paneNode) ValidationResult
ValidateHorizontalSplit validates if a pane can be split horizontally
func (*GeometryValidator) ValidateSplit ¶ added in v0.11.0
func (gv *GeometryValidator) ValidateSplit(node *paneNode, direction string) ValidationResult
ValidateSplit validates a split operation based on direction
func (*GeometryValidator) ValidateStackOperation ¶ added in v0.11.0
func (gv *GeometryValidator) ValidateStackOperation(node *paneNode) ValidationResult
ValidateStackOperation validates if a pane can be converted to a stack
func (*GeometryValidator) ValidateVerticalSplit ¶ added in v0.11.0
func (gv *GeometryValidator) ValidateVerticalSplit(node *paneNode) ValidationResult
ValidateVerticalSplit validates if a pane can be split vertically
type MessageHandlerInterface ¶ added in v0.9.0
type MessageHandlerInterface interface {
SetWorkspaceObserver(observer messaging.WorkspaceObserver)
}
MessageHandlerInterface abstracts messaging.Handler
type NavigationControllerInterface ¶ added in v0.9.0
type NavigationControllerInterface interface {
}
NavigationControllerInterface abstracts navigation operations
type PaneGeometry ¶ added in v0.11.0
PaneGeometry represents the geometry of a pane
type PaneInterface ¶ added in v0.9.0
type PaneInterface interface {
WebView() WebViewInterface
MessageHandler() MessageHandlerInterface
ZoomController() ZoomControllerInterface
ClipboardController() ClipboardControllerInterface
ShortcutHandler() ShortcutHandlerInterface
ID() string
HasGUI() bool
SetHasGUI(bool)
SetID(string)
UpdateLastFocus()
HasGUIComponent(component string) bool
SetGUIComponent(component string, loaded bool)
Cleanup()
}
PaneInterface abstracts BrowserPane for testing
type RebalanceOperation ¶ added in v0.11.0
type RebalanceOperation struct {
Type RebalanceType
Node *paneNode
Description string
}
RebalanceOperation describes an attempted rebalance step (unused in shim).
type RebalanceType ¶ added in v0.11.0
type RebalanceType int
RebalanceType enumerates rebalancer operations (kept for completeness).
const ( RebalanceRotateLeft RebalanceType = iota RebalanceRotateRight RebalancePromote RebalanceRestructure )
type RequestDeduplicator ¶ added in v0.11.0
type RequestDeduplicator struct {
// contains filtered or unexported fields
}
RequestDeduplicator prevents duplicate requests from flooding the queue
func NewRequestDeduplicator ¶ added in v0.11.0
func NewRequestDeduplicator(ttl time.Duration) *RequestDeduplicator
NewRequestDeduplicator creates a new request deduplicator
func (*RequestDeduplicator) IsDuplicate ¶ added in v0.11.0
func (rd *RequestDeduplicator) IsDuplicate(req FocusRequest, isActiveTarget bool) bool
IsDuplicate checks if a request is a duplicate within the TTL window
type RingBuffer ¶ added in v0.11.0
type RingBuffer[T any] struct { // contains filtered or unexported fields }
RingBuffer provides a thread-safe circular buffer for focus history
func NewRingBuffer ¶ added in v0.11.0
func NewRingBuffer[T any](capacity int) *RingBuffer[T]
NewRingBuffer creates a new ring buffer with the specified capacity
func (*RingBuffer[T]) Add ¶ added in v0.11.0
func (rb *RingBuffer[T]) Add(item T)
Add inserts an item into the ring buffer
func (*RingBuffer[T]) GetAll ¶ added in v0.11.0
func (rb *RingBuffer[T]) GetAll() []T
GetAll returns all items in the ring buffer in chronological order
type ShortcutHandler ¶
type ShortcutHandler struct {
// contains filtered or unexported fields
}
ShortcutHandler manages keyboard shortcuts for the browser
func NewShortcutHandler ¶
func NewShortcutHandler(webView *webkit.WebView, clipboardController *control.ClipboardController, cfg *config.Config, app *BrowserApp) *ShortcutHandler
NewShortcutHandler creates a new shortcut handler
func (*ShortcutHandler) Detach ¶ added in v0.10.0
func (s *ShortcutHandler) Detach()
Detach releases the WebView reference to prevent post-destruction usage.
func (*ShortcutHandler) RegisterShortcuts ¶
func (s *ShortcutHandler) RegisterShortcuts()
RegisterShortcuts registers pane-specific keyboard shortcuts with focus guards
type ShortcutHandlerInterface ¶ added in v0.9.0
type ShortcutHandlerInterface interface {
}
ShortcutHandlerInterface abstracts shortcut handling
type StackLifecycleManager ¶ added in v0.11.0
type StackLifecycleManager struct {
// contains filtered or unexported fields
}
StackLifecycleManager manages the lifecycle hooks around stacked pane operations.
func NewStackLifecycleManager ¶ added in v0.11.0
func NewStackLifecycleManager(wm *WorkspaceManager, treeValidator *TreeValidator) *StackLifecycleManager
NewStackLifecycleManager creates a new stack lifecycle manager.
func (*StackLifecycleManager) CloseStackedPaneWithLifecycle ¶ added in v0.11.0
func (slm *StackLifecycleManager) CloseStackedPaneWithLifecycle(node *paneNode) error
CloseStackedPaneWithLifecycle validates the stack state and delegates the actual close operation to the stacked pane manager. This keeps widget handling simple (raw GTK pointers) while still giving us a single place for additional safety checks.
type StackedPaneManager ¶ added in v0.11.0
type StackedPaneManager struct {
// contains filtered or unexported fields
}
StackedPaneManager handles all stacked pane operations
func NewStackedPaneManager ¶ added in v0.11.0
func NewStackedPaneManager(wm *WorkspaceManager) *StackedPaneManager
NewStackedPaneManager creates a new stacked pane manager
func (*StackedPaneManager) CloseStackedPane ¶ added in v0.11.0
func (spm *StackedPaneManager) CloseStackedPane(node *paneNode) error
TODO(#8): Refactor this function to reduce cyclomatic complexity (49 -> <30)
CloseStackedPane handles closing a pane that is part of a stack. The logic mirrors the regular close path: we rebuild the tree, update focus, and let WorkspaceManager perform the actual cleanup/destroy work so that all bookkeeping stays consistent.
func (*StackedPaneManager) NavigateStack ¶ added in v0.11.0
func (spm *StackedPaneManager) NavigateStack(direction string) bool
NavigateStack handles navigation within a stacked pane container
func (*StackedPaneManager) StackPane ¶ added in v0.11.0
func (spm *StackedPaneManager) StackPane(target *paneNode) (*paneNode, error)
StackPane creates a new pane stacked on top of the target pane. This is the main entry point for creating stacked panes.
func (*StackedPaneManager) UpdateStackVisibility ¶ added in v0.11.0
func (spm *StackedPaneManager) UpdateStackVisibility(stackNode *paneNode)
UpdateStackVisibility updates the visibility of panes in a stack
func (*StackedPaneManager) UpdateTitleBar ¶ added in v0.11.0
func (spm *StackedPaneManager) UpdateTitleBar(webView *webkit.WebView, title string)
UpdateTitleBar updates the title bar label for a WebView in stacked panes
type TreeMetrics ¶ added in v0.11.0
type TreeMetrics struct{}
TreeMetrics represents the structural metrics of the workspace tree.
type TreeRebalancer ¶ added in v0.11.0
type TreeRebalancer struct {
// contains filtered or unexported fields
}
TreeRebalancer is currently a no-op shim kept for API compatibility.
func NewTreeRebalancer ¶ added in v0.11.0
func NewTreeRebalancer(_ *WorkspaceManager, _ *TreeValidator) *TreeRebalancer
NewTreeRebalancer returns a disabled stub implementation. NOTE: Tree rebalancing logic has been temporarily disabled in favor of manual geometry management. Future work may restore automatic rebalancing or replace it with an alternative approach.
func (*TreeRebalancer) CalculateTreeMetrics ¶ added in v0.11.0
func (tr *TreeRebalancer) CalculateTreeMetrics(_ *paneNode) TreeMetrics
CalculateTreeMetrics returns empty metrics in the stub.
func (*TreeRebalancer) Disable ¶ added in v0.11.0
func (tr *TreeRebalancer) Disable()
Disable toggles the stub off.
func (*TreeRebalancer) Enable ¶ added in v0.11.0
func (tr *TreeRebalancer) Enable()
Enable toggles the stub on (no functional impact).
func (*TreeRebalancer) GetRebalancingStats ¶ added in v0.11.0
func (tr *TreeRebalancer) GetRebalancingStats() map[string]interface{}
GetRebalancingStats exposes minimal instrumentation for diagnostics.
func (*TreeRebalancer) RebalanceAfterClose ¶ added in v0.11.0
func (tr *TreeRebalancer) RebalanceAfterClose(_ *paneNode, _ *paneNode) error
RebalanceAfterClose is a no-op in the stub implementation.
func (*TreeRebalancer) SetMaxImbalance ¶ added in v0.11.0
func (tr *TreeRebalancer) SetMaxImbalance(_ int)
SetMaxImbalance is preserved for API compatibility.
type TreeSnapshot ¶ added in v0.11.0
type TreeValidator ¶ added in v0.11.0
type TreeValidator struct {
// contains filtered or unexported fields
}
TreeValidator previously performed extensive tree checks. The SafeWidget removal rendered the implementation obsolete, so we keep a lightweight shim until a new validator is written.
func NewTreeValidator ¶ added in v0.11.0
func NewTreeValidator(enabled bool, _ bool) *TreeValidator
NewTreeValidator returns a stub validator instance.
func (*TreeValidator) Disable ¶ added in v0.11.0
func (tv *TreeValidator) Disable()
Disable turns validation off.
func (*TreeValidator) Enable ¶ added in v0.11.0
func (tv *TreeValidator) Enable()
Enable turns validation on (no functional impact in the stub).
func (*TreeValidator) Enabled ¶ added in v0.11.0
func (tv *TreeValidator) Enabled() bool
Enabled reports current state (used by tests/instrumentation).
func (*TreeValidator) GetValidationStats ¶ added in v0.11.0
func (tv *TreeValidator) GetValidationStats() map[string]interface{}
GetValidationStats mimics the old diagnostic output.
func (*TreeValidator) SetDebugMode ¶ added in v0.11.0
func (tv *TreeValidator) SetDebugMode(_ bool)
SetDebugMode preserved for compatibility.
func (*TreeValidator) ValidateTree ¶ added in v0.11.0
func (tv *TreeValidator) ValidateTree(_ *paneNode, _ string) error
ValidateTree is a no-op that reports success unless validation is explicitly enabled.
type ValidationResult ¶ added in v0.11.0
type ValidationResult struct {
IsValid bool
Reason string
Geometry PaneGeometry
RequiresRevalidation bool
}
ValidationResult represents the result of a geometry validation
type WebViewInterface ¶ added in v0.9.0
type WebViewInterface interface {
LoadURL(url string) error
Show() error
Hide() error
Destroy() error
Window() *webkit.Window
GetCurrentURL() string
Widget() uintptr
RootWidget() uintptr
InjectScript(script string) error
DispatchCustomEvent(event string, detail map[string]any) error
RegisterKeyboardShortcut(key string, handler func()) error
RegisterURIChangedHandler(handler func(string))
}
WebViewInterface abstracts WebKit WebView for testing
type WindowInterface ¶ added in v0.9.0
type WindowInterface interface {
SetChild(widget uintptr)
}
WindowInterface abstracts webkit.Window for testing
type WindowShortcutHandler ¶ added in v0.9.0
type WindowShortcutHandler struct {
// contains filtered or unexported fields
}
WindowShortcutHandler manages global shortcuts at the window level
func NewWindowShortcutHandler ¶ added in v0.9.0
func NewWindowShortcutHandler(window *webkit.Window, app *BrowserApp) *WindowShortcutHandler
NewWindowShortcutHandler creates a new window-level shortcut handler
func (*WindowShortcutHandler) Cleanup ¶ added in v0.9.0
func (h *WindowShortcutHandler) Cleanup()
Cleanup releases resources
type WindowShortcutHandlerInterface ¶ added in v0.9.0
type WindowShortcutHandlerInterface interface {
Cleanup()
}
WindowShortcutHandlerInterface abstracts window shortcut handling for testing
type WorkspaceDiagnostics ¶ added in v0.11.0
type WorkspaceDiagnostics struct {
// contains filtered or unexported fields
}
func NewWorkspaceDiagnostics ¶ added in v0.11.0
func NewWorkspaceDiagnostics(enabled bool) *WorkspaceDiagnostics
func (*WorkspaceDiagnostics) Capture ¶ added in v0.11.0
func (d *WorkspaceDiagnostics) Capture(label string, root *paneNode) TreeSnapshot
func (*WorkspaceDiagnostics) Enabled ¶ added in v0.11.0
func (d *WorkspaceDiagnostics) Enabled() bool
func (*WorkspaceDiagnostics) SetEnabled ¶ added in v0.11.0
func (d *WorkspaceDiagnostics) SetEnabled(enabled bool)
func (*WorkspaceDiagnostics) Snapshots ¶ added in v0.11.0
func (d *WorkspaceDiagnostics) Snapshots() []TreeSnapshot
type WorkspaceManager ¶ added in v0.9.0
type WorkspaceManager struct {
// contains filtered or unexported fields
}
WorkspaceManager coordinates Zellij-style pane operations.
func NewWorkspaceManager ¶ added in v0.9.0
func NewWorkspaceManager(app *BrowserApp, rootPane *BrowserPane) *WorkspaceManager
NewWorkspaceManager builds a workspace manager rooted at the provided pane.
func (*WorkspaceManager) ClosePane ¶ added in v0.11.0
func (wm *WorkspaceManager) ClosePane(node *paneNode) error
ClosePane performs a close operation with validation and safety checks
func (*WorkspaceManager) DiagnosticsSnapshots ¶ added in v0.11.0
func (wm *WorkspaceManager) DiagnosticsSnapshots() []TreeSnapshot
func (*WorkspaceManager) DisableEnhancedMode ¶ added in v0.11.0
func (wm *WorkspaceManager) DisableEnhancedMode()
DisableEnhancedMode disables enhanced features for performance
func (*WorkspaceManager) DispatchPaneFocusEvent ¶ added in v0.10.0
func (wm *WorkspaceManager) DispatchPaneFocusEvent(node *paneNode, active bool)
DispatchPaneFocusEvent sends a workspace focus event to a pane's webview
func (*WorkspaceManager) EnableEnhancedMode ¶ added in v0.11.0
func (wm *WorkspaceManager) EnableEnhancedMode()
EnableEnhancedMode enables all enhanced validation features
func (*WorkspaceManager) EnterPaneMode ¶ added in v0.12.0
func (wm *WorkspaceManager) EnterPaneMode()
EnterPaneMode activates pane mode on the currently focused pane This is called directly from the keyboard bridge, not from JavaScript
func (*WorkspaceManager) ExitPaneMode ¶ added in v0.12.0
func (wm *WorkspaceManager) ExitPaneMode(reason string)
ExitPaneMode deactivates pane mode
func (*WorkspaceManager) FocusNeighbor ¶ added in v0.9.0
func (wm *WorkspaceManager) FocusNeighbor(direction string) bool
FocusNeighbor moves focus to the nearest pane in the requested direction using the actual widget geometry to determine adjacency. For stacked panes, DirectionUp and DirectionDown navigate within the stack.
func (*WorkspaceManager) GetActiveNode ¶ added in v0.10.0
func (wm *WorkspaceManager) GetActiveNode() *paneNode
GetActiveNode returns the currently active pane node
func (*WorkspaceManager) GetEnhancedStats ¶ added in v0.11.0
func (wm *WorkspaceManager) GetEnhancedStats() map[string]interface{}
GetEnhancedStats returns comprehensive statistics about all enhanced validation components
func (*WorkspaceManager) GetNodeForWebView ¶ added in v0.10.0
func (wm *WorkspaceManager) GetNodeForWebView(webView *webkit.WebView) *paneNode
GetNodeForWebView returns the pane node associated with a WebView
func (*WorkspaceManager) HandlePaneAction ¶ added in v0.12.0
func (wm *WorkspaceManager) HandlePaneAction(action string)
HandlePaneAction processes pane mode actions (close, split, etc.) Called from keyboard bridge when user presses action keys in pane mode
func (*WorkspaceManager) OnWorkspaceMessage ¶ added in v0.9.0
func (wm *WorkspaceManager) OnWorkspaceMessage(source *webkit.WebView, msg messaging.Message)
OnWorkspaceMessage implements messaging.WorkspaceObserver.
func (*WorkspaceManager) RegisterNavigationHandler ¶ added in v0.10.0
func (wm *WorkspaceManager) RegisterNavigationHandler(webView *webkit.WebView)
RegisterNavigationHandler sets up navigation handling for a webview
func (*WorkspaceManager) RunOnUI ¶ added in v0.9.0
func (wm *WorkspaceManager) RunOnUI(fn func())
RunOnUI schedules a function; here simply executes inline as GTK main loop is single-threaded
func (*WorkspaceManager) SetActivePane ¶ added in v0.11.0
func (wm *WorkspaceManager) SetActivePane(node *paneNode, source FocusSource)
SetActivePane requests focus change through the focus state machine with debouncing
func (*WorkspaceManager) SetEnhancedDebugMode ¶ added in v0.11.0
func (wm *WorkspaceManager) SetEnhancedDebugMode(debug bool)
SetEnhancedDebugMode enables/disables debug mode for all enhanced validation components
func (*WorkspaceManager) SetPaneCloseDebug ¶ added in v0.11.0
func (wm *WorkspaceManager) SetPaneCloseDebug(enabled bool)
func (*WorkspaceManager) ShutdownEnhancedComponents ¶ added in v0.11.0
func (wm *WorkspaceManager) ShutdownEnhancedComponents()
ShutdownEnhancedComponents gracefully shuts down all enhanced validation components
func (*WorkspaceManager) SplitPane ¶ added in v0.11.0
func (wm *WorkspaceManager) SplitPane(target *paneNode, direction string) (*paneNode, error)
SplitPane performs a split operation with validation and safety checks
func (*WorkspaceManager) StackPane ¶ added in v0.11.0
func (wm *WorkspaceManager) StackPane(target *paneNode) (*paneNode, error)
StackPane performs a stack operation with validation and safety checks
func (*WorkspaceManager) UpdateTitleBar ¶ added in v0.11.0
func (wm *WorkspaceManager) UpdateTitleBar(webView *webkit.WebView, title string)
UpdateTitleBar updates the title bar label for a WebView in stacked panes
func (*WorkspaceManager) ValidateWorkspaceIntegrity ¶ added in v0.11.0
func (wm *WorkspaceManager) ValidateWorkspaceIntegrity() error
ValidateWorkspaceIntegrity performs a comprehensive validation of the workspace
type ZoomControllerInterface ¶ added in v0.9.0
type ZoomControllerInterface interface {
ApplyInitialZoom()
}
ZoomControllerInterface abstracts zoom operations
Source Files
¶
- browser.go
- constants.go
- focus_state_machine.go
- interfaces.go
- pane.go
- shortcuts.go
- stacked_panes.go
- webview.go
- window_shortcuts.go
- workspace_css.go
- workspace_debug.go
- workspace_diagnostics.go
- workspace_geometry_validator.go
- workspace_hover.go
- workspace_manager.go
- workspace_navigation.go
- workspace_operations.go
- workspace_pane_mode.go
- workspace_pane_ops.go
- workspace_popup.go
- workspace_stack_lifecycle.go
- workspace_tree_rebalancer.go
- workspace_tree_validator.go
- workspace_types.go
- workspace_utils.go