usecase

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 20 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 use cases that orchestrate domain logic.

Package usecase contains application business logic.

Index

Constants

View Source
const LongPressDelay = 400 * time.Millisecond

LongPressDelay is the duration a key must be held to trigger the accent picker.

Variables

View Source
var (
	ErrCannotDeleteCurrentSession = errors.New("cannot delete current session")
	ErrCannotDeleteActiveSession  = errors.New("cannot delete active session")
)

DeleteSessionUseCase errors.

View Source
var ErrNothingToResize = errors.New("nothing to resize")
View Source
var ErrSessionNotFound = errors.New("session not found")

ErrSessionNotFound is returned when a session state cannot be found.

View Source
var ErrVersionMismatch = errors.New("session state version mismatch")

ErrVersionMismatch is returned when the session state version is incompatible.

Functions

func ExtractDomain

func ExtractDomain(rawURL string) (string, error)

ExtractDomain extracts the host from a URL string.

func GetRelativeTime added in v0.21.0

func GetRelativeTime(t time.Time) string

GetRelativeTime returns a human-readable relative time 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 ApplyUpdateInput added in v0.21.0

type ApplyUpdateInput struct {
	// DownloadURL is the URL to download the update from.
	DownloadURL string
}

ApplyUpdateInput holds the input for the apply update use case.

type ApplyUpdateOutput added in v0.21.0

type ApplyUpdateOutput struct {
	// Status is the current update status.
	Status entity.UpdateStatus
	// Message is a human-readable status message.
	Message string
	// StagedPath is the path to the staged binary (if status is Ready).
	StagedPath string
}

ApplyUpdateOutput holds the result of the update application.

type ApplyUpdateUseCase added in v0.21.0

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

ApplyUpdateUseCase downloads and stages updates for application on exit.

func NewApplyUpdateUseCase added in v0.21.0

func NewApplyUpdateUseCase(
	downloader port.UpdateDownloader,
	applier port.UpdateApplier,
	cacheDir string,
) *ApplyUpdateUseCase

NewApplyUpdateUseCase creates a new apply update use case.

func (*ApplyUpdateUseCase) ClearPendingUpdate added in v0.21.0

func (uc *ApplyUpdateUseCase) ClearPendingUpdate(ctx context.Context) error

ClearPendingUpdate removes any staged update.

func (*ApplyUpdateUseCase) Execute added in v0.21.0

Execute downloads and stages the update for application on exit.

func (*ApplyUpdateUseCase) FinalizeOnExit added in v0.21.0

func (uc *ApplyUpdateUseCase) FinalizeOnExit(ctx context.Context) error

FinalizeOnExit applies the staged update during shutdown. This should be called from the app's shutdown handler.

func (*ApplyUpdateUseCase) HasPendingUpdate added in v0.21.0

func (uc *ApplyUpdateUseCase) HasPendingUpdate(ctx context.Context) bool

HasPendingUpdate checks if there's an update waiting to be applied on exit.

type BangSuggestion added in v0.22.0

type BangSuggestion struct {
	Key         string
	Description string
}

BangSuggestion represents a configured bang shortcut for display.

type BuildNavigationTextInput added in v0.22.0

type BuildNavigationTextInput struct {
	EntryText string // e.g., "!GH dumber"
}

BuildNavigationTextInput contains parameters for building navigation text.

type BuildNavigationTextOutput added in v0.22.0

type BuildNavigationTextOutput struct {
	Text  string // Normalized text (e.g., "!gh dumber") or empty if invalid
	Valid bool   // Whether the entry text represents a valid bang navigation
}

BuildNavigationTextOutput contains the normalized navigation text.

type CheckConfigMigrationInput added in v0.22.0

type CheckConfigMigrationInput struct{}

CheckConfigMigrationInput holds the input for checking config migration.

type CheckConfigMigrationOutput added in v0.22.0

type CheckConfigMigrationOutput struct {
	// NeedsMigration is true if there are missing keys.
	NeedsMigration bool
	// MissingKeys contains info about each missing key.
	MissingKeys []port.KeyInfo
	// ConfigFile is the path to the config file.
	ConfigFile string
}

CheckConfigMigrationOutput holds the result of the migration check.

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 CheckUpdateInput added in v0.21.0

type CheckUpdateInput struct{}

