component

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package component provides UI components for the browser.

Package component provides UI components for the browser.

Package component provides reusable GTK UI components.

Package component provides UI components for the browser.

Package component provides UI components for the browser.

Package component provides UI components for the browser.

Package component provides reusable GTK UI components.

Package component provides UI components for the browser.

Package component provides UI components for the browser.

Index

Constants

This section is empty.

Variables

View Source
var DefaultRowHeights = RowHeightDefaults{
	Standard: 50,
	Compact:  28,
	Divider:  30,
}

Package-level defaults for row heights.

View Source
var ErrNilWorkspace = errors.New("workspace is nil")

ErrNilWorkspace is returned when attempting to set a nil workspace.

View Source
var ErrPaneNotFound = errors.New("pane not found")

ErrPaneNotFound is returned when a pane ID cannot be found.

View Source
var ErrStackNotFound = errors.New("stacked view not found for pane")

ErrStackNotFound is returned when a StackedView cannot be found for a pane.

View Source
var OmniboxListDefaults = ListDisplayDefaults{
	MaxVisibleRows: 10,
	MaxResults:     10,
}

OmniboxListDefaults provides display limits for omnibox modal.

View Source
var OmniboxSizeDefaults = ModalSizeConfig{
	WidthPct:       0.8,
	MaxWidth:       800,
	TopMarginPct:   0.2,
	FallbackWidth:  800,
	FallbackHeight: 600,
}

OmniboxSizeDefaults provides default sizing for omnibox modal.

View Source
var SessionManagerListDefaults = ListDisplayDefaults{
	MaxVisibleRows: 6,
	MaxResults:     50,
}

SessionManagerListDefaults provides display limits for session manager modal.

View Source
var SessionManagerSizeDefaults = ModalSizeConfig{
	WidthPct:       0.6,
	MaxWidth:       600,
	TopMarginPct:   0.15,
	FallbackWidth:  600,
	FallbackHeight: 600,
}

SessionManagerSizeDefaults provides default sizing for session manager modal.

View Source
var TabPickerListDefaults = ListDisplayDefaults{
	MaxVisibleRows: 8,
	MaxResults:     20,
}

TabPickerListDefaults provides display limits for tab picker modal.

View Source
var TabPickerSizeDefaults = ModalSizeConfig{
	WidthPct:       0.6,
	MaxWidth:       600,
	TopMarginPct:   0.15,
	FallbackWidth:  600,
	FallbackHeight: 600,
}

TabPickerSizeDefaults provides default sizing for tab picker modal.

Functions

func CalculateModalDimensions added in v0.21.0

func CalculateModalDimensions(parent layout.OverlayWidget, cfg ModalSizeConfig) (width, marginTop int)

CalculateModalDimensions computes width and top margin based on parent overlay. Returns calculated width and top margin in pixels.

func GetLogoTexture added in v0.22.0

func GetLogoTexture() *gdk.Texture

GetLogoTexture returns a cached GDK texture of the dumber logo. Safe to call from any goroutine; lazily initializes on first call. Returns nil if the logo cannot be loaded.

func MeasureWidgetHeight added in v0.21.0

func MeasureWidgetHeight(widget *gtk.Widget, forWidth int) int

MeasureWidgetHeight returns the natural height of a widget for a given width. Returns 0 if widget is nil or measurement fails.

func ScaleValue added in v0.21.0

func ScaleValue(base int, uiScale float64) int

ScaleValue scales a base pixel value by UI scale factor. Returns the base value if scale is <= 0.

func SetScrolledWindowHeight added in v0.21.0

func SetScrolledWindowHeight(sw *gtk.ScrolledWindow, height int)

SetScrolledWindowHeight safely sets min/max content height on a ScrolledWindow. Resets min to -1 first to avoid GTK assertion (min <= max) when shrinking.

Types

type AccentPicker added in v0.23.0

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

AccentPicker displays an overlay with accent character options. The user can select an accent using: - Left/Right arrow keys to navigate - Number keys 1-9 to select directly - Enter to confirm selection - Escape to cancel

func NewAccentPicker added in v0.23.0

func NewAccentPicker(factory layout.WidgetFactory) *AccentPicker

NewAccentPicker creates a new accent picker component.

func (*AccentPicker) Hide added in v0.23.0

func (ap *AccentPicker) Hide()

Hide hides the accent picker.

func (*AccentPicker) IsVisible added in v0.23.0

func (ap *AccentPicker) IsVisible() bool

IsVisible returns true if the accent picker is currently visible.

func (*AccentPicker) Show added in v0.23.0

func (ap *AccentPicker) Show(accents []rune, selectedCb func(rune), cancelCb func())

Show displays the accent picker with the given accent options.

func (*AccentPicker) Widget added in v0.23.0

func (ap *AccentPicker) Widget() layout.Widget

Widget returns the accent picker's container widget.

type BangSuggestion added in v0.22.0

type BangSuggestion struct {
	Key         string
	Description string
}

BangSuggestion represents a configured bang shortcut. A bang is invoked by typing "!<key>".

type Favorite

