v0.25.0 2e6c485

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	// XDG paths
35	XDG port.XDGPaths
36
37	// WebKit infrastructure
38	WebContext    *webkit.WebKitContext
39	Pool          *webkit.WebViewPool
40	Factory       port.WebViewFactory
41	Settings      *webkit.SettingsManager
42	Injector      *webkit.ContentInjector
43	MessageRouter *webkit.MessageRouter
44
45	// Repositories
46	HistoryRepo  repository.HistoryRepository
47	FavoriteRepo repository.FavoriteRepository
48	ZoomRepo     repository.ZoomRepository
49	FilterRepo   repository.ContentWhitelistRepository
50
51	// Use Cases
52	TabsUC      *usecase.ManageTabsUseCase
53	PanesUC     *usecase.ManagePanesUseCase
54	NavigateUC  *usecase.NavigateUseCase
55	ZoomUC      *usecase.ManageZoomUseCase
56	FavoritesUC *usecase.ManageFavoritesUseCase
57	HistoryUC   *usecase.SearchHistoryUseCase
58	CopyURLUC   *usecase.CopyURLUseCase
59
60	// Infrastructure Adapters
61	Clipboard      port.Clipboard
62	FaviconService *favicon.Service
63	FilterManager  *filtering.Manager
64	IdleInhibitor  port.IdleInhibitor
65
66	// Accent picker for dead keys support
67	InsertAccentUC *usecase.InsertAccentUseCase
68
69	// Session management
70	SessionStateRepo repository.SessionStateRepository
71	SessionRepo      repository.SessionRepository
72	CurrentSessionID entity.SessionID
73	SnapshotUC       *usecase.SnapshotSessionUseCase
74
75	// Update management
76	CheckUpdateUC *usecase.CheckUpdateUseCase
77	ApplyUpdateUC *usecase.ApplyUpdateUseCase
78}
79
80// Validate checks that all required dependencies are set.
81func (d *Dependencies) Validate() error {
82	if d.Ctx == nil {
83		return ErrMissingDependency("Ctx")
84	}
85	if d.Config == nil {
86		return ErrMissingDependency("Config")
87	}
88	// WebKit dependencies are optional for testing without WebViews
89	// Use cases are optional - can be nil if not needed
90	return nil
91}
92
93// DependencyError indicates a missing required dependency.
94type DependencyError struct {
95	Name string
96}
97
98func (e DependencyError) Error() string {
99	return "missing required dependency: " + e.Name
100}
101
102// ErrMissingDependency creates a new DependencyError.
103func ErrMissingDependency(name string) error {
104	return DependencyError{Name: name}
105}

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