usecase

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: 15 Imported by: 0

Documentation

Overview

Package usecase contains application business logic.

Package usecase contains application business logic.

Package usecase contains application business logic.

Package usecase contains application use cases that orchestrate domain logic.

Package usecase contains application business logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractDomain

func ExtractDomain(rawURL string) (string, error)

ExtractDomain extracts the host from a URL string.

Types

type AddFavoriteInput

type AddFavoriteInput struct {
	URL        string
	Title      string
	FaviconURL string
	FolderID   *entity.FolderID
	Tags       []entity.TagID
}

AddFavoriteInput contains parameters for adding a favorite.

type AddToStackOutput

type AddToStackOutput struct {
	NewPaneNode *entity.PaneNode // The new pane node added to the stack
	StackIndex  int              // Index of the new pane in the stack
}

AddToStackOutput contains the result of adding a pane to a stack.

type CheckMediaInput

type CheckMediaInput struct {
	ShowDiagnostics bool // Log diagnostics warnings
}

CheckMediaInput contains options for the media check.

type CheckMediaOutput

type CheckMediaOutput struct {
	GStreamerAvailable bool
	HWAccelAvailable   bool
	AV1HWAvailable     bool
	Warnings           []string
}

CheckMediaOutput contains the result of the media check.

type CheckMediaUseCase

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

CheckMediaUseCase validates media playback requirements at startup.

func NewCheckMediaUseCase

func NewCheckMediaUseCase(diagnostics port.MediaDiagnostics) *CheckMediaUseCase

NewCheckMediaUseCase creates a new CheckMediaUseCase.

func (*CheckMediaUseCase) Execute

Execute checks media playback requirements. Returns error if GStreamer is not installed (fatal). Returns warnings for missing hardware acceleration (non-fatal).

type CheckRuntimeDependenciesInput

type CheckRuntimeDependenciesInput struct {
	// Prefix optionally points to a custom runtime prefix (e.g. /opt/webkitgtk).
	// Implementations may use this to influence pkg-config search paths.
	Prefix string

	// Min versions. If empty, defaults are used.
	MinGTK4Version      string
	MinWebKitGTKVersion string
	MinGLibVersion      string
}

CheckRuntimeDependenciesInput contains options for runtime dependency checks.

type CheckRuntimeDependenciesOutput

type CheckRuntimeDependenciesOutput struct {
	Prefix string
	OK     bool
	Checks []RuntimeDependencyStatus
}

CheckRuntimeDependenciesOutput contains the result of the runtime dependency checks.

type CheckRuntimeDependenciesUseCase

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

CheckRuntimeDependenciesUseCase validates runtime requirements for the GUI browser.

func NewCheckRuntimeDependenciesUseCase

func NewCheckRuntimeDependenciesUseCase(probe port.RuntimeVersionProbe) *CheckRuntimeDependenciesUseCase

NewCheckRuntimeDependenciesUseCase creates a new use case.

func (*CheckRuntimeDependenciesUseCase) Execute

Execute checks WebKitGTK and GTK runtime versions.

type CopyURLUseCase

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

CopyURLUseCase handles copying URLs to the system clipboard.

func NewCopyURLUseCase

func NewCopyURLUseCase(clipboard port.Clipboard) *CopyURLUseCase

NewCopyURLUseCase creates a new CopyURLUseCase.

func (*CopyURLUseCase) Copy

func (uc *CopyURLUseCase) Copy(ctx context.Context, url string) error

Copy copies the given URL to the clipboard. Returns nil on success, error on failure. The caller is responsible for showing toast notifications on the UI thread.

type CreateStackOutput

type CreateStackOutput struct {
	StackNode    *entity.PaneNode // The stack container node
	OriginalNode *entity.PaneNode // The original pane, now a child of the stack
	NewPaneNode  *entity.PaneNode // The new pane added to the stack
	NewPane      *entity.Pane     // The new pane entity
}

CreateStackOutput contains the result of creating a stack from a pane.

type CreateTabInput

type CreateTabInput struct {
	TabList    *entity.TabList
	Name       string // Optional custom name
	InitialURL string // URL to load (default: about:blank)
	IsPinned   bool
}

CreateTabInput contains parameters for creating a new tab.

type CreateTabOutput

type CreateTabOutput struct {
	Tab *entity.Tab
}