type Favorite struct {
	ID         int64
	URL        string
	Title      string
	FaviconURL string
	Position   int
}

Favorite represents a bookmarked URL.

type FindBar

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

FindBar is a compact find-in-page UI overlay.

func NewFindBar

func NewFindBar(ctx context.Context, cfg FindBarConfig) *FindBar

NewFindBar creates a new FindBar component.

func (*FindBar) FindNext

func (fb *FindBar) FindNext()

FindNext moves to the next match.

func (*FindBar) FindPrevious

func (fb *FindBar) FindPrevious()

FindPrevious moves to the previous match.

func (*FindBar) Hide

func (fb *FindBar) Hide()

Hide hides the find bar and clears highlights.

func (*FindBar) IsVisible

func (fb *FindBar) IsVisible() bool

IsVisible returns whether the find bar is visible.

func (*FindBar) SetFindController

func (fb *FindBar) SetFindController(controller port.FindController)

SetFindController attaches the FindController to the use case.

func (*FindBar) Show

func (fb *FindBar) Show()

Show displays the find bar and focuses the entry.

func (*FindBar) WidgetAsLayout

func (fb *FindBar) WidgetAsLayout(factory layout.WidgetFactory) layout.Widget

WidgetAsLayout returns the find bar's outer widget as a layout.Widget.

type FindBarConfig

type FindBarConfig struct {
	OnClose           func()
	GetFindController func(paneID entity.PaneID) port.FindController
	OnFocusIn         func(entry *gtk.SearchEntry) // Callback when entry gains focus (for accent picker)
	OnFocusOut        func()                       // Callback when entry loses focus
}

FindBarConfig holds configuration for creating a FindBar.

type LinkStatusOverlay added in v0.21.0

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

LinkStatusOverlay displays the destination URL when hovering over links. It appears in the bottom-left corner with a fade-in/fade-out transition.

func NewLinkStatusOverlay added in v0.21.0

func NewLinkStatusOverlay(factory layout.WidgetFactory) *LinkStatusOverlay

NewLinkStatusOverlay creates a new link status overlay component. The overlay is positioned at bottom-left with fade transitions via CSS.

func (*LinkStatusOverlay) Cleanup added in v0.21.0

func (l *LinkStatusOverlay) Cleanup()

Cleanup cancels any pending timers and clears state. Must be called before removing the overlay from the UI.

func (*LinkStatusOverlay) Hide added in v0.21.0

func (l *LinkStatusOverlay) Hide()

Hide manually hides the link status overlay.

func (*LinkStatusOverlay) IsVisible added in v0.21.0

func (l *LinkStatusOverlay) IsVisible() bool

IsVisible returns whether the overlay is currently visible.

func (*LinkStatusOverlay) Show added in v0.21.0

func (l *LinkStatusOverlay) Show(uri string)

Show displays the link status overlay with the given URI. If uri is empty, hides the overlay instead. Uses a small delay to avoid flicker during rapid mouse movement.

func (*LinkStatusOverlay) Widget added in v0.21.0

func (l *LinkStatusOverlay) Widget() layout.Widget

Widget returns the underlying widget for embedding in overlays.

type ListDisplayDefaults added in v0.21.0

type ListDisplayDefaults struct {
	MaxVisibleRows int // Maximum rows visible before scrolling
	MaxResults     int // Maximum results to fetch/display
}

ListDisplayDefaults holds display limits for list-based modals.

type LoadingSkeleton added in v0.22.0

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

LoadingSkeleton displays a themed loading placeholder. It is intended to be embedded as an overlay while primary content is loading. Shows a faded app logo and spinner.

func NewLoadingSkeleton added in v0.22.0

func NewLoadingSkeleton(factory layout.WidgetFactory) *LoadingSkeleton

func (*LoadingSkeleton) SetVisible added in v0.22.0

func (ls *LoadingSkeleton) SetVisible(visible bool)

func (*LoadingSkeleton) Widget added in v0.22.0

func (ls *LoadingSkeleton) Widget() layout.Widget

type ModalSizeConfig added in v0.21.0

type ModalSizeConfig struct {
	WidthPct       float64 // Percentage of parent width (e.g., 0.6)
	MaxWidth       int     // Maximum width in pixels
	TopMarginPct   float64 // Top margin as percentage of parent height
	FallbackWidth  int     // Fallback when parent not allocated
	FallbackHeight int     // Fallback height
}

ModalSizeConfig holds configuration for modal sizing calculations.

type Omnibox

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

Omnibox is the native GTK4 address bar / command palette.

func NewOmnibox

func NewOmnibox(ctx context.Context, cfg OmniboxConfig) *Omnibox

NewOmnibox creates a new native GTK4 omnibox widget. Call SetParentOverlay() before Show() to set the parent for sizing.

func (*Omnibox) Destroy

func (o *Omnibox) Destroy()

Destroy cleans up omnibox resources.

func (*Omnibox) Hide

func (o *Omnibox) Hide(ctx context.Context)

Hide closes the omnibox.

func (*Omnibox) IsVisible

func (o *Omnibox) IsVisible() bool

IsVisible returns whether the omnibox is currently shown.