CheckUpdateInput holds the input for the check update use case.

type CheckUpdateOutput added in v0.21.0

type CheckUpdateOutput struct {
	// UpdateAvailable is true if a newer version exists.
	UpdateAvailable bool
	// CanAutoUpdate is true if the binary is writable and auto-update is possible.
	CanAutoUpdate bool
	// CurrentVersion is the version of the running binary.
	CurrentVersion string
	// LatestVersion is the latest available version.
	LatestVersion string
	// ReleaseURL is the URL to the GitHub release page.
	ReleaseURL string
	// DownloadURL is the direct download URL for the archive.
	DownloadURL string
}

CheckUpdateOutput holds the result of the update check.

type CheckUpdateUseCase added in v0.21.0

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

CheckUpdateUseCase checks for available updates.

func NewCheckUpdateUseCase added in v0.21.0

func NewCheckUpdateUseCase(
	checker port.UpdateChecker,
	applier port.UpdateApplier,
	buildInfo build.Info,
) *CheckUpdateUseCase

NewCheckUpdateUseCase creates a new check update use case.

func (*CheckUpdateUseCase) Execute added in v0.21.0

Execute checks for available updates.

type CleanupSessionsInput added in v0.21.0

type CleanupSessionsInput struct {
	// MaxExitedSessions is the maximum number of exited sessions to keep.
	// Sessions beyond this count will be deleted (oldest first).
	MaxExitedSessions int

	// MaxExitedSessionAgeDays is the maximum age in days for exited sessions.
	// Sessions older than this will be deleted.
	// A value of 0 disables age-based cleanup.
	MaxExitedSessionAgeDays int
}

CleanupSessionsInput contains the cleanup configuration.

type CleanupSessionsOutput added in v0.21.0

type CleanupSessionsOutput struct {
	// DeletedByAge is the number of sessions deleted due to age.
	DeletedByAge int64

	// DeletedByCount is the number of sessions deleted due to count limit.
	DeletedByCount int64

	// TotalDeleted is the total number of sessions deleted.
	TotalDeleted int64
}

CleanupSessionsOutput contains the cleanup results.

type CleanupSessionsUseCase added in v0.21.0

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

CleanupSessionsUseCase handles automatic cleanup of old exited sessions.

func NewCleanupSessionsUseCase added in v0.21.0

func NewCleanupSessionsUseCase(sessionRepo repository.SessionRepository) *CleanupSessionsUseCase

NewCleanupSessionsUseCase creates a new CleanupSessionsUseCase.

func (*CleanupSessionsUseCase) Execute added in v0.21.0

Execute cleans up old exited sessions based on the provided configuration. It first deletes sessions older than MaxExitedSessionAgeDays, then enforces the MaxExitedSessions count limit.

type ConsumeOrExpelDirection added in v0.21.0

type ConsumeOrExpelDirection string
const (
	ConsumeOrExpelLeft  ConsumeOrExpelDirection = "left"
	ConsumeOrExpelRight ConsumeOrExpelDirection = "right"
	ConsumeOrExpelUp    ConsumeOrExpelDirection = "up"
	ConsumeOrExpelDown  ConsumeOrExpelDirection = "down"
)

type ConsumeOrExpelResult added in v0.21.0

type ConsumeOrExpelResult struct {
	Action       string // "consumed", "expelled", or "none"
	ErrorMessage string
}

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 DeleteSessionInput added in v0.21.0

type DeleteSessionInput struct {
	SessionID        entity.SessionID
	CurrentSessionID entity.SessionID
}

DeleteSessionInput contains the parameters for session deletion.

type DeleteSessionUseCase added in v0.21.0

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

DeleteSessionUseCase handles session deletion with proper validation.

func NewDeleteSessionUseCase added in v0.21.0

func NewDeleteSessionUseCase(
	stateRepo repository.SessionStateRepository,
	sessionRepo repository.SessionRepository,
	lockDir string,
) *DeleteSessionUseCase

NewDeleteSessionUseCase creates a new DeleteSessionUseCase.

func (*DeleteSessionUseCase) Execute added in v0.21.0

Execute deletes a session and its state snapshot. It validates that the session is not current or active before deletion.

type DetectBangKeyInput added in v0.22.0

type DetectBangKeyInput struct {
	Query string // e.g., "!gh query"
}

