ui

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package ui provides the GTK4 presentation layer for the dumber browser.

Index

Constants

View Source
const (
	// AppID is the application identifier for GTK.
	AppID = "com.github.bnema.dumber"
)

Variables

This section is empty.

Functions

func ErrMissingDependency

func ErrMissingDependency(name string) error

ErrMissingDependency creates a new DependencyError.

func RunWithArgs

func RunWithArgs(ctx context.Context, deps *Dependencies) int

RunWithArgs is a convenience function that creates and runs an App.

Types

type App

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

App wraps the GTK Application and manages the browser lifecycle.

func New

func New(deps *Dependencies) (*App, error)

New creates a new App with the given dependencies.

func (*App) CloseFindBar

func (a *App) CloseFindBar(ctx context.Context)

CloseFindBar hides the find bar if visible.

func (*App) FindNext

func (a *App) FindNext(ctx context.Context)

FindNext selects the next match in the active find bar.

func (*App) FindPrevious

func (a *App) FindPrevious(ctx context.Context)

FindPrevious selects the previous match in the active find bar.

func (*App) MainWindow

func (a *App) MainWindow() *window.MainWindow

MainWindow returns the main window.

func (*App) Quit

func (a *App) Quit()

Quit requests the application to quit.

func (*App) Run

func (a *App) Run(ctx context.Context, args []string) int

Run starts the GTK application and blocks until it exits. Returns the exit code.

func (*App) SetOmniboxOnNavigate

func (a *App) SetOmniboxOnNavigate(fn func(url string))

SetOmniboxOnNavigate implements OmniboxProvider. This is called to set the navigation callback on new omniboxes. Since omniboxes are created per-pane, we store the config with the callback.

func (*App) Tabs

func (a *App) Tabs() *entity.TabList

Tabs returns the tab list.

func (*App) ToggleFindBar

func (a *App) ToggleFindBar(ctx context.Context)

ToggleFindBar shows or hides the find bar in the active workspace view.

func (*App) ToggleOmnibox

func (a *App) ToggleOmnibox(ctx context.Context)

ToggleOmnibox implements OmniboxProvider. Toggles the omnibox visibility in the active workspace view.

func (*App) UpdateOmniboxZoom

func (a *App) UpdateOmniboxZoom(factor float64)

UpdateOmniboxZoom implements OmniboxProvider. Updates the zoom indicator on the current omnibox if visible.

type Dependencies

type Dependencies struct {
	// Core context and configuration
	Ctx        context.Context
	Config     *config.Config
	InitialURL string // URL to open on startup (optional)

	// Theme management
	Theme *theme.Manager

	// WebKit infrastructure
	WebContext    *webkit.WebKitContext
	Pool          *webkit.WebViewPool
	Factory       port.WebViewFactory
	Settings      *webkit.SettingsManager
	Injector      *webkit.ContentInjector
	MessageRouter *webkit.MessageRouter

	// Repositories
	HistoryRepo  repository.HistoryRepository
	FavoriteRepo repository.FavoriteRepository
	ZoomRepo     repository.ZoomRepository
	FilterRepo   repository.ContentWhitelistRepository

	// Use Cases
	TabsUC      *usecase.ManageTabsUseCase
	PanesUC     *usecase.ManagePanesUseCase
	NavigateUC  *usecase.NavigateUseCase
	ZoomUC      *usecase.ManageZoomUseCase
	FavoritesUC *usecase.ManageFavoritesUseCase
	HistoryUC   *usecase.SearchHistoryUseCase
	CopyURLUC   *usecase.CopyURLUseCase

	// Infrastructure Adapters
	Clipboard      port.Clipboard
	FaviconService *favicon.Service
	FilterManager  *filtering.Manager
	IdleInhibitor  port.IdleInhibitor
}

Dependencies holds all injected dependencies for the UI layer. This struct is created once at startup and passed to UI components.

func (*Dependencies) Validate

func (d *Dependencies) Validate() error

Validate checks that all required dependencies are set.

type DependencyError

type DependencyError struct {
	Name string
}

DependencyError indicates a missing required dependency.

func (DependencyError) Error

func (e DependencyError) Error() string

Directories

Path Synopsis
Package adapter provides UI-layer adapters that bridge domain services to GTK.
Package adapter provides UI-layer adapters that bridge domain services to GTK.
Package component provides UI components for the browser.
Package component provides UI components for the browser.
Package focus provides focus state management and geometric navigation for panes.
Package focus provides focus state management and geometric navigation for panes.
Package input provides keyboard event handling and modal input mode management.
Package input provides keyboard event handling and modal input mode management.
Package layout provides GTK widget abstractions and layout management for the pane system.
Package layout provides GTK widget abstractions and layout management for the pane system.
Package theme provides GTK CSS styling for UI components.
Package theme provides GTK CSS styling for UI components.
Package window provides GTK window implementations.
Package window provides GTK window implementations.

Jump to

Keyboard shortcuts

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