func (*Omnibox) SetOnClose

func (o *Omnibox) SetOnClose(fn func())

SetOnClose sets the callback for omnibox close events.

func (*Omnibox) SetOnNavigate

func (o *Omnibox) SetOnNavigate(fn func(url string))

SetOnNavigate sets the callback for URL navigation.

func (*Omnibox) SetParentOverlay

func (o *Omnibox) SetParentOverlay(overlay layout.OverlayWidget)

SetParentOverlay sets the overlay widget used for sizing calculations. Must be called before Show().

func (*Omnibox) Show

func (o *Omnibox) Show(ctx context.Context, query string)

Show opens the omnibox with optional initial query.

func (*Omnibox) Toggle

func (o *Omnibox) Toggle(ctx context.Context)

Toggle shows if hidden, hides if visible.

func (*Omnibox) UpdateZoomIndicator

func (o *Omnibox) UpdateZoomIndicator(factor float64)

UpdateZoomIndicator updates the zoom percentage display. Shows the indicator when zoom != 100%, hides it when at 100%.

func (*Omnibox) Widget

func (o *Omnibox) Widget() *gtk.Widget

Widget returns the omnibox widget for embedding in an overlay.

func (*Omnibox) WidgetAsLayout

func (o *Omnibox) WidgetAsLayout(factory layout.WidgetFactory) layout.Widget

WidgetAsLayout returns the omnibox's outer widget as a layout.Widget. This is useful for adding the omnibox to a PaneView overlay.

type OmniboxConfig

type OmniboxConfig struct {
	HistoryUC       *usecase.SearchHistoryUseCase
	FavoritesUC     *usecase.ManageFavoritesUseCase
	FaviconAdapter  *adapter.FaviconAdapter
	CopyURLUC       *usecase.CopyURLUseCase
	ShortcutsUC     *usecase.SearchShortcutsUseCase
	DefaultSearch   string
	InitialBehavior string
	UIScale         float64                                                     // UI scale for favicon sizing
	OnNavigate      func(url string)                                            // Callback when user navigates via omnibox
	OnToast         func(ctx context.Context, message string, level ToastLevel) // Callback to show toast notification
	OnFocusIn       func(entry *gtk.SearchEntry)                                // Callback when entry gains focus (for accent picker)
	OnFocusOut      func()                                                      // Callback when entry loses focus
}

OmniboxConfig holds configuration for creating an Omnibox.

type PaneView

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

PaneView is a container for a single WebView with active state indication. It uses an overlay to display a border around the active pane.

func NewPaneView

func NewPaneView(factory layout.WidgetFactory, paneID entity.PaneID, webViewWidget layout.Widget) *PaneView

NewPaneView creates a new pane view container for a WebView widget.

func (*PaneView) AddCssClass

func (pv *PaneView) AddCssClass(class string)

AddCssClass adds a CSS class to the overlay.

func (*PaneView) AddOverlayWidget

func (pv *PaneView) AddOverlayWidget(widget layout.Widget)

AddOverlayWidget adds a widget as an overlay on this pane. The widget will appear above the WebView and border.

func (*PaneView) AttachHoverHandler

func (pv *PaneView) AttachHoverHandler(ctx context.Context)

AttachHoverHandler creates and attaches a hover handler for focus-follows-mouse behavior.

func (*PaneView) Cleanup added in v0.20.1

func (pv *PaneView) Cleanup()

Cleanup removes the WebView widget from the overlay and clears references. This must be called before destroying the WebView to ensure proper GTK cleanup. After calling Cleanup, the PaneView should not be reused.

func (*PaneView) GetContentDimensions

func (pv *PaneView) GetContentDimensions() (width, height int)

GetContentDimensions returns the pane's allocated width and height.

func (*PaneView) GrabFocus

func (pv *PaneView) GrabFocus() bool

GrabFocus attempts to focus the WebView. Returns true if focus was successfully grabbed.

func (*PaneView) HasFocus

func (pv *PaneView) HasFocus() bool

HasFocus returns whether the WebView currently has focus.

func (*PaneView) Hide

func (pv *PaneView) Hide()

Hide makes the pane invisible.

func (*PaneView) HideLinkStatus added in v0.21.0

func (pv *PaneView) HideLinkStatus()

HideLinkStatus hides the link status overlay.

func (*PaneView) HideLoadingSkeleton added in v0.22.0

func (pv *PaneView) HideLoadingSkeleton()

HideLoadingSkeleton hides the loading skeleton overlay (if present).

func (*PaneView) IsActive

func (pv *PaneView) IsActive() bool

IsActive returns whether this pane is currently active.

func (*PaneView) IsVisible

func (pv *PaneView) IsVisible() bool

IsVisible returns whether the pane is visible.

func (*PaneView) Overlay

func (pv *PaneView) Overlay() layout.OverlayWidget

Overlay returns the underlying overlay widget for direct access.

func (*PaneView) PaneID

func (pv *PaneView) PaneID() entity.PaneID

PaneID returns the ID of the pane this view represents.

func (*PaneView) RemoveCssClass

func (pv *PaneView) RemoveCssClass(class string)

