browser

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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) 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 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 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 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) 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 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 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) 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.

func (*WorkspaceManager) HandlePopup added in v0.9.0

func (wm *WorkspaceManager) HandlePopup(source *webkit.WebView, url string) *webkit.WebView

func (*WorkspaceManager) OnWorkspaceMessage added in v0.9.0

func (wm *WorkspaceManager) OnWorkspaceMessage(source *webkit.WebView, msg messaging.Message)

OnWorkspaceMessage implements messaging.WorkspaceObserver.

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

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