v0.15.0 9006957

mouse_gestures.go RawHistoryFolder

1package webkit
2
3import (
4	"fmt"
5
6	"github.com/bnema/dumber/internal/logging"
7	"github.com/diamondburned/gotk4/pkg/gtk/v4"
8)
9
10// Mouse button constants for navigation
11// Standard button numbers (consistent across Wayland and GTK)
12const (
13	mouseButtonBack    = 8 // Side button (back)
14	mouseButtonForward = 9 // Side button (forward)
15)
16
17// AttachMouseGestures attaches mouse button gesture handling to the WebView
18// This enables hardware mouse button navigation (back/forward buttons)
19func (w *WebView) AttachMouseGestures() {
20	if w.view == nil {
21		logging.Error(fmt.Sprintf("[mouse-gestures] Cannot attach: WebView is nil"))
22		return
23	}
24
25	// Create gesture controller for mouse clicks
26	gestureClick := gtk.NewGestureClick()
27
28	// Listen to all mouse buttons (0 = any button)
29	gestureClick.SetButton(0)
30
31	// Set to capture phase to intercept before WebView processes
32	gestureClick.SetPropagationPhase(gtk.PhaseCapture)
33
34	// Connect to pressed signal
35	gestureClick.ConnectPressed(func(nPress int, x, y float64) {
36		// Get which button was pressed
37		button := gestureClick.CurrentButton()
38
39		// Only handle single clicks (not double/triple clicks)
40		if nPress != 1 {
41			return
42		}
43
44		switch button {
45		case mouseButtonBack:
46			if w.view.CanGoBack() {
47				logging.Debug(fmt.Sprintf("[mouse-gestures] Back button clicked - navigating backward"))
48				w.view.GoBack()
49			} else {
50				logging.Debug(fmt.Sprintf("[mouse-gestures] Back button clicked but cannot go back"))
51			}
52
53		case mouseButtonForward:
54			if w.view.CanGoForward() {
55				logging.Debug(fmt.Sprintf("[mouse-gestures] Forward button clicked - navigating forward"))
56				w.view.GoForward()
57			} else {
58				logging.Debug(fmt.Sprintf("[mouse-gestures] Forward button clicked but cannot go forward"))
59			}
60		}
61	})
62
63	// Attach controller to WebView
64	w.view.AddController(gestureClick)
65
66	logging.Debug(fmt.Sprintf("[mouse-gestures] Mouse gesture controller attached to WebView ID %d", w.id))
67}

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