coordinator

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

NavigationCoordinator handles URL navigation, history, and browser controls.

func NewNavigationCoordinator

func NewNavigationCoordinator(
	ctx context.Context,
	navigateUC *usecase.NavigateUseCase,
	contentCoord *content.Coordinator,
) *NavigationCoordinator

NewNavigationCoordinator creates a new NavigationCoordinator.

func (c *NavigationCoordinator) ActiveWebView(ctx context.Context) port.WebView

ActiveWebView returns the WebView for the active pane (for zoom operations).

func (c *NavigationCoordinator) ClearPaneHistory(paneID entity.PaneID)

ClearPaneHistory clears per-pane navigation history deduplication state.

func (c *NavigationCoordinator) GoBack(ctx context.Context) error

GoBack navigates back in history. Calls webview directly - the webview layer handles SPA navigation via JS fallback.

func (c *NavigationCoordinator) GoForward(ctx context.Context) error

GoForward navigates forward in history. Calls webview directly - the webview layer handles SPA navigation via JS fallback.

func (c *NavigationCoordinator) HardReload(ctx context.Context) error

HardReload reloads the current page bypassing cache.

func (c *NavigationCoordinator) Navigate(ctx context.Context, url string) error

Navigate loads a URL in the active pane using NavigateUseCase. This properly handles history recording and zoom application.

func (c *NavigationCoordinator) NotifyZoomChanged(ctx context.Context, factor float64)

NotifyZoomChanged updates the omnibox zoom indicator.

func (c *NavigationCoordinator) OpenDevTools(ctx context.Context) error

OpenDevTools opens the WebKit inspector for the active WebView.

func (c *NavigationCoordinator) OpenOmnibox(ctx context.Context) error

OpenOmnibox toggles the omnibox visibility.

func (c *NavigationCoordinator) PrintPage(ctx context.Context) error

PrintPage opens the print dialog for the active WebView.

func (c *NavigationCoordinator) RecordHistory(ctx context.Context, paneID entity.PaneID, url string)

RecordHistory records a URL in history on page commit.

func (c *NavigationCoordinator) Reload(ctx context.Context) error

Reload reloads the current page.

func (c *NavigationCoordinator) SetOmniboxProvider(provider OmniboxProvider)

SetOmniboxProvider sets the omnibox provider for toggle/zoom operations.

func (c *NavigationCoordinator) UpdateHistoryTitle(ctx context.Context, paneID entity.PaneID, url, title string)

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

type OmniboxProvider

type OmniboxProvider interface {
	ToggleOmnibox(ctx context.Context)
	UpdateOmniboxZoom(factor float64)
	SetOmniboxOnNavigate(fn func(url string))
}

OmniboxProvider provides access to omnibox operations.

type TabCoordinator

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

TabCoordinator manages tab lifecycle operations.

func NewTabCoordinator

func NewTabCoordinator(ctx context.Context, cfg TabCoordinatorConfig) *TabCoordinator

NewTabCoordinator creates a new TabCoordinator.

func (*TabCoordinator) Close

func (c *TabCoordinator) Close(ctx context.Context) error

Close closes the active tab.

func (*TabCoordinator) Create

func (c *TabCoordinator) Create(ctx context.Context, initialURL string) (*entity.Tab, error)

Create creates a new tab with the given initial URL.

func (*TabCoordinator) CreateWithPane

func (c *TabCoordinator) CreateWithPane(
	ctx context.Context,
	pane *entity.Pane,
	wv port.WebView,
	initialURL string,
) (*entity.Tab, error)

CreateWithPane creates a new tab with a pre-created pane and WebView. This is used for tabbed popup behavior where the popup pane already exists.

func (*TabCoordinator) GetTabBar

func (c *TabCoordinator) GetTabBar() *component.TabBar

GetTabBar returns the tab bar component.

func (*TabCoordinator) SetOnAttachPopupToTab

func (c *TabCoordinator) SetOnAttachPopupToTab(fn func(ctx context.Context, tabID entity.TabID, pane *entity.Pane, wv port.WebView))

SetOnAttachPopupToTab sets the callback for attaching popup WebViews to tabs.

func (*TabCoordinator) SetOnQuit

func (c *TabCoordinator) SetOnQuit(fn func())

SetOnQuit sets the callback for when the last tab is closed.