DetectBangKeyInput contains parameters for detecting a completed bang key.

type DetectBangKeyOutput added in v0.22.0

type DetectBangKeyOutput struct {
	Key         string // The matched key (empty if not found)
	Description string // Description of the matched shortcut
}

DetectBangKeyOutput contains the detected bang key if found.

type DetectChangesInput added in v0.22.0

type DetectChangesInput struct{}

DetectChangesInput holds the input for detecting config changes.

type DetectChangesOutput added in v0.22.0

type DetectChangesOutput struct {
	// HasChanges is true if any changes were detected.
	HasChanges bool
	// Changes contains all detected changes.
	Changes []port.KeyChange
	// DiffText is a formatted diff-like string representation.
	DiffText string
}

DetectChangesOutput holds the result of change detection.

type FilterBangsInput added in v0.22.0

type FilterBangsInput struct {
	Query string // e.g., "!" or "!g" or "!g query"
}

FilterBangsInput contains parameters for filtering bang suggestions.

type FilterBangsOutput added in v0.22.0

type FilterBangsOutput struct {
	Suggestions []BangSuggestion
}

FilterBangsOutput contains filtered bang suggestions.

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 GetConfigSchemaInput added in v0.22.0

type GetConfigSchemaInput struct {
}

GetConfigSchemaInput contains input parameters for schema retrieval.

type GetConfigSchemaOutput added in v0.22.0

type GetConfigSchemaOutput struct {
	Keys []entity.ConfigKeyInfo
}

GetConfigSchemaOutput contains the schema information.

type GetConfigSchemaUseCase added in v0.22.0

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

GetConfigSchemaUseCase retrieves configuration schema information.

func NewGetConfigSchemaUseCase added in v0.22.0

func NewGetConfigSchemaUseCase(provider port.ConfigSchemaProvider) *GetConfigSchemaUseCase

NewGetConfigSchemaUseCase creates a new GetConfigSchemaUseCase.

func (*GetConfigSchemaUseCase) Execute added in v0.22.0

Execute retrieves all configuration keys with their metadata.

type GetLastRestorableSessionInput added in v0.21.0

type GetLastRestorableSessionInput struct {
	// ExcludeSessionID is the current session ID to exclude from results.
	ExcludeSessionID entity.SessionID
}

GetLastRestorableSessionInput contains the parameters for finding a restorable session.

type GetLastRestorableSessionOutput added in v0.21.0

type GetLastRestorableSessionOutput struct {
	// SessionID is the ID of the restorable session, or empty if none found.
	SessionID entity.SessionID
	// State is the session state to restore, or nil if none found.
	State *entity.SessionState
}

GetLastRestorableSessionOutput contains the found restorable session, if any.

type GetLastRestorableSessionUseCase added in v0.21.0

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

GetLastRestorableSessionUseCase finds the most recent session that can be auto-restored. A session is restorable if:

  • It is not the current session
  • It is not actively running (has ended or crashed without lock file)
  • It has a valid snapshot with at least one tab

func NewGetLastRestorableSessionUseCase added in v0.21.0

func NewGetLastRestorableSessionUseCase(
	sessionRepo repository.SessionRepository,
	stateRepo repository.SessionStateRepository,
	lockDir string,
) *GetLastRestorableSessionUseCase

NewGetLastRestorableSessionUseCase creates a new GetLastRestorableSessionUseCase.

func (*GetLastRestorableSessionUseCase) Execute added in v0.21.0

Execute finds the most recent restorable session. Returns an empty output (not an error) if no restorable session is found.

type IDGenerator

type IDGenerator func() string

IDGenerator is a function type for generating unique IDs.

type InsertAccentUseCase added in v0.23.0

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

InsertAccentUseCase handles long-press detection and accent selection. When a key with accent variants is held for 400ms, it shows an accent picker and inserts the selected accent into the focused text input.

func NewInsertAccentUseCase added in v0.23.0

func NewInsertAccentUseCase(
	focusProvider port.FocusedInputProvider,
	accentPicker port.AccentPickerUI,
	showOnMainThread func(fn func()),
) *InsertAccentUseCase

NewInsertAccentUseCase creates a new accent insertion use case. showOnMainThread is a callback that runs a function on the GTK main thread (typically using glib.IdleAdd). This is required because the timer fires on a background goroutine.