RemoveCssClass removes a CSS class from the overlay.

func (*PaneView) RemoveOverlayWidget

func (pv *PaneView) RemoveOverlayWidget(widget layout.Widget)

RemoveOverlayWidget removes an overlay widget from this pane.

func (*PaneView) SetActive

func (pv *PaneView) SetActive(active bool)

SetActive updates the active state of the pane. Active panes display a visual border indicator.

func (*PaneView) SetLoadProgress

func (pv *PaneView) SetLoadProgress(progress float64)

SetLoadProgress updates the progress bar with the current load progress. progress should be between 0.0 and 1.0.

func (*PaneView) SetLoading

func (pv *PaneView) SetLoading(loading bool)

SetLoading shows or hides the progress bar.

func (*PaneView) SetOnFocusIn

func (pv *PaneView) SetOnFocusIn(fn func(paneID entity.PaneID))

SetOnFocusIn sets the callback for when the pane gains focus.

func (*PaneView) SetOnFocusOut

func (pv *PaneView) SetOnFocusOut(fn func(paneID entity.PaneID))

SetOnFocusOut sets the callback for when the pane loses focus.

func (*PaneView) SetOnHover

func (pv *PaneView) SetOnHover(fn func(paneID entity.PaneID))

SetOnHover sets the callback for when the pane is hovered.

func (*PaneView) SetVisible

func (pv *PaneView) SetVisible(visible bool)

SetVisible sets the visibility of the pane.

func (*PaneView) SetWebViewWidget

func (pv *PaneView) SetWebViewWidget(widget layout.Widget)

SetWebViewWidget replaces the WebView widget.

func (*PaneView) Show

func (pv *PaneView) Show()

Show makes the pane visible.

func (*PaneView) ShowLinkStatus added in v0.21.0

func (pv *PaneView) ShowLinkStatus(uri string)

ShowLinkStatus displays the link status overlay with the given URI. If uri is empty, hides the overlay instead.

func (*PaneView) ShowToast

func (pv *PaneView) ShowToast(ctx context.Context, message string, level ToastLevel)

ShowToast displays a toast notification with the given message and level. If a toast is already visible, updates the text and resets the dismiss timer.

func (*PaneView) ShowZoomToast

func (pv *PaneView) ShowZoomToast(ctx context.Context, zoomPercent int)

ShowZoomToast displays a zoom level toast notification. Formats the zoom percentage with a % suffix.

func (*PaneView) WebViewWidget

func (pv *PaneView) WebViewWidget() layout.Widget

WebViewWidget returns the underlying WebView widget.

func (*PaneView) Widget

func (pv *PaneView) Widget() layout.Widget

Widget returns the underlying overlay widget for embedding in containers.

type ProgressBar

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

ProgressBar displays a slim loading progress indicator at the bottom of a pane. Uses native GtkProgressBar with "osd" styling for overlay appearance. Implements smooth animation by incrementing towards the target value. Includes a 30-second timeout to auto-hide if the page load stalls.

func NewProgressBar

func NewProgressBar(factory layout.WidgetFactory) *ProgressBar

NewProgressBar creates a new progress bar component using the widget factory.

func (*ProgressBar) Hide

func (pb *ProgressBar) Hide()

Hide makes the progress bar invisible and resets state.

func (*ProgressBar) IsVisible

func (pb *ProgressBar) IsVisible() bool

IsVisible returns whether the progress bar is currently visible.

func (*ProgressBar) SetProgress

func (pb *ProgressBar) SetProgress(progress float64)

SetProgress sets the target progress value and starts smooth animation. progress should be between 0.0 and 1.0.

func (*ProgressBar) Show

func (pb *ProgressBar) Show()

Show makes the progress bar visible and starts the auto-hide timeout.

func (*ProgressBar) Widget

func (pb *ProgressBar) Widget() layout.Widget

Widget returns the underlying widget for embedding in overlays.

type RowHeightDefaults added in v0.21.0

type RowHeightDefaults struct {
	Standard int // Standard list row (e.g., session row, history row)
	Compact  int // Compact row (e.g., tree row, sub-item)
	Divider  int // Divider/separator row
}

RowHeightDefaults holds default (unscaled) row heights for list-based modals. These are base pixel values that should be multiplied by UI scale.

type SessionManager added in v0.21.0

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

SessionManager is a modal overlay for managing sessions.

func NewSessionManager added in v0.21.0

func NewSessionManager(ctx context.Context, cfg SessionManagerConfig) *SessionManager

NewSessionManager creates a new SessionManager component.

func (*SessionManager) Destroy added in v0.21.0

func (sm *SessionManager) Destroy()

Destroy cleans up session manager resources.

func (*SessionManager) Hide added in v0.21.0

func (sm *SessionManager) Hide(ctx context.Context)

Hide hides the session manager.

func (*SessionManager) IsVisible added in v0.21.0

func (sm *SessionManager) IsVisible() bool

IsVisible returns whether the session manager is visible.

func (*SessionManager) SetParentOverlay added in v0.21.0

func (sm *SessionManager) SetParentOverlay(overlay layout.OverlayWidget)