CreateTabOutput contains the result of tab creation.

type CreateTabWithPaneInput

type CreateTabWithPaneInput struct {
	TabList    *entity.TabList
	Name       string       // Optional custom name
	Pane       *entity.Pane // Pre-created pane (for popups)
	InitialURL string       // URL for the pane
}

CreateTabWithPaneInput contains parameters for creating a tab with an existing pane.

type FindInPageUseCase

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

FindInPageUseCase manages find-in-page business logic.

func NewFindInPageUseCase

func NewFindInPageUseCase(ctx context.Context) *FindInPageUseCase

NewFindInPageUseCase creates a new find-in-page use case.

func (*FindInPageUseCase) Bind

func (uc *FindInPageUseCase) Bind(controller port.FindController)

Bind attaches a FindController and connects its signals.

func (*FindInPageUseCase) Finish

func (uc *FindInPageUseCase) Finish()

Finish clears the current search and highlights.

func (*FindInPageUseCase) History

func (uc *FindInPageUseCase) History() []string

History returns a copy of the search history.

func (*FindInPageUseCase) NextHistory

func (uc *FindInPageUseCase) NextHistory() (string, bool)

NextHistory selects the next history item.

func (*FindInPageUseCase) PrevHistory

func (uc *FindInPageUseCase) PrevHistory() (string, bool)

PrevHistory selects the previous history item.

func (*FindInPageUseCase) SearchNext

func (uc *FindInPageUseCase) SearchNext()

SearchNext selects the next match.

func (*FindInPageUseCase) SearchPrevious

func (uc *FindInPageUseCase) SearchPrevious()

SearchPrevious selects the previous match.

func (*FindInPageUseCase) SetAtWordStarts

func (uc *FindInPageUseCase) SetAtWordStarts(enabled bool)

SetAtWordStarts toggles word-start matching.

func (*FindInPageUseCase) SetCaseSensitiveEnabled

func (uc *FindInPageUseCase) SetCaseSensitiveEnabled(enabled bool)

SetCaseSensitiveEnabled toggles manual case sensitivity.

func (*FindInPageUseCase) SetHighlightEnabled

func (uc *FindInPageUseCase) SetHighlightEnabled(enabled bool)

SetHighlightEnabled toggles match highlighting.

func (*FindInPageUseCase) SetOnStateChange

func (uc *FindInPageUseCase) SetOnStateChange(fn func(state FindState))

SetOnStateChange sets a callback for state changes.

func (*FindInPageUseCase) SetQuery

func (uc *FindInPageUseCase) SetQuery(text string)

SetQuery updates the search query with debouncing.

func (*FindInPageUseCase) SetWrapAround

func (uc *FindInPageUseCase) SetWrapAround(enabled bool)

SetWrapAround toggles wrap-around searching.

func (*FindInPageUseCase) Unbind

func (uc *FindInPageUseCase) Unbind()

Unbind detaches the FindController and disconnects signals.

type FindState

type FindState struct {
	Query          string
	MatchCount     uint
	CurrentIndex   uint
	NotFound       bool
	CaseSensitive  bool
	AtWordStarts   bool
	WrapAround     bool
	HighlightOn    bool
	HistoryEnabled bool
}

FindState represents the current find-in-page state.

type GeometricNavigationInput

type GeometricNavigationInput struct {
	ActivePaneID entity.PaneID
	PaneRects    []entity.PaneRect // All visible panes with their positions
	Direction    NavigateDirection
}

GeometricNavigationInput contains data for geometric focus navigation.

type GeometricNavigationOutput

type GeometricNavigationOutput struct {
	TargetPaneID entity.PaneID
	Found        bool
}

GeometricNavigationOutput contains the result.

type IDGenerator

type IDGenerator func() string

IDGenerator is a function type for generating unique IDs.

type InstallDesktopInput

type InstallDesktopInput struct {
	IconData []byte
}

InstallDesktopInput contains the input for the install operation.

type InstallDesktopOutput

type InstallDesktopOutput struct {
	DesktopPath        string
	IconPath           string
	WasDesktopExisting bool
	WasIconExisting    bool
}

InstallDesktopOutput contains the result of the install operation.

type InstallDesktopUseCase

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

InstallDesktopUseCase installs the desktop file for system integration.

func NewInstallDesktopUseCase