func (*InsertAccentUseCase) Cancel added in v0.23.0

func (uc *InsertAccentUseCase) Cancel(ctx context.Context)

Cancel cancels any pending long-press detection and hides the picker.

func (*InsertAccentUseCase) IsPickerVisible added in v0.23.0

func (uc *InsertAccentUseCase) IsPickerVisible() bool

IsPickerVisible returns true if the accent picker is currently visible.

func (*InsertAccentUseCase) OnKeyPressed added in v0.23.0

func (uc *InsertAccentUseCase) OnKeyPressed(ctx context.Context, char rune, shiftHeld bool) bool

OnKeyPressed handles a key press event. Returns true if the use case is handling this key and the caller should suppress it. Note: Due to WebKit's input handling, key suppression may not be fully effective. When the picker shows, we delete any repeated characters that slipped through.

func (*InsertAccentUseCase) OnKeyReleased added in v0.23.0

func (uc *InsertAccentUseCase) OnKeyReleased(ctx context.Context, char rune)

OnKeyReleased handles a key release event. This cancels any pending long-press detection.

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 ListSessionsOutput added in v0.21.0

type ListSessionsOutput struct {
	Sessions []entity.SessionInfo
}

ListSessionsOutput contains the list of sessions with their info.

type ListSessionsUseCase added in v0.21.0

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

ListSessionsUseCase handles listing sessions with their state information.

func NewListSessionsUseCase added in v0.21.0

func NewListSessionsUseCase(
	sessionRepo repository.SessionRepository,
	stateRepo repository.SessionStateRepository,
	lockDir string,
) *ListSessionsUseCase

NewListSessionsUseCase creates a new ListSessionsUseCase.

func (*ListSessionsUseCase) Execute added in v0.21.0

func (uc *ListSessionsUseCase) Execute(ctx context.Context, currentSessionID entity.SessionID, limit int) (*ListSessionsOutput, error)

Execute returns a list of sessions with their state information. Sessions are sorted with active first, then by date (most recent first).

func (*ListSessionsUseCase) GetPurgeableSessions added in v0.21.0

func (uc *ListSessionsUseCase) GetPurgeableSessions(ctx context.Context) (*PurgeableSessionsOutput, error)

GetPurgeableSessions returns all inactive sessions that can be safely deleted. These are sessions that have ended and have no active lock file.

func (*ListSessionsUseCase) GetSessionInfo added in v0.21.0

func (uc *ListSessionsUseCase) GetSessionInfo(
	ctx context.Context,
	sessionID, currentSessionID entity.SessionID,
) (*entity.SessionInfo, error)

GetSessionInfo returns info for a specific session.

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) GetAllURLs added in v0.22.0

func (uc *ManageFavoritesUseCase) GetAllURLs(ctx context.Context) (map[string]struct{}, error)

GetAllURLs returns a set of all favorited URLs for efficient batch lookup.

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) Toggle added in v0.22.0

func (uc *ManageFavoritesUseCase) Toggle(ctx context.Context, url, title string) (*ToggleResult, error)

Toggle adds or removes a URL from favorites based on current state. If the URL is already a favorite, it removes it. Otherwise, it adds it.

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) ApplyFocusChange added in v0.24.0

func (uc *ManagePanesUseCase) ApplyFocusChange(
	ctx context.Context,
	ws *entity.Workspace,
	targetPaneID entity.PaneID,
) (*entity.PaneNode, error)

ApplyFocusChange sets the active pane and updates the stack index if the target pane is in a stack. This is the canonical way to change focus to a pane, ensuring stack state is kept in sync.

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) ConsumeOrExpel added in v0.21.0

func (uc *ManagePanesUseCase) ConsumeOrExpel(
	ctx context.Context,
	ws *entity.Workspace,
	activeNode *entity.PaneNode,
	direction ConsumeOrExpelDirection,
) (*ConsumeOrExpelResult, error)

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. Delegates to ApplyFocusChange to ensure stack index is updated when focusing a stacked pane.

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 active pane rectangle
  2. Filter candidates that are in the direction (dx < 0 for Left, etc.)
  3. Prioritize panes with perpendicular overlap (same row for left/right, same column for up/down)
  4. Score by: overlap_penalty + primary_distance * 1000 + perpendicular_distance
  5. 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) Resize added in v0.21.0