SetParentOverlay sets the overlay widget used for sizing calculations. Must be called before Show().

func (*SessionManager) Show added in v0.21.0

func (sm *SessionManager) Show(ctx context.Context)

Show displays the session manager and loads sessions.

func (*SessionManager) Toggle added in v0.21.0

func (sm *SessionManager) Toggle(ctx context.Context)

Toggle shows if hidden, hides if visible.

func (*SessionManager) Widget added in v0.21.0

func (sm *SessionManager) Widget() *gtk.Widget

Widget returns the session manager widget for embedding in an overlay.

func (*SessionManager) WidgetAsLayout added in v0.21.0

func (sm *SessionManager) WidgetAsLayout(factory layout.WidgetFactory) layout.Widget

WidgetAsLayout returns the session manager's outer widget as a layout.Widget.

type SessionManagerConfig added in v0.21.0

type SessionManagerConfig struct {
	ListSessionsUC  *usecase.ListSessionsUseCase
	DeleteSessionUC *usecase.DeleteSessionUseCase
	Spawner         port.SessionSpawner
	CurrentSession  entity.SessionID
	UIScale         float64
	OnClose         func()
	OnOpen          func(sessionID entity.SessionID)
	OnToast         func(ctx context.Context, message string, level ToastLevel)
}

SessionManagerConfig holds configuration for creating a SessionManager.

type StackedPaneManager

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

StackedPaneManager handles stacked pane operations. With the new architecture, every pane is wrapped in a StackedView from the start, making stacking operations trivial - we just add panes to the existing StackedView.

func NewStackedPaneManager

func NewStackedPaneManager(factory layout.WidgetFactory) *StackedPaneManager

NewStackedPaneManager creates a new stacked pane manager.

func (*StackedPaneManager) AddPaneToStack

func (spm *StackedPaneManager) AddPaneToStack(
	ctx context.Context,
	wsView *WorkspaceView,
	activePaneID entity.PaneID,
	newPaneView *PaneView,
	title string,
) error

AddPaneToStack adds a new pane to the stack containing the active pane. The StackedView is looked up from the TreeRenderer.

func (*StackedPaneManager) GetStackedView

func (spm *StackedPaneManager) GetStackedView(wsView *WorkspaceView, paneID entity.PaneID) *layout.StackedView

GetStackedView returns the StackedView for a pane.

func (*StackedPaneManager) IsStacked

func (spm *StackedPaneManager) IsStacked(wsView *WorkspaceView, paneID entity.PaneID) bool

IsStacked returns true if the pane is in a stack with multiple panes.

func (*StackedPaneManager) NavigateStack

func (spm *StackedPaneManager) NavigateStack(
	ctx context.Context,
	wsView *WorkspaceView,
	currentPaneID entity.PaneID,
	direction string,
) (entity.PaneID, error)

NavigateStack moves to the next or previous pane in a stack. Returns the pane ID that became active.

func (*StackedPaneManager) SetStackActiveCallback

func (spm *StackedPaneManager) SetStackActiveCallback(
	wsView *WorkspaceView,
	paneID entity.PaneID,
	callback func(index int),
)

SetStackActiveCallback sets up the callback for when a stack pane is clicked.

type Suggestion

type Suggestion struct {
	URL        string
	Title      string
	FaviconURL string
	IsFavorite bool // Indicates if this URL is also bookmarked as a favorite
}

Suggestion represents a search result from history.

type TabBar

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

TabBar represents the horizontal tab bar widget.

func NewTabBar

func NewTabBar() *TabBar

NewTabBar creates a new tab bar widget.

func (*TabBar) ActiveTabID

func (tb *TabBar) ActiveTabID() entity.TabID

ActiveTabID returns the currently active tab ID.

func (*TabBar) AddTab

func (tb *TabBar) AddTab(tab *entity.Tab)

AddTab adds a new tab button to the bar.

func (*TabBar) Box

func (tb *TabBar) Box() *gtk.Box

Box returns the underlying GTK box.

func (*TabBar) Count

func (tb *TabBar) Count() int

Count returns the number of tabs in the bar.

func (*TabBar) Destroy

func (tb *TabBar) Destroy()

Destroy cleans up all tab bar resources.

func (*TabBar) RemoveTab

func (tb *TabBar) RemoveTab(tabID entity.TabID)

RemoveTab removes a tab button from the bar.

func (*TabBar) SetActive

func (tb *TabBar) SetActive(tabID entity.TabID)

SetActive updates which tab is shown as active.

func (*TabBar) SetOnClose

func (tb *TabBar) SetOnClose(fn func(tabID entity.TabID))

SetOnClose sets the callback for tab close events.

func (*TabBar) SetOnCreate

func (tb *TabBar) SetOnCreate(fn func())

SetOnCreate sets the callback for new tab creation.

func (*TabBar) SetOnSwitch

func (tb *TabBar) SetOnSwitch(fn func(tabID entity.TabID))

SetOnSwitch sets the callback for tab switch events.

func (*TabBar) SetVisible

func (tb *TabBar) SetVisible(visible bool)

SetVisible shows or hides the tab bar.