func NewInstallDesktopUseCase(desktop port.DesktopIntegration) *InstallDesktopUseCase

NewInstallDesktopUseCase creates a new InstallDesktopUseCase.

func (*InstallDesktopUseCase) Execute

Execute installs the desktop file and icon.

type ManageFavoritesUseCase

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

ManageFavoritesUseCase handles favorite, folder, and tag operations.

func NewManageFavoritesUseCase

func NewManageFavoritesUseCase(
	favoriteRepo repository.FavoriteRepository,
	folderRepo repository.FolderRepository,
	tagRepo repository.TagRepository,
) *ManageFavoritesUseCase

NewManageFavoritesUseCase creates a new favorites management use case.

func (*ManageFavoritesUseCase) Add

Add creates a new favorite.

func (*ManageFavoritesUseCase) AddTag

func (uc *ManageFavoritesUseCase) AddTag(ctx context.Context, name, color string) (*entity.Tag, error)

AddTag creates a new tag.

func (*ManageFavoritesUseCase) CreateFolder

func (uc *ManageFavoritesUseCase) CreateFolder(ctx context.Context, name string, parentID *entity.FolderID) (*entity.Folder, error)

CreateFolder creates a new folder.

func (*ManageFavoritesUseCase) DeleteFolder

func (uc *ManageFavoritesUseCase) DeleteFolder(ctx context.Context, id entity.FolderID) error

DeleteFolder removes a folder. Favorites in the folder are moved to root.

func (*ManageFavoritesUseCase) DeleteTag

func (uc *ManageFavoritesUseCase) DeleteTag(ctx context.Context, id entity.TagID) error

DeleteTag removes a tag.

func (*ManageFavoritesUseCase) GetAll

GetAll retrieves all favorites.

func (*ManageFavoritesUseCase) GetAllFolders

func (uc *ManageFavoritesUseCase) GetAllFolders(ctx context.Context) ([]*entity.Folder, error)

GetAllFolders retrieves all folders.

func (*ManageFavoritesUseCase) GetAllTags

func (uc *ManageFavoritesUseCase) GetAllTags(ctx context.Context) ([]*entity.Tag, error)

GetAllTags retrieves all tags.

func (*ManageFavoritesUseCase) GetByShortcut

func (uc *ManageFavoritesUseCase) GetByShortcut(ctx context.Context, key int) (*entity.Favorite, error)

GetByShortcut finds the favorite with the given shortcut key.

func (*ManageFavoritesUseCase) GetByURL

func (uc *ManageFavoritesUseCase) GetByURL(ctx context.Context, url string) (*entity.Favorite, error)

GetByURL finds a favorite by its URL.

func (*ManageFavoritesUseCase) GetTagsForFavorite

func (uc *ManageFavoritesUseCase) GetTagsForFavorite(ctx context.Context, favID entity.FavoriteID) ([]*entity.Tag, error)

GetTagsForFavorite retrieves all tags for a favorite.

func (*ManageFavoritesUseCase) GetTree

GetTree builds a complete hierarchical view of folders and favorites.

func (*ManageFavoritesUseCase) IsFavorite

func (uc *ManageFavoritesUseCase) IsFavorite(ctx context.Context, url string) (bool, error)

IsFavorite checks if a URL is favorited.

func (*ManageFavoritesUseCase) Move

Move changes a favorite's folder.

func (*ManageFavoritesUseCase) Remove

Remove deletes a favorite by ID.

func (*ManageFavoritesUseCase) RemoveByURL

func (uc *ManageFavoritesUseCase) RemoveByURL(ctx context.Context, url string) error

RemoveByURL deletes a favorite by its URL.

func (*ManageFavoritesUseCase) SetShortcut

func (uc *ManageFavoritesUseCase) SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error

SetShortcut assigns or removes a keyboard shortcut (1-9).

func (*ManageFavoritesUseCase) TagFavorite

func (uc *ManageFavoritesUseCase) TagFavorite(ctx context.Context, favID entity.FavoriteID, tagID entity.TagID) error

TagFavorite assigns a tag to a favorite.

func (*ManageFavoritesUseCase) UntagFavorite

func (uc *ManageFavoritesUseCase) UntagFavorite(ctx context.Context, favID entity.FavoriteID, tagID entity.TagID) error

UntagFavorite removes a tag from a favorite.

func (*ManageFavoritesUseCase) Update