func (*TabCoordinator) SetOnStateChanged added in v0.21.0

func (c *TabCoordinator) SetOnStateChanged(fn func())

SetOnStateChanged sets the callback for when tab state changes (for session snapshots).

func (*TabCoordinator) SetOnTabCreated

func (c *TabCoordinator) SetOnTabCreated(fn func(ctx context.Context, tab *entity.Tab))

SetOnTabCreated sets the callback for when a tab is created.

func (*TabCoordinator) SetOnTabSwitched

func (c *TabCoordinator) SetOnTabSwitched(fn func(ctx context.Context, tab *entity.Tab))

SetOnTabSwitched sets the callback for when a tab switch occurs. This is used to swap workspace views in the content area.

func (*TabCoordinator) Switch

func (c *TabCoordinator) Switch(ctx context.Context, tabID entity.TabID) error

Switch switches to a specific tab by ID.

func (*TabCoordinator) SwitchByIndex

func (c *TabCoordinator) SwitchByIndex(ctx context.Context, index int) error

SwitchByIndex switches to a tab by 0-based index.

func (*TabCoordinator) SwitchNext

func (c *TabCoordinator) SwitchNext(ctx context.Context) error

SwitchNext switches to the next tab.

func (*TabCoordinator) SwitchPrev

func (c *TabCoordinator) SwitchPrev(ctx context.Context) error

SwitchPrev switches to the previous tab.

func (*TabCoordinator) SwitchToLastActive

func (c *TabCoordinator) SwitchToLastActive(ctx context.Context) error

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

func (*TabCoordinator) UpdateBarVisibility

func (c *TabCoordinator) UpdateBarVisibility(ctx context.Context)

UpdateBarVisibility shows or hides the tab bar based on tab count.

type TabCoordinatorConfig

type TabCoordinatorConfig struct {
	TabsUC                  *usecase.ManageTabsUseCase
	Tabs                    *entity.TabList
	MainWindow              *window.MainWindow
	HideTabBarWhenSingleTab bool
}

TabCoordinatorConfig holds configuration for TabCoordinator.

type UpdateCoordinator added in v0.21.0

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

UpdateCoordinator handles update checking and notification.

func NewUpdateCoordinator added in v0.21.0

func NewUpdateCoordinator(
	checkUC *usecase.CheckUpdateUseCase,
	applyUC *usecase.ApplyUpdateUseCase,
	toaster *component.Toaster,
	enableOnStartup bool,
	autoDownload bool,
) *UpdateCoordinator

NewUpdateCoordinator creates a new update coordinator. enableOnStartup controls whether an update check runs at startup. autoDownload controls whether updates are downloaded automatically in the background.

func (*UpdateCoordinator) CheckOnStartup added in v0.21.0

func (c *UpdateCoordinator) CheckOnStartup(ctx context.Context)

CheckOnStartup triggers an update check if enabled via the enableOnStartup constructor flag.

func (*UpdateCoordinator) FinalizeOnExit added in v0.21.0

func (c *UpdateCoordinator) FinalizeOnExit(ctx context.Context) error

FinalizeOnExit applies a staged update on process exit.

func (*UpdateCoordinator) HasPendingUpdate added in v0.21.0

func (c *UpdateCoordinator) HasPendingUpdate(ctx context.Context) bool

HasPendingUpdate returns true if a downloaded update is waiting to be applied.

func (*UpdateCoordinator) LastCheckResult added in v0.21.0

func (c *UpdateCoordinator) LastCheckResult() *usecase.CheckUpdateOutput

LastCheckResult returns the most recent update check result.

func (*UpdateCoordinator) Status added in v0.21.0

Status returns the current update status.

type WorkspaceCoordinator

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

WorkspaceCoordinator manages pane operations within a workspace.

func NewWorkspaceCoordinator

func NewWorkspaceCoordinator(ctx context.Context, cfg WorkspaceCoordinatorConfig) *WorkspaceCoordinator

NewWorkspaceCoordinator creates a new WorkspaceCoordinator.

func (*WorkspaceCoordinator) ClosePane

func (c *WorkspaceCoordinator) ClosePane(ctx context.Context) error

ClosePane closes the active pane.

func (*WorkspaceCoordinator) ClosePaneByID