func (*TabBar) UpdateTitle

func (tb *TabBar) UpdateTitle(tabID entity.TabID, title string)

UpdateTitle updates the title of a specific tab button.

func (*TabBar) Widget

func (tb *TabBar) Widget() *gtk.Widget

Widget returns the underlying GTK widget for embedding.

type TabButton

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

TabButton represents a single tab button in the tab bar.

func NewTabButton

func NewTabButton(tab *entity.Tab) *TabButton

NewTabButton creates a new tab button for the given tab.

func (*TabButton) Button

func (tb *TabButton) Button() *gtk.Button

Button returns the underlying GTK button.

func (*TabButton) Destroy

func (tb *TabButton) Destroy()

Destroy cleans up the button resources.

func (*TabButton) IsActive

func (tb *TabButton) IsActive() bool

IsActive returns whether this tab is currently active.

func (*TabButton) SetActive

func (tb *TabButton) SetActive(active bool)

SetActive updates the active state styling.

func (*TabButton) SetOnClick

func (tb *TabButton) SetOnClick(fn func(tabID entity.TabID))

SetOnClick sets the callback for click events.

func (*TabButton) SetTitle

func (tb *TabButton) SetTitle(title string)

SetTitle updates the button's label text.

func (*TabButton) TabID

func (tb *TabButton) TabID() entity.TabID

TabID returns the ID of the tab this button represents.

func (*TabButton) Widget

func (tb *TabButton) Widget() *gtk.Widget

Widget returns the underlying GTK widget for embedding.

type TabPicker added in v0.22.0

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

TabPicker is a modal overlay for selecting a tab destination.

It is intentionally similar to SessionManager/Omnibox patterns.

func NewTabPicker added in v0.22.0

func NewTabPicker(ctx context.Context, cfg TabPickerConfig) *TabPicker

func (*TabPicker) Hide added in v0.22.0

func (tp *TabPicker) Hide(ctx context.Context)

func (*TabPicker) IsVisible added in v0.22.0

func (tp *TabPicker) IsVisible() bool

func (*TabPicker) SetParentOverlay added in v0.22.0

func (tp *TabPicker) SetParentOverlay(overlay layout.OverlayWidget)

func (*TabPicker) Show added in v0.22.0

func (tp *TabPicker) Show(ctx context.Context, items []TabPickerItem)

func (*TabPicker) Toggle added in v0.22.0

func (tp *TabPicker) Toggle(ctx context.Context, items []TabPickerItem)

func (*TabPicker) Widget added in v0.22.0

func (tp *TabPicker) Widget() *gtk.Widget

func (*TabPicker) WidgetAsLayout added in v0.22.0

func (tp *TabPicker) WidgetAsLayout(factory layout.WidgetFactory) layout.Widget

type TabPickerConfig added in v0.22.0

type TabPickerConfig struct {
	UIScale  float64
	OnClose  func()
	OnSelect func(item TabPickerItem)
}

type TabPickerItem added in v0.22.0

type TabPickerItem struct {
	TabID entity.TabID
	Title string
	IsNew bool
	Index int // 0-based index in tab list, -1 for + New
}

type ToastLevel

type ToastLevel int

ToastLevel indicates the visual style of a toast notification.

const (
	// ToastInfo is for informational messages (accent color).
	ToastInfo ToastLevel = iota
	// ToastSuccess is for success confirmations (green).
	ToastSuccess
	// ToastWarning is for warning messages (yellow).
	ToastWarning
	// ToastError is for error messages (red).
	ToastError
)

type ToastOption added in v0.22.0

type ToastOption func(*ToastOptions)

ToastOption is a functional option for configuring toast display.

func WithBackgroundColor added in v0.22.0

func WithBackgroundColor(color string) ToastOption

WithBackgroundColor sets a custom background color (CSS color value).

func WithDuration added in v0.22.0

func WithDuration(ms int) ToastOption

WithDuration sets the auto-dismiss duration in milliseconds. Use 0 for persistent toasts that require manual dismissal.

func WithModeClass added in v0.22.0

func WithModeClass(class string) ToastOption

WithModeClass sets a mode-specific CSS class for styling. This is applied atomically within Show() to avoid visual flicker.

func WithPosition added in v0.22.0

func WithPosition(pos ToastPosition) ToastOption

WithPosition sets the toast position on screen.

func WithTextColor added in v0.22.0

func WithTextColor(color string) ToastOption

WithTextColor sets a custom text color (CSS color value).

type ToastOptions added in v0.22.0

type ToastOptions struct {
	// Duration in milliseconds. 0 = persistent (no auto-dismiss), >0 = auto-dismiss after duration.
	Duration int
	// BackgroundColor overrides the default background color (CSS color value).
	// Empty string uses the level's default color.
	BackgroundColor string
	// TextColor overrides the default text color (CSS color value).
	// Empty string uses the default (auto-contrast with background).
	TextColor string
	// Position determines where the toast appears on screen.
	Position ToastPosition
	// ModeClass is a CSS class for mode-specific styling (e.g., "toast-pane-mode").
	// When set, this class is applied atomically with Show() to avoid visual flicker.
	ModeClass string
}