Update modifies a favorite's metadata.

func (*ManageFavoritesUseCase) UpdateFolder

func (uc *ManageFavoritesUseCase) UpdateFolder(ctx context.Context, id entity.FolderID, name, icon string) error

UpdateFolder updates a folder's name and icon.

func (*ManageFavoritesUseCase) UpdateTag

func (uc *ManageFavoritesUseCase) UpdateTag(ctx context.Context, id entity.TagID, name, color string) error

UpdateTag updates a tag's name and color.

type ManagePanesUseCase

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

ManagePanesUseCase handles pane tree operations.

func NewManagePanesUseCase

func NewManagePanesUseCase(idGenerator IDGenerator) *ManagePanesUseCase

NewManagePanesUseCase creates a new pane management use case.

func (*ManagePanesUseCase) AddToStack

func (uc *ManagePanesUseCase) AddToStack(
	ctx context.Context,
	ws *entity.Workspace,
	stackNode *entity.PaneNode,
	pane *entity.Pane,
) (*AddToStackOutput, error)

AddToStack adds a new pane to an existing stack. Optionally pass a pre-created pane, or nil to create a new one.

func (*ManagePanesUseCase) Close

Close removes a pane and promotes its sibling. Returns the sibling node that was promoted, or nil if this was the last pane.

func (*ManagePanesUseCase) CountPanes

func (uc *ManagePanesUseCase) CountPanes(ws *entity.Workspace) int

CountPanes returns the number of panes in a workspace.

func (*ManagePanesUseCase) CreateStack

func (uc *ManagePanesUseCase) CreateStack(
	ctx context.Context,
	ws *entity.Workspace,
	paneNode *entity.PaneNode,
) (*CreateStackOutput, error)

CreateStack converts a pane into a stacked container and adds a new pane. The original pane becomes the first child, a new pane becomes the second child. Returns the stack node and the new pane node for UI operations.

Domain tree transformation:

Before: parent -> targetNode (leaf with pane)
After:  parent -> targetNode (stack) -> [originalChild (leaf), newChild (leaf)]

The targetNode keeps its ID but becomes a stack container. This allows the UI layer to update widget mappings incrementally.

func (*ManagePanesUseCase) Focus

func (uc *ManagePanesUseCase) Focus(ctx context.Context, ws *entity.Workspace, paneID entity.PaneID) error

Focus sets the active pane in the workspace.

func (*ManagePanesUseCase) GetAllPanes

func (uc *ManagePanesUseCase) GetAllPanes(ws *entity.Workspace) []*entity.Pane

GetAllPanes returns all leaf panes in a workspace.

func (*ManagePanesUseCase) NavigateFocus

func (uc *ManagePanesUseCase) NavigateFocus(
	ctx context.Context,
	ws *entity.Workspace,
	direction NavigateDirection,
) (*entity.PaneNode, error)

NavigateFocus moves focus to an adjacent pane. Returns the newly focused pane, or nil if navigation not possible.

func (*ManagePanesUseCase) NavigateFocusGeometric

func (uc *ManagePanesUseCase) NavigateFocusGeometric(
	ctx context.Context,
	input GeometricNavigationInput,
) (*GeometricNavigationOutput, error)

NavigateFocusGeometric finds the nearest pane in the given direction using geometry. Algorithm:

  1. Get center of active pane
  2. Filter candidates that are in the direction (dx < 0 for Left, etc.)
  3. Score by: primary_distance * 1000 + perpendicular_distance
  4. Return lowest scoring candidate

func (*ManagePanesUseCase) NavigateStack

func (uc *ManagePanesUseCase) NavigateStack(
	ctx context.Context,
	stackNode *entity.PaneNode,
	direction NavigateDirection,
) (*entity.Pane, error)

NavigateStack cycles through stacked panes. direction: NavUp for previous, NavDown for next.

func (*ManagePanesUseCase) RemoveFromStack

func (uc *ManagePanesUseCase) RemoveFromStack(ctx context.Context, stackNode *entity.PaneNode, paneID entity.PaneID) error

RemoveFromStack removes a pane from a stack. If only one pane remains, the stack is dissolved.

func (*ManagePanesUseCase) Split

Split creates a new pane adjacent to the target pane.

type ManageSessionUseCase

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

func NewManageSessionUseCase

