v0.23.2 bfd5eb4

deps.go RawHistoryFolder

1// Package ui provides the GTK4 presentation layer for the dumber browser.
2package ui
3
4import (
5	"context"
6
7	"github.com/bnema/dumber/internal/application/port"
8	"github.com/bnema/dumber/internal/application/usecase"
9	"github.com/bnema/dumber/internal/domain/entity"
10	"github.com/bnema/dumber/internal/domain/repository"
11	"github.com/bnema/dumber/internal/infrastructure/colorscheme"
12	"github.com/bnema/dumber/internal/infrastructure/config"
13	"github.com/bnema/dumber/internal/infrastructure/favicon"
14	"github.com/bnema/dumber/internal/infrastructure/filtering"
15	"github.com/bnema/dumber/internal/infrastructure/webkit"
16	"github.com/bnema/dumber/internal/ui/theme"
17)
18
19// Dependencies holds all injected dependencies for the UI layer.
20// This struct is created once at startup and passed to UI components.
21type Dependencies struct {
22	// Core context and configuration
23	Ctx                 context.Context
24	Config              *config.Config
25	InitialURL          string // URL to open on startup (optional)
26	RestoreSessionID    string // Session ID to restore on startup (optional)
27	OnFirstWebViewShown func(context.Context)
28
29	// Theme and color scheme management
30	Theme           *theme.Manager
31	ColorResolver   port.ColorSchemeResolver
32	AdwaitaDetector *colorscheme.AdwaitaDetector
33
34	// WebKit infrastructure
35	WebContext    *webkit.WebKitContext
36	Pool          *webkit.WebViewPool
37	Factory       port.WebViewFactory
38	Settings      *webkit.SettingsManager
39	Injector      *webkit.ContentInjector
40	MessageRouter *webkit.MessageRouter
41
42	// Repositories
43	HistoryRepo  repository.HistoryRepository
44	FavoriteRepo repository.FavoriteRepository
45	ZoomRepo     repository.ZoomRepository
46	FilterRepo   repository.ContentWhitelistRepository
47
48	// Use Cases
49	TabsUC      *usecase.ManageTabsUseCase
50	PanesUC     *usecase.ManagePanesUseCase
51	NavigateUC  *usecase.NavigateUseCase
52	ZoomUC      *usecase.ManageZoomUseCase
53	FavoritesUC *usecase.ManageFavoritesUseCase
54	HistoryUC   *usecase.SearchHistoryUseCase
55	CopyURLUC   *usecase.CopyURLUseCase
56
57	// Infrastructure Adapters
58	Clipboard      port.Clipboard
59	FaviconService *favicon.Service
60	FilterManager  *filtering.Manager
61	IdleInhibitor  port.IdleInhibitor
62
63	// Accent picker for dead keys support
64	InsertAccentUC *usecase.InsertAccentUseCase
65
66	// Session management
67	SessionStateRepo repository.SessionStateRepository
68	SessionRepo      repository.SessionRepository
69	CurrentSessionID entity.SessionID
70	SnapshotUC       *usecase.SnapshotSessionUseCase
71
72	// Update management
73	CheckUpdateUC *usecase.CheckUpdateUseCase
74	ApplyUpdateUC *usecase.ApplyUpdateUseCase
75}
76
77// Validate checks that all required dependencies are set.
78func (d *Dependencies) Validate() error {
79	if d.Ctx == nil {
80		return ErrMissingDependency("Ctx")
81	}
82	if d.Config == nil {
83		return ErrMissingDependency("Config")
84	}
85	// WebKit dependencies are optional for testing without WebViews
86	// Use cases are optional - can be nil if not needed
87	return nil
88}
89
90// DependencyError indicates a missing required dependency.
91type DependencyError struct {
92	Name string
93}
94
95func (e DependencyError) Error() string {
96	return "missing required dependency: " + e.Name
97}
98
99// ErrMissingDependency creates a new DependencyError.
100func ErrMissingDependency(name string) error {
101	return DependencyError{Name: name}
102}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close