browser

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 35 Imported by: 0

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

View Source
const (
	DirectionLeft  = "left"
	DirectionRight = "right"
	DirectionUp    = "up"
	DirectionDown  = "down"
)

Direction constants for pane navigation and splitting

View Source
const (
	PriorityLow    = 10
	PriorityNormal = 50
	PriorityHigh   = 90
	PriorityUrgent = 100
)

Priority levels for focus requests

View Source
const (
	NewTabTitle = "New Tab"
)

UI string constants

View Source
const (
	ThemeDefault = "default"
)

Theme constants

Variables

View Source
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

View Source
var (
	ErrFailedToInitialize = fmt.Errorf("failed to initialize window shortcuts")
)

Error definitions

Functions

func Run

func Run(assets embed.FS, version, commit, buildDate string)

Run starts the browser application

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

func (*BrowserApp) Run

func (app *BrowserApp) Run()

Run executes the main browser loop

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
	SourceStackNav     FocusSource = "stack-nav"    // Stack navigation
	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 interface {
	NavigateToURL(url string) error
}

NavigationControllerInterface abstracts navigation operations

type PaneGeometry added in v0.11.0

type PaneGeometry struct {
	X       int
	Y       int
	Width   int
	Height  int
	IsValid bool
}

PaneGeometry represents the geometry of a pane

type PaneInterface added in v0.9.0

type PaneInterface interface {
	WebView() WebViewInterface
	MessageHandler() MessageHandlerInterface
	NavigationController() NavigationControllerInterface
	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 Tab added in v0.14.0

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

Tab represents a single browser tab containing a complete workspace.

type TabManager added in v0.14.0

type TabManager struct {
	ContentArea gtk.Widgetter // Container for active workspace (exported for border styling)
	// contains filtered or unexported fields
}

TabManager manages the global tab system for the browser. Each tab contains an independent workspace with its own pane tree.

func NewTabManager added in v0.14.0

func NewTabManager(app *BrowserApp, window *webkit.Window) *TabManager

NewTabManager creates a new tab manager instance.

func (*TabManager) Cleanup added in v0.14.0

func (tm *TabManager) Cleanup()

Cleanup performs cleanup of all tabs and resources.

func (*TabManager) CloseTab added in v0.14.0

func (tm *TabManager) CloseTab(index int) error

CloseTab closes the tab at the given index.

func (*TabManager) CreateTab added in v0.14.0

func (tm *TabManager) CreateTab(url string) error

CreateTab creates a new tab and switches to it. URL can be empty string to use default homepage.

func (*TabManager) EnterTabMode added in v0.14.0

func (tm *TabManager) EnterTabMode()

EnterTabMode activates the modal tab management mode. This is triggered by Alt+T and provides visual feedback and temporary key bindings.

func (*TabManager) ExitTabMode added in v0.14.0

func (tm *TabManager) ExitTabMode(reason string)

ExitTabMode deactivates tab mode and removes visual indicators.

func (*TabManager) GetActiveTab added in v0.14.0

func (tm *TabManager) GetActiveTab() *Tab

GetActiveTab returns the currently active tab.

func (*TabManager) GetRootContainer added in v0.14.0

func (tm *TabManager) GetRootContainer() gtk.Widgetter

GetRootContainer returns the main container widget that should be set as window child.

func (*TabManager) GetTabCount added in v0.14.0

func (tm *TabManager) GetTabCount() int

GetTabCount returns the number of open tabs.

func (*TabManager) GetWindow added in v0.14.0

func (tm *TabManager) GetWindow() *webkit.Window

GetWindow returns the GTK window backing the tab manager.

func (*TabManager) HandleTabAction added in v0.14.0

func (tm *TabManager) HandleTabAction(action string)

HandleTabAction processes a tab mode action (new-tab, close-tab, etc.).

func (*TabManager) Initialize added in v0.14.0

func (tm *TabManager) Initialize(initialURL string) error

Initialize sets up the tab bar and creates the initial tab.

func (*TabManager) IsRenameInProgress added in v0.14.1

func (tm *TabManager) IsRenameInProgress() bool

IsRenameInProgress returns whether a tab rename is currently in progress.

func (*TabManager) IsTabModeActive added in v0.14.0

func (tm *TabManager) IsTabModeActive() bool

IsTabModeActive returns whether tab mode is currently active.

func (*TabManager) NextTab added in v0.14.0

func (tm *TabManager) NextTab() error

NextTab switches to the next tab (wraps around).

func (*TabManager) PreviousTab added in v0.14.0

func (tm *TabManager) PreviousTab() error

PreviousTab switches to the previous tab (wraps around).

func (*TabManager) RenameTab added in v0.14.0

func (tm *TabManager) RenameTab(index int, customTitle string) error

RenameTab sets a custom title for the tab at the given index.

func (*TabManager) SwitchToTab added in v0.14.0

func (tm *TabManager) SwitchToTab(index int) error

SwitchToTab switches to the tab at the given index.

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 TreeSnapshot struct {
	Label string
	Lines []string
}

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) ClearFocus added in v0.14.0

func (wm *WorkspaceManager) ClearFocus()

ClearFocus removes GTK focus from all panes in this workspace. This prevents inactive tab's WebViews from catching keyboard events.

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) GetActivePane added in v0.14.0

func (wm *WorkspaceManager) GetActivePane() *BrowserPane

GetActivePane returns the currently active BrowserPane in this workspace. This is used by TabManager to update app-level activePane reference.

func (*WorkspaceManager) GetAllPanes added in v0.14.0

func (wm *WorkspaceManager) GetAllPanes() []*BrowserPane

GetAllPanes returns all BrowserPanes in this workspace. This is used by TabManager to update app-level panes reference.

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) GetRootWidget added in v0.14.0

func (wm *WorkspaceManager) GetRootWidget() gtk.Widgetter

GetRootWidget returns the root GTK widget for this workspace. This is the container that should be added to the tab's content area.

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) IsInActiveTab added in v0.14.0

func (wm *WorkspaceManager) IsInActiveTab() bool

IsInActiveTab returns whether this workspace is the app's current active workspace. This is checked dynamically by comparing with app.workspace (updated during tab switching).

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) RestoreFocus added in v0.14.0

func (wm *WorkspaceManager) RestoreFocus()

RestoreFocus restores focus to the active pane in this workspace. Called when switching to a tab to ensure the correct pane has focus.

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

Directories

Path Synopsis
Package mock_browser is a generated GoMock package.
Package mock_browser is a generated GoMock package.

Jump to

Keyboard shortcuts

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