func NewManageSessionUseCase(sessionRepo repository.SessionRepository, loggerPort port.SessionLogger) *ManageSessionUseCase

func (*ManageSessionUseCase) EndSession

func (uc *ManageSessionUseCase) EndSession(ctx context.Context, sessionID entity.SessionID, endedAt time.Time) error

func (*ManageSessionUseCase) GetActiveSession

func (uc *ManageSessionUseCase) GetActiveSession(ctx context.Context) (*entity.Session, error)

func (*ManageSessionUseCase) GetRecentSessions

func (uc *ManageSessionUseCase) GetRecentSessions(ctx context.Context, limit int) ([]*entity.Session, error)

func (*ManageSessionUseCase) StartSession

type ManageTabsUseCase

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

ManageTabsUseCase handles tab lifecycle operations.

func NewManageTabsUseCase

func NewManageTabsUseCase(idGenerator IDGenerator) *ManageTabsUseCase

NewManageTabsUseCase creates a new tab management use case.

func (*ManageTabsUseCase) Close

func (uc *ManageTabsUseCase) Close(ctx context.Context, tabs *entity.TabList, tabID entity.TabID) (wasLast bool, err error)

Close removes a tab from the list. Returns true if this was the last tab (caller should handle app exit).

func (*ManageTabsUseCase) Create

Create creates a new tab with a workspace and initial pane.

func (*ManageTabsUseCase) CreateWithPane

func (uc *ManageTabsUseCase) CreateWithPane(ctx context.Context, input CreateTabWithPaneInput) (*CreateTabOutput, error)

CreateWithPane creates a new tab using a pre-existing pane. This is used for tabbed popup behavior where the popup pane is already created.

func (*ManageTabsUseCase) GetNext

func (uc *ManageTabsUseCase) GetNext(tabs *entity.TabList, direction int) entity.TabID

GetNext returns the next tab ID in the given direction. direction: 1 for next, -1 for previous.

func (*ManageTabsUseCase) Move

func (uc *ManageTabsUseCase) Move(ctx context.Context, tabs *entity.TabList, tabID entity.TabID, newPosition int) error

Move repositions a tab within the tab bar.

func (*ManageTabsUseCase) Pin

func (uc *ManageTabsUseCase) Pin(ctx context.Context, tabs *entity.TabList, tabID entity.TabID, pinned bool) error

Pin toggles the pinned state of a tab.

func (*ManageTabsUseCase) Rename

func (uc *ManageTabsUseCase) Rename(ctx context.Context, tabs *entity.TabList, tabID entity.TabID, name string) error

Rename changes a tab's custom name.

func (*ManageTabsUseCase) Switch

func (uc *ManageTabsUseCase) Switch(ctx context.Context, tabs *entity.TabList, tabID entity.TabID) error

Switch changes the active tab.

func (*ManageTabsUseCase) SwitchByIndex

func (uc *ManageTabsUseCase) SwitchByIndex(ctx context.Context, tabs *entity.TabList, index int) error

SwitchByIndex switches to tab at the given index (0-based).

func (*ManageTabsUseCase) SwitchNext

func (uc *ManageTabsUseCase) SwitchNext(ctx context.Context, tabs *entity.TabList) error

SwitchNext switches to the next tab (wraps around).

func (*ManageTabsUseCase) SwitchPrevious

func (uc *ManageTabsUseCase) SwitchPrevious(ctx context.Context, tabs *entity.TabList) error

SwitchPrevious switches to the previous tab (wraps around).

func (*ManageTabsUseCase) SwitchToLastActive

func (uc *ManageTabsUseCase) SwitchToLastActive(ctx context.Context, tabs *entity.TabList) error

SwitchToLastActive switches to the previously active tab (Alt+Tab style).

type ManageZoomUseCase

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

ManageZoomUseCase handles per-domain zoom level operations. It uses an LRU cache to avoid database queries on every navigation.

func NewManageZoomUseCase

func NewManageZoomUseCase(
	zoomRepo repository.ZoomRepository,
	defaultZoom float64,
	cache port.Cache[string, *entity.ZoomLevel],
) *ManageZoomUseCase

NewManageZoomUseCase creates a new zoom management use case. defaultZoom is the zoom level to use when resetting (typically from config). cache is an LRU cache for zoom levels to avoid database queries on repeat visits.

func (*ManageZoomUseCase) ApplyToWebView

