detached 717efa6

refactor(deps): integrate CopyURLUseCase into dependency injection

commit
717efa6acaaf37015154730469353184e703b88c
author
brice · · 2025-12-17 21:41 UTC
committer
brice · · 2025-12-17 22:56 UTC
parent
c4effaa
signature
unsigned
3 files · +7 -2
M cmd/dumber/main.go +4 -1
@@ -152,6 +152,8 @@ func runGUI() {
152152 favoritesUC := usecase.NewManageFavoritesUseCase(favoriteRepo, folderRepo, tagRepo)
153153 zoomUC := usecase.NewManageZoomUseCase(zoomRepo, cfg.DefaultWebpageZoom)
154154 navigateUC := usecase.NewNavigateUseCase(historyRepo, zoomRepo, cfg.DefaultWebpageZoom)
155+ clipboardAdapter := clipboard.New()
156+ copyURLUC := usecase.NewCopyURLUseCase(clipboardAdapter)
155157
156158 // Build dependencies
157159 deps := &ui.Dependencies{
@@ -175,8 +177,9 @@ func runGUI() {
175177 FavoritesUC: favoritesUC,
176178 ZoomUC: zoomUC,
177179 NavigateUC: navigateUC,
180+ CopyURLUC: copyURLUC,
178181 // Infrastructure Adapters
179- Clipboard: clipboard.New(),
182+ Clipboard: clipboardAdapter,
180183 }
181184
182185 // Run the application
@@ -152,6 +152,8 @@ func runGUI() {
152 favoritesUC := usecase.NewManageFavoritesUseCase(favoriteRepo, folderRepo, tagRepo)152 favoritesUC := usecase.NewManageFavoritesUseCase(favoriteRepo, folderRepo, tagRepo)
153 zoomUC := usecase.NewManageZoomUseCase(zoomRepo, cfg.DefaultWebpageZoom)153 zoomUC := usecase.NewManageZoomUseCase(zoomRepo, cfg.DefaultWebpageZoom)
154 navigateUC := usecase.NewNavigateUseCase(historyRepo, zoomRepo, cfg.DefaultWebpageZoom)154 navigateUC := usecase.NewNavigateUseCase(historyRepo, zoomRepo, cfg.DefaultWebpageZoom)
155+ clipboardAdapter := clipboard.New()
156+ copyURLUC := usecase.NewCopyURLUseCase(clipboardAdapter)
155 157
156 // Build dependencies158 // Build dependencies
157 deps := &ui.Dependencies{159 deps := &ui.Dependencies{
@@ -175,8 +177,9 @@ func runGUI() {
175 FavoritesUC: favoritesUC,177 FavoritesUC: favoritesUC,
176 ZoomUC: zoomUC,178 ZoomUC: zoomUC,
177 NavigateUC: navigateUC,179 NavigateUC: navigateUC,
180+ CopyURLUC: copyURLUC,
178 // Infrastructure Adapters181 // Infrastructure Adapters
179- Clipboard: clipboard.New(),182+ Clipboard: clipboardAdapter,
180 }183 }
181 184
182 // Run the application185 // Run the application
M internal/ui/app.go +2 -1
@@ -215,7 +215,7 @@ func (a *App) onActivate(ctx context.Context) {
215215 HistoryUC: a.deps.HistoryUC,
216216 FavoritesUC: a.deps.FavoritesUC,
217217 FaviconCache: a.faviconCache,
218- Clipboard: a.deps.Clipboard,
218+ CopyURLUC: a.deps.CopyURLUC,
219219 Shortcuts: a.deps.Config.SearchShortcuts,
220220 DefaultSearch: a.deps.Config.DefaultSearchEngine,
221221 InitialBehavior: a.deps.Config.Omnibox.InitialBehavior,
@@ -382,6 +382,7 @@ func (a *App) initCoordinators(ctx context.Context) {
382382 a.wsCoord,
383383 a.navCoord,
384384 a.deps.ZoomUC,
385+ a.deps.CopyURLUC,
385386 )
386387 a.kbDispatcher.SetOnQuit(a.Quit)
387388
@@ -215,7 +215,7 @@ func (a *App) onActivate(ctx context.Context) {
215 HistoryUC: a.deps.HistoryUC,215 HistoryUC: a.deps.HistoryUC,
216 FavoritesUC: a.deps.FavoritesUC,216 FavoritesUC: a.deps.FavoritesUC,
217 FaviconCache: a.faviconCache,217 FaviconCache: a.faviconCache,
218- Clipboard: a.deps.Clipboard,218+ CopyURLUC: a.deps.CopyURLUC,
219 Shortcuts: a.deps.Config.SearchShortcuts,219 Shortcuts: a.deps.Config.SearchShortcuts,
220 DefaultSearch: a.deps.Config.DefaultSearchEngine,220 DefaultSearch: a.deps.Config.DefaultSearchEngine,
221 InitialBehavior: a.deps.Config.Omnibox.InitialBehavior,221 InitialBehavior: a.deps.Config.Omnibox.InitialBehavior,
@@ -382,6 +382,7 @@ func (a *App) initCoordinators(ctx context.Context) {
382 a.wsCoord,382 a.wsCoord,
383 a.navCoord,383 a.navCoord,
384 a.deps.ZoomUC,384 a.deps.ZoomUC,
385+ a.deps.CopyURLUC,
385 )386 )
386 a.kbDispatcher.SetOnQuit(a.Quit)387 a.kbDispatcher.SetOnQuit(a.Quit)
387 388
M internal/ui/deps.go +1 -0
@@ -44,6 +44,7 @@ type Dependencies struct {
4444 ZoomUC *usecase.ManageZoomUseCase
4545 FavoritesUC *usecase.ManageFavoritesUseCase
4646 HistoryUC *usecase.SearchHistoryUseCase
47+ CopyURLUC *usecase.CopyURLUseCase
4748
4849 // Infrastructure Adapters
4950 Clipboard port.Clipboard
@@ -44,6 +44,7 @@ type Dependencies struct {
44 ZoomUC *usecase.ManageZoomUseCase44 ZoomUC *usecase.ManageZoomUseCase
45 FavoritesUC *usecase.ManageFavoritesUseCase45 FavoritesUC *usecase.ManageFavoritesUseCase
46 HistoryUC *usecase.SearchHistoryUseCase46 HistoryUC *usecase.SearchHistoryUseCase
47+ CopyURLUC *usecase.CopyURLUseCase
47 48
48 // Infrastructure Adapters49 // Infrastructure Adapters
49 Clipboard port.Clipboard50 Clipboard port.Clipboard

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