ToastOptions configures toast appearance and behavior.

type ToastPosition added in v0.22.0

type ToastPosition int

ToastPosition defines where the toast appears on screen.

const (
	// ToastPositionTopLeft positions toast in top-left corner.
	ToastPositionTopLeft ToastPosition = iota
	// ToastPositionTopCenter positions toast at top center.
	ToastPositionTopCenter
	// ToastPositionTopRight positions toast in top-right corner.
	ToastPositionTopRight
	// ToastPositionBottomLeft positions toast in bottom-left corner.
	ToastPositionBottomLeft
	// ToastPositionBottomCenter positions toast at bottom center.
	ToastPositionBottomCenter
	// ToastPositionBottomRight positions toast in bottom-right corner.
	ToastPositionBottomRight
)

type Toaster

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

Toaster displays toast notifications in an overlay. It supports different notification levels and auto-dismissal. When a new toast is shown while one is already visible, the text is updated in-place and the dismiss timer is reset (spam protection).

func NewToaster

func NewToaster(factory layout.WidgetFactory) *Toaster

NewToaster creates a new toaster component for overlay display. The toaster is positioned in the top-left corner with margin by default.

func (*Toaster) Hide

func (t *Toaster) Hide()

Hide manually dismisses the toast.

func (*Toaster) IsVisible

func (t *Toaster) IsVisible() bool

IsVisible returns whether the toast is currently visible.

func (*Toaster) Show

func (t *Toaster) Show(ctx context.Context, message string, level ToastLevel, opts ...ToastOption)

Show displays a toast notification with the given message and level. If a toast is already visible, updates the text and resets the dismiss timer. Optional ToastOption arguments can customize duration, colors, and position.

func (*Toaster) ShowZoom

func (t *Toaster) ShowZoom(ctx context.Context, zoomPercent int)

ShowZoom displays a zoom level toast (convenience method). Formats the zoom percentage with a % suffix.

func (*Toaster) Widget

func (t *Toaster) Widget() layout.Widget

Widget returns the underlying widget for embedding in overlays.

type ViewMode

type ViewMode string

ViewMode distinguishes history search from favorites display.

const (
	ViewModeHistory   ViewMode = "history"
	ViewModeFavorites ViewMode = "favorites"
)

type WorkspaceView

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

WorkspaceView is the top-level container that renders a workspace's pane tree. It manages the widget tree and handles active pane state.

func NewWorkspaceView

func NewWorkspaceView(ctx context.Context, factory layout.WidgetFactory) *WorkspaceView

NewWorkspaceView creates a new workspace view.

func (*WorkspaceView) ClearRootWidgetRef

func (wv *WorkspaceView) ClearRootWidgetRef()

ClearRootWidgetRef clears the stored root widget reference without removing it. Use this before SetRootWidgetDirect when the old root has already been removed through other means (e.g., GTK paned operations).

func (*WorkspaceView) Container

func (wv *WorkspaceView) Container() layout.BoxWidget

Container returns the underlying BoxWidget for direct access.

func (*WorkspaceView) ContainerWidget

func (wv *WorkspaceView) ContainerWidget() layout.Widget

ContainerWidget returns the container widget for relative positioning. Implements focus.PaneGeometryProvider.

func (*WorkspaceView) Factory

func (wv *WorkspaceView) Factory() layout.WidgetFactory

Factory returns the widget factory used by this workspace view.

func (*WorkspaceView) FindNext

func (wv *WorkspaceView) FindNext()

FindNext triggers the next match in the find bar if available.

func (*WorkspaceView) FindPrevious

func (wv *WorkspaceView) FindPrevious()

FindPrevious triggers the previous match in the find bar if available.

func (*WorkspaceView) FocusPane

func (wv *WorkspaceView) FocusPane(paneID entity.PaneID) bool

FocusPane attempts to give focus to a specific pane. Returns true if focus was successfully grabbed.

func (*WorkspaceView) GetActivePaneID

func (wv *WorkspaceView) GetActivePaneID() entity.PaneID

GetActivePaneID returns the ID of the currently active pane. Reads from the domain model as the single source of truth.

func (*WorkspaceView) GetActivePaneView

func (wv *WorkspaceView) GetActivePaneView() *PaneView

GetActivePaneView returns the PaneView for the current active pane.

func (*WorkspaceView) GetOmnibox

func (wv *WorkspaceView) GetOmnibox() *Omnibox

GetOmnibox returns the current omnibox if visible.

func (*WorkspaceView) GetPaneIDs

func (wv *WorkspaceView) GetPaneIDs() []entity.PaneID

GetPaneIDs returns all pane IDs in this workspace view.

func (*WorkspaceView) GetPaneView

func (wv *WorkspaceView) GetPaneView(paneID entity.PaneID) *PaneView

GetPaneView returns the PaneView for a given pane ID. Returns nil if not found.

func (*WorkspaceView) GetPaneWidget

func (wv *WorkspaceView) GetPaneWidget(paneID entity.PaneID) layout.Widget

GetPaneWidget returns the widget for a pane ID. Implements focus.PaneGeometryProvider.