func (uc *ManageZoomUseCase) ApplyToWebView(ctx context.Context, webview port.WebView, domain string) error

ApplyToWebView loads the saved zoom level and applies it to a webview.

func (*ManageZoomUseCase) DefaultZoom

func (uc *ManageZoomUseCase) DefaultZoom() float64

DefaultZoom returns the configured default zoom level.

func (*ManageZoomUseCase) GetAll

func (uc *ManageZoomUseCase) GetAll(ctx context.Context) ([]*entity.ZoomLevel, error)

GetAll retrieves all saved zoom levels.

func (*ManageZoomUseCase) GetZoom

func (uc *ManageZoomUseCase) GetZoom(ctx context.Context, domain string) (*entity.ZoomLevel, error)

GetZoom retrieves the zoom level for a domain. Returns the configured default zoom level if none is set. Uses LRU cache to avoid database queries on repeat visits.

func (*ManageZoomUseCase) ResetZoom

func (uc *ManageZoomUseCase) ResetZoom(ctx context.Context, domain string) error

ResetZoom removes the custom zoom level for a domain.

func (*ManageZoomUseCase) SetZoom

func (uc *ManageZoomUseCase) SetZoom(ctx context.Context, domain string, factor float64) error

SetZoom saves a zoom level for a domain.

func (*ManageZoomUseCase) ZoomIn

func (uc *ManageZoomUseCase) ZoomIn(ctx context.Context, domain string, current float64) (*entity.ZoomLevel, error)

ZoomIn increases the zoom level by one step (0.1).

func (*ManageZoomUseCase) ZoomOut

func (uc *ManageZoomUseCase) ZoomOut(ctx context.Context, domain string, current float64) (*entity.ZoomLevel, error)

ZoomOut decreases the zoom level by one step (0.1).

type NavigateDirection string

NavigateDirection indicates the direction for focus navigation.

const (
	NavLeft  NavigateDirection = "left"
	NavRight NavigateDirection = "right"
	NavUp    NavigateDirection = "up"
	NavDown  NavigateDirection = "down"
)
type NavigateInput struct {
	URL     string
	PaneID  string
	WebView port.WebView
}

NavigateInput contains parameters for navigation.

type NavigateOutput struct {
	AppliedZoom float64
}

NavigateOutput contains the result of navigation.

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

NavigateUseCase handles URL navigation with history recording and zoom application.

func NewNavigateUseCase

func NewNavigateUseCase(
	historyRepo repository.HistoryRepository,
	zoomRepo repository.ZoomRepository,
	defaultZoom float64,
) *NavigateUseCase

NewNavigateUseCase creates a new navigation use case. defaultZoom is the zoom level to use when no per-domain zoom is saved (typically from config).

func (uc *NavigateUseCase) Close()

Close shuts down the background history worker and drains any pending records. This should be called when the application is shutting down.

func (uc *NavigateUseCase) Execute(ctx context.Context, input NavigateInput) (*NavigateOutput, error)

Execute navigates to a URL and records history. Zoom is applied later via LoadCommitted event in ContentCoordinator.

func (uc *NavigateUseCase) GoBack(ctx context.Context, webview port.WebView) error

GoBack navigates back in history.

func (uc *NavigateUseCase) GoForward(ctx context.Context, webview port.WebView) error

GoForward navigates forward in history.

func (uc *NavigateUseCase) RecordHistory(ctx context.Context, url string)

RecordHistory queues a history entry for async recording. This is non-blocking to avoid SQLite I/O on the GTK main thread. Should be called on LoadCommitted when URI is guaranteed correct.

func (uc *NavigateUseCase) Reload(ctx context.Context, webview port.WebView, bypassCache bool) error

Reload reloads the current page.

func (uc *NavigateUseCase) Stop(ctx context.Context, webview port.WebView) error

Stop stops the current page load.

func (uc *NavigateUseCase) UpdateHistoryTitle(ctx context.Context, url, title string) error

UpdateHistoryTitle updates the title of a history entry after page load.

type PrepareWebUIThemeInput

type PrepareWebUIThemeInput struct {
	// CSSVars is the CSS custom property declarations to inject.
	// Should be generated from palette.ToWebCSSVars().
	CSSVars string
}

PrepareWebUIThemeInput contains parameters for theme preparation.

type PrepareWebUIThemeUseCase

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