func (uc *ManagePanesUseCase) Resize(
	ctx context.Context,
	ws *entity.Workspace,
	paneNode *entity.PaneNode,
	dir ResizeDirection,
	stepPercent float64,
	minPanePercent float64,
) error

Resize adjusts the nearest applicable split ratio for the given direction. stepPercent is applied per keystroke (e.g. 5.0 means 5%). minPanePercent enforces a minimum size for each side of a split.

func (*ManagePanesUseCase) SetSplitRatio added in v0.21.0

func (uc *ManagePanesUseCase) SetSplitRatio(ctx context.Context, input SetSplitRatioInput) error

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 MigrateConfigInput added in v0.22.0

type MigrateConfigInput struct{}

MigrateConfigInput holds the input for migrating config.

type MigrateConfigOutput added in v0.22.0

type MigrateConfigOutput struct {
	// AddedKeys contains the keys that were added.
	AddedKeys []string
	// ConfigFile is the path to the config file.
	ConfigFile string
}

MigrateConfigOutput holds the result of the migration.

type MigrateConfigUseCase added in v0.22.0

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

MigrateConfigUseCase handles config migration operations.

func NewMigrateConfigUseCase added in v0.22.0

func NewMigrateConfigUseCase(migrator port.ConfigMigrator, diffFormatter port.DiffFormatter) *MigrateConfigUseCase

NewMigrateConfigUseCase creates a new migrate config use case.

func (*MigrateConfigUseCase) Check added in v0.22.0

Check checks if the user config is missing any default keys.

func (*MigrateConfigUseCase) DetectChanges added in v0.22.0

DetectChanges detects all config changes and returns a diff-like output.

func (*MigrateConfigUseCase) Execute added in v0.22.0

Execute adds missing default keys and removes deprecated keys from the user's config file.

type MovePaneToTabInput added in v0.22.0

type MovePaneToTabInput struct {
	TabList      *entity.TabList
	SourceTabID  entity.TabID
	SourcePaneID entity.PaneID
	TargetTabID  entity.TabID // empty means create new tab
}

type MovePaneToTabOutput added in v0.22.0

type MovePaneToTabOutput struct {
	TargetTab       *entity.Tab
	MovedPaneNode   *entity.PaneNode
	SourceTabClosed bool
	NewTabCreated   bool
}

type MovePaneToTabUseCase added in v0.22.0

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

MovePaneToTabUseCase moves a pane from one tab's workspace to another.

It is pure domain manipulation: it depends only on entities and an ID generator.

func NewMovePaneToTabUseCase added in v0.22.0

func NewMovePaneToTabUseCase(idGenerator IDGenerator) *MovePaneToTabUseCase

func (*MovePaneToTabUseCase) Execute added in v0.22.0

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 PurgeableSessionsOutput added in v0.21.0

type PurgeableSessionsOutput struct {
	Sessions  []entity.SessionPurgeItem
	TotalSize int64
}

PurgeableSessionsOutput contains inactive sessions that can be purged.

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 ResizeDirection added in v0.21.0

type ResizeDirection string

ResizeDirection indicates the direction for pane resizing.

const (
	ResizeIncreaseLeft  ResizeDirection = "increase_left"
	ResizeIncreaseRight ResizeDirection = "increase_right"
	ResizeIncreaseUp    ResizeDirection = "increase_up"
	ResizeIncreaseDown  ResizeDirection = "increase_down"

	ResizeDecreaseLeft  ResizeDirection = "decrease_left"
	ResizeDecreaseRight ResizeDirection = "decrease_right"
	ResizeDecreaseUp    ResizeDirection = "decrease_up"
	ResizeDecreaseDown  ResizeDirection = "decrease_down"

	ResizeIncrease ResizeDirection = "increase"
	ResizeDecrease ResizeDirection = "decrease"
)

type RestoreInput added in v0.21.0

type RestoreInput struct {
	SessionID entity.SessionID
}

RestoreInput contains the parameters for restoring a session.

type RestoreOutput added in v0.21.0

type RestoreOutput struct {
	State *entity.SessionState
}

RestoreOutput contains the restored session state.

type RestoreSessionUseCase added in v0.21.0

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

RestoreSessionUseCase handles restoring session state from a snapshot.

func NewRestoreSessionUseCase added in v0.21.0