func (*WorkspaceView) GetRootWidget

func (wv *WorkspaceView) GetRootWidget() layout.Widget

GetRootWidget returns the current root widget of the workspace. This is useful for incremental operations that need to modify the tree.

func (*WorkspaceView) GetStackContainerWidget

func (wv *WorkspaceView) GetStackContainerWidget(paneID entity.PaneID) layout.Widget

GetStackContainerWidget returns the stack container widget for a stacked pane. Returns nil if the pane is not in a stack. Implements focus.PaneGeometryProvider.

func (*WorkspaceView) HideFindBar

func (wv *WorkspaceView) HideFindBar()

HideFindBar hides and destroys the current find bar.

func (*WorkspaceView) HideOmnibox

func (wv *WorkspaceView) HideOmnibox()

HideOmnibox hides and destroys the current omnibox.

func (*WorkspaceView) IsFindBarVisible

func (wv *WorkspaceView) IsFindBarVisible() bool

IsFindBarVisible returns whether the find bar is currently visible.

func (*WorkspaceView) IsOmniboxVisible

func (wv *WorkspaceView) IsOmniboxVisible() bool

IsOmniboxVisible returns whether the omnibox is currently visible.

func (*WorkspaceView) PaneCount

func (wv *WorkspaceView) PaneCount() int

PaneCount returns the number of panes in the workspace view.

func (*WorkspaceView) Rebuild

func (wv *WorkspaceView) Rebuild(ctx context.Context) error

Rebuild rebuilds the widget tree from the current workspace. Use this after structural changes like splits or closes.

func (*WorkspaceView) RegisterPaneView

func (wv *WorkspaceView) RegisterPaneView(paneID entity.PaneID, pv *PaneView)

RegisterPaneView adds a PaneView to the tracking map without rebuilding. Use this for incremental operations like stacked panes.

func (*WorkspaceView) SetActivePaneID

func (wv *WorkspaceView) SetActivePaneID(paneID entity.PaneID) error

SetActivePaneID updates which pane is visually marked as active.

func (*WorkspaceView) SetFindBarConfig

func (wv *WorkspaceView) SetFindBarConfig(cfg FindBarConfig)

SetFindBarConfig stores the find bar configuration for later use.

func (*WorkspaceView) SetModeBorderOverlay

func (wv *WorkspaceView) SetModeBorderOverlay(widget layout.Widget)

SetModeBorderOverlay attaches a mode border overlay widget. The widget will be displayed on top of the pane container when modes are active.

func (*WorkspaceView) SetOmniboxConfig

func (wv *WorkspaceView) SetOmniboxConfig(cfg OmniboxConfig)

SetOmniboxConfig stores the omnibox configuration for later use.

func (*WorkspaceView) SetOnPaneFocused

func (wv *WorkspaceView) SetOnPaneFocused(fn func(paneID entity.PaneID))

SetOnPaneFocused sets the callback for when a pane receives focus.

func (*WorkspaceView) SetOnSplitRatioDragged added in v0.21.0

func (wv *WorkspaceView) SetOnSplitRatioDragged(fn func(nodeID string, ratio float64))

func (*WorkspaceView) SetRootWidgetDirect

func (wv *WorkspaceView) SetRootWidgetDirect(widget layout.Widget)

SetRootWidgetDirect replaces the root widget without rebuilding the entire tree. Use this for incremental operations when converting to/from stacked panes.

func (*WorkspaceView) SetWebViewWidget

func (wv *WorkspaceView) SetWebViewWidget(paneID entity.PaneID, widget layout.Widget) error

SetWebViewWidget attaches a WebView widget to a specific pane.

func (*WorkspaceView) SetWorkspace

func (wv *WorkspaceView) SetWorkspace(ctx context.Context, ws *entity.Workspace) error

SetWorkspace sets the workspace to render and builds the widget tree.

func (*WorkspaceView) ShowFindBar

func (wv *WorkspaceView) ShowFindBar(ctx context.Context)

ShowFindBar creates and shows the find bar in the active pane.

func (*WorkspaceView) ShowOmnibox

func (wv *WorkspaceView) ShowOmnibox(ctx context.Context, query string)

ShowOmnibox creates and shows the omnibox in the active pane.

func (*WorkspaceView) TreeRenderer

func (wv *WorkspaceView) TreeRenderer() *layout.TreeRenderer

TreeRenderer returns the underlying tree renderer.

func (*WorkspaceView) UnregisterPaneView

func (wv *WorkspaceView) UnregisterPaneView(paneID entity.PaneID)

UnregisterPaneView removes a PaneView from the tracking map and cleans it up. This must be called when closing a pane to properly release GTK resources before destroying the WebView.

func (*WorkspaceView) Widget

func (wv *WorkspaceView) Widget() layout.Widget

Widget returns the overlay widget for embedding in the UI. The overlay wraps the pane container and allows mode borders to be displayed.

func (*WorkspaceView) Workspace

func (wv *WorkspaceView) Workspace() *entity.Workspace

Workspace returns the current workspace.

Jump to

Keyboard shortcuts

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