PrepareWebUIThemeUseCase handles theme CSS injection for internal web pages.

func NewPrepareWebUIThemeUseCase

func NewPrepareWebUIThemeUseCase(injector port.ContentInjector) *PrepareWebUIThemeUseCase

NewPrepareWebUIThemeUseCase creates a new theme preparation use case.

func (*PrepareWebUIThemeUseCase) Execute

Execute injects theme CSS variables into the web view.

type PurgeDataUseCase

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

PurgeDataUseCase handles discovering and purging application data.

func NewPurgeDataUseCase

func NewPurgeDataUseCase(fs port.FileSystem, xdg port.XDGPaths, desktop port.DesktopIntegration) *PurgeDataUseCase

NewPurgeDataUseCase creates a new PurgeDataUseCase.

func (*PurgeDataUseCase) Execute

func (uc *PurgeDataUseCase) Execute(ctx context.Context, input PurgeInput) (*PurgeOutput, error)

Execute purges the selected target types. Continues on errors, collecting all results.

func (*PurgeDataUseCase) GetPurgeTargets

func (uc *PurgeDataUseCase) GetPurgeTargets(ctx context.Context) ([]entity.PurgeTarget, error)

GetPurgeTargets returns all available purge targets with their current state.

func (*PurgeDataUseCase) PurgeAll

func (uc *PurgeDataUseCase) PurgeAll(ctx context.Context) (*PurgeOutput, error)

PurgeAll purges all existing targets (for --force mode).

type PurgeInput

type PurgeInput struct {
	TargetTypes []entity.PurgeTargetType
}

PurgeInput specifies which target types to purge.

type PurgeOutput

type PurgeOutput struct {
	Results      []entity.PurgeResult
	TotalSize    int64
	SuccessCount int
	FailureCount int
}

PurgeOutput contains the results of the purge operation.

type RemoveDesktopOutput

type RemoveDesktopOutput struct {
	WasDesktopInstalled bool
	WasIconInstalled    bool
	WasDefault          bool
	RemovedDesktopPath  string
	RemovedIconPath     string
}

RemoveDesktopOutput contains the result of the remove operation.

type RemoveDesktopUseCase

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

RemoveDesktopUseCase removes desktop integration files.

func NewRemoveDesktopUseCase

func NewRemoveDesktopUseCase(desktop port.DesktopIntegration) *RemoveDesktopUseCase

NewRemoveDesktopUseCase creates a new RemoveDesktopUseCase.

func (*RemoveDesktopUseCase) Execute

Execute removes desktop integration.

type RunMediaDiagnosticsInput

type RunMediaDiagnosticsInput struct{}

type RunMediaDiagnosticsOutput

type RunMediaDiagnosticsOutput struct {
	GStreamerAvailable bool
	HasVAPlugin        bool
	HasVAAPIPlugin     bool
	HasNVCodecPlugin   bool

	AV1Decoders  []string
	H264Decoders []string
	H265Decoders []string
	VP9Decoders  []string

	VAAPIAvailable bool
	VAAPIDriver    string
	VAAPIVersion   string

	HWAccelAvailable bool
	AV1HWAvailable   bool
	Warnings         []string
}

type RunMediaDiagnosticsUseCase

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

RunMediaDiagnosticsUseCase retrieves detailed media playback diagnostics.

func NewRunMediaDiagnosticsUseCase

func NewRunMediaDiagnosticsUseCase(diagnostics port.MediaDiagnostics) *RunMediaDiagnosticsUseCase

func (*RunMediaDiagnosticsUseCase) Execute

type RuntimeDependencyID

type RuntimeDependencyID string
const (
	RuntimeDependencyGTK4      RuntimeDependencyID = "gtk4"
	RuntimeDependencyWebKitGTK RuntimeDependencyID = "webkitgtk-6.0"
)

type RuntimeDependencyStatus

type RuntimeDependencyStatus struct {
	ID            RuntimeDependencyID
	PkgConfigName string
	DisplayName   string

	Installed bool
	Version   string

	RequiredVersion  string
	MeetsRequirement bool

	Error string
}

RuntimeDependencyStatus contains the result of checking a runtime dependency.

type SaveWebUIConfigUseCase

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

func NewSaveWebUIConfigUseCase

func NewSaveWebUIConfigUseCase(saver port.WebUIConfigSaver) *SaveWebUIConfigUseCase