func NewRestoreSessionUseCase(
	stateRepo repository.SessionStateRepository,
	sessionRepo repository.SessionRepository,
) *RestoreSessionUseCase

NewRestoreSessionUseCase creates a new RestoreSessionUseCase.

func (*RestoreSessionUseCase) DeleteSnapshot added in v0.21.0

func (uc *RestoreSessionUseCase) DeleteSnapshot(ctx context.Context, sessionID entity.SessionID) error

DeleteSnapshot removes a session's snapshot (for cleanup after failed restore or user deletion).

func (*RestoreSessionUseCase) Execute added in v0.21.0

Execute loads and validates a session state for restoration.

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) GetMostVisited added in v0.23.0

func (uc *SearchHistoryUseCase) GetMostVisited(ctx context.Context, days int) ([]*entity.HistoryEntry, error)

GetMostVisited retrieves history entries sorted by visit count within the last N days. If days is 0, returns all history entries sorted by visit count. If days is negative, defaults to 30 days.

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) GetRecentSince added in v0.23.0

func (uc *SearchHistoryUseCase) GetRecentSince(ctx context.Context, days int) ([]*entity.HistoryEntry, error)

GetRecentSince retrieves history entries visited within the last N days. If days is 0, returns all history entries. If days is negative, defaults to 30 days.

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 SearchShortcut added in v0.22.0

type SearchShortcut struct {
	URL         string
	Description string
}

SearchShortcut represents a search shortcut configuration. This is a domain-level type to avoid depending on infrastructure config.

type SearchShortcutsUseCase added in v0.22.0

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

SearchShortcutsUseCase handles bang shortcut filtering and resolution.

func NewSearchShortcutsUseCase added in v0.22.0

func NewSearchShortcutsUseCase(shortcuts map[string]SearchShortcut) *SearchShortcutsUseCase

NewSearchShortcutsUseCase creates a new search shortcuts use case.

func (*SearchShortcutsUseCase) BuildNavigationText added in v0.22.0

BuildNavigationText normalizes a bang query for navigation. Returns the normalized text with the canonical key case.

func (*SearchShortcutsUseCase) DetectBangKey added in v0.22.0

DetectBangKey checks if the query contains a valid, completed bang key. A completed bang key requires "!<key> " with a space after the key.

func (*SearchShortcutsUseCase) FilterBangs added in v0.22.0

FilterBangs returns bang shortcuts matching the query prefix. Query should start with "!". The prefix is extracted before any space.

func (*SearchShortcutsUseCase) GetShortcut added in v0.22.0

func (uc *SearchShortcutsUseCase) GetShortcut(key string) (SearchShortcut, bool)

GetShortcut returns a shortcut by key (case-insensitive).

func (*SearchShortcutsUseCase) ShortcutURLs added in v0.22.0

func (uc *SearchShortcutsUseCase) ShortcutURLs() map[string]string

ShortcutURLs returns a map of shortcut keys to URL templates. This is useful for passing to url.BuildSearchURL.

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 SetSplitRatioInput added in v0.21.0

type SetSplitRatioInput struct {
	Workspace      *entity.Workspace
	SplitNodeID    string
	Ratio          float64
	MinPanePercent float64
}

type SnapshotInput added in v0.21.0

type SnapshotInput struct {
	SessionID entity.SessionID
	TabList   *entity.TabList
}

SnapshotInput contains the parameters for creating a session snapshot.

type SnapshotSessionUseCase added in v0.21.0

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

SnapshotSessionUseCase handles saving session state snapshots.

func NewSnapshotSessionUseCase added in v0.21.0

func NewSnapshotSessionUseCase(stateRepo repository.SessionStateRepository) *SnapshotSessionUseCase

NewSnapshotSessionUseCase creates a new SnapshotSessionUseCase.

func (*SnapshotSessionUseCase) Execute added in v0.21.0

func (uc *SnapshotSessionUseCase) Execute(ctx context.Context, input SnapshotInput) error

Execute creates a snapshot of the current session state and saves it.

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()
}

type ToggleResult added in v0.22.0

type ToggleResult struct {
	Added   bool // true if favorite was added, false if removed
	URL     string
	Title   string
	Message string // User-friendly message
}

ToggleResult indicates the result of a toggle operation.

Jump to

Keyboard shortcuts

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