func (c *WorkspaceCoordinator) ClosePaneByID(ctx context.Context, paneID entity.PaneID) error

ClosePaneByID closes a specific pane by ID. This is used for closing popup panes when window.close() is called.

func (*WorkspaceCoordinator) ConsumeOrExpelPane added in v0.21.0

func (c *WorkspaceCoordinator) ConsumeOrExpelPane(ctx context.Context, direction usecase.ConsumeOrExpelDirection) error

func (*WorkspaceCoordinator) FocusPane

func (c *WorkspaceCoordinator) FocusPane(ctx context.Context, direction usecase.NavigateDirection) error

FocusPane navigates focus to an adjacent pane.

func (*WorkspaceCoordinator) InsertPopup

InsertPopup inserts a popup pane into the workspace based on the specified behavior. Supports split, stacked, and tabbed behaviors.

func (*WorkspaceCoordinator) NavigateStack

func (c *WorkspaceCoordinator) NavigateStack(ctx context.Context, direction string) error

NavigateStack navigates up or down within a stacked pane container.

func (*WorkspaceCoordinator) Resize added in v0.21.0

Resize updates the active split ratio and applies it to GTK widgets.

func (*WorkspaceCoordinator) SetOnCloseLastPane

func (c *WorkspaceCoordinator) SetOnCloseLastPane(fn func(ctx context.Context) error)

SetOnCloseLastPane sets the callback for when the last pane is closed.

func (*WorkspaceCoordinator) SetOnCreatePopupTab

func (c *WorkspaceCoordinator) SetOnCreatePopupTab(fn func(ctx context.Context, input content.InsertPopupInput) error)

SetOnCreatePopupTab sets the callback for creating popup tabs. This is used when popup behavior is "tabbed".

func (*WorkspaceCoordinator) SetOnPaneClosed added in v0.27.0

func (c *WorkspaceCoordinator) SetOnPaneClosed(fn func(paneID entity.PaneID))

SetOnPaneClosed sets a callback invoked after a pane is successfully closed.

func (*WorkspaceCoordinator) SetOnStateChanged added in v0.21.0

func (c *WorkspaceCoordinator) SetOnStateChanged(fn func())

SetOnStateChanged sets the callback for when workspace state changes (for session snapshots).

func (*WorkspaceCoordinator) SetSplitRatio added in v0.21.0

func (c *WorkspaceCoordinator) SetSplitRatio(ctx context.Context, splitNodeID string, ratio float64) error

func (*WorkspaceCoordinator) SetupStackedPaneCallbacks added in v0.25.0

func (c *WorkspaceCoordinator) SetupStackedPaneCallbacks(ctx context.Context, ws *entity.Workspace, wsView *component.WorkspaceView)

SetupStackedPaneCallbacks sets up title bar click and close callbacks for all stacked panes. This must be called after Rebuild() to restore callbacks on newly created StackedView instances.

func (*WorkspaceCoordinator) ShowToastOnActivePane

func (c *WorkspaceCoordinator) ShowToastOnActivePane(ctx context.Context, message string, level component.ToastLevel)

ShowToastOnActivePane displays a toast notification on the active pane.

func (*WorkspaceCoordinator) ShowZoomToast

func (c *WorkspaceCoordinator) ShowZoomToast(ctx context.Context, zoomPercent int)

ShowZoomToast displays a zoom level toast on the active pane.

func (*WorkspaceCoordinator) Split

Split splits the active pane in the given direction.

func (*WorkspaceCoordinator) StackPane

func (c *WorkspaceCoordinator) StackPane(ctx context.Context) error

StackPane adds a new pane stacked on top of the active pane. Uses CreateStack use case for new stacks, AddToStack for existing stacks.

type WorkspaceCoordinatorConfig

type WorkspaceCoordinatorConfig struct {
	PanesUC              *usecase.ManagePanesUseCase
	FocusMgr             *focus.Manager
	StackedPaneMgr       *component.StackedPaneManager
	WidgetFactory        layout.WidgetFactory
	ContentCoord         *content.Coordinator
	GetActiveWS          func() (*entity.Workspace, *component.WorkspaceView)
	GenerateID           func() string
	NewPaneURL           string
	ResizeStepPercent    float64
	ResizeMinPanePercent float64
}

WorkspaceCoordinatorConfig holds configuration for WorkspaceCoordinator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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