func (*SaveWebUIConfigUseCase) Execute

type SearchHistoryUseCase

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

SearchHistoryUseCase handles history search and retrieval operations.

func NewSearchHistoryUseCase

func NewSearchHistoryUseCase(historyRepo repository.HistoryRepository) *SearchHistoryUseCase

NewSearchHistoryUseCase creates a new history search use case.

func (*SearchHistoryUseCase) ClearAll

func (uc *SearchHistoryUseCase) ClearAll(ctx context.Context) error

ClearAll deletes all history entries.

func (*SearchHistoryUseCase) ClearOlderThan

func (uc *SearchHistoryUseCase) ClearOlderThan(ctx context.Context, before time.Time) error

ClearOlderThan deletes history entries older than the specified time.

func (*SearchHistoryUseCase) Delete

func (uc *SearchHistoryUseCase) Delete(ctx context.Context, id int64) error

Delete removes a single history entry by ID.

func (*SearchHistoryUseCase) DeleteByDomain

func (uc *SearchHistoryUseCase) DeleteByDomain(ctx context.Context, domain string) error

DeleteByDomain removes all history entries for a domain.

func (*SearchHistoryUseCase) FindByURL

func (uc *SearchHistoryUseCase) FindByURL(ctx context.Context, url string) (*entity.HistoryEntry, error)

FindByURL retrieves a history entry by its URL.

func (*SearchHistoryUseCase) GetAnalytics

GetAnalytics retrieves aggregated history analytics for the homepage.

func (*SearchHistoryUseCase) GetDomainStats

func (uc *SearchHistoryUseCase) GetDomainStats(ctx context.Context, limit int) ([]*entity.DomainStat, error)

GetDomainStats retrieves per-domain visit statistics.

func (*SearchHistoryUseCase) GetRecent

func (uc *SearchHistoryUseCase) GetRecent(ctx context.Context, limit, offset int) ([]*entity.HistoryEntry, error)

GetRecent retrieves recent history entries with pagination.

func (*SearchHistoryUseCase) Search

Search performs a full-text search on history entries using SQLite FTS5. Returns only entries that actually match the query terms.

type SearchInput

type SearchInput struct {
	Query string
	Limit int
}

SearchInput contains search parameters.

type SearchOutput

type SearchOutput struct {
	Matches []entity.HistoryMatch
}

SearchOutput contains search results.

type SetDefaultBrowserUseCase

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

SetDefaultBrowserUseCase sets dumber as the default web browser.

func NewSetDefaultBrowserUseCase

func NewSetDefaultBrowserUseCase(desktop port.DesktopIntegration) *SetDefaultBrowserUseCase

NewSetDefaultBrowserUseCase creates a new SetDefaultBrowserUseCase.

func (*SetDefaultBrowserUseCase) Execute

Execute sets dumber as the default browser.

type SetDefaultOutput

type SetDefaultOutput struct {
	WasAlreadyDefault bool
}

SetDefaultOutput contains the result of the set-default operation.

type SplitDirection

type SplitDirection string

SplitDirection indicates the direction of a pane split.

const (
	SplitLeft  SplitDirection = "left"
	SplitRight SplitDirection = "right"
	SplitUp    SplitDirection = "up"
	SplitDown  SplitDirection = "down"
)

type SplitPaneInput

type SplitPaneInput struct {
	Workspace  *entity.Workspace
	TargetPane *entity.PaneNode
	Direction  SplitDirection
	NewPane    *entity.Pane // Optional: existing pane to insert (for popups)
	InitialURL string       // URL for new pane (default: about:blank)
}

SplitPaneInput contains parameters for splitting a pane.

type SplitPaneOutput

type SplitPaneOutput struct {
	NewPaneNode *entity.PaneNode
	ParentNode  *entity.PaneNode // New parent container
	SplitRatio  float64          // Always 0.5 for new splits
}

SplitPaneOutput contains the result of a split operation.

type StartSessionInput

type StartSessionInput struct {
	Type      entity.SessionType
	SessionID entity.SessionID
	Now       time.Time
	LogConfig port.SessionLogConfig
}

type StartSessionOutput

type StartSessionOutput struct {
	Session    *entity.Session
	Logger     zerolog.Logger
	LogCleanup func()
}

Jump to

Keyboard shortcuts

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