v0.12.0 d035193

workspace_hover.go RawHistoryFolder

1// workspace_hover.go - Hover handler management for workspace panes
2package browser
3
4import (
5	"log"
6
7	"github.com/bnema/dumber/pkg/webkit"
8	"github.com/diamondburned/gotk4/pkg/glib/v2"
9)
10
11// ensureHover attaches hover handlers to a pane node for mouse-based focus changes
12func (wm *WorkspaceManager) ensureHover(node *paneNode) {
13	if wm == nil || node == nil || !node.isLeaf {
14		return
15	}
16
17	// Skip if already attached or no container
18	if node.container == nil || node.hoverToken != nil {
19		return
20	}
21
22	// Attach hover handler to the pane container
23	controller := webkit.WidgetAddHoverHandler(node.container, func() {
24		if wm == nil || node == nil {
25			return
26		}
27
28		// Skip if this pane is already active to avoid redundant focus churn.
29		if wm.GetActiveNode() == node {
30			return
31		}
32
33		// Debounce hover events to prevent rapid focus changes (minimum 150ms between hover-triggered focus changes)
34		now := glib.GetMonotonicTime()
35		if node.lastHoverTime > 0 && (now-node.lastHoverTime) < 150000 { // 150ms in microseconds
36			return
37		}
38		node.lastHoverTime = now
39
40		// Request focus change when mouse enters the pane
41		wm.SetActivePane(node, SourceMouse)
42	})
43
44	if controller != nil {
45		node.hoverToken = controller
46		log.Printf("[workspace] Attached hover handler to pane %p (controller=%p)", node, controller)
47	} else {
48		log.Printf("[workspace] Failed to attach hover handler to pane %p", node)
49	}
50}
51
52// detachHover removes hover handlers from a pane node
53func (wm *WorkspaceManager) detachHover(node *paneNode) {
54	if wm == nil || node == nil || node.hoverToken == nil {
55		return
56	}
57
58	if node.container == nil {
59		node.hoverToken = nil
60		return
61	}
62
63	webkit.WidgetRemoveHoverHandler(node.container, node.hoverToken)
64	log.Printf("[workspace] Detached hover handler from pane %p (controller=%p)", node, node.hoverToken)
65	node.hoverToken = nil
66}
67
68// attachHoverHandlersToAllPanes attaches hover handlers to all leaf panes
69func (wm *WorkspaceManager) attachHoverHandlersToAllPanes() {
70	if wm == nil {
71		return
72	}
73
74	leaves := wm.collectLeaves()
75	for _, leaf := range leaves {
76		wm.ensureHover(leaf)
77	}
78
79	log.Printf("[workspace] Attached hover handlers to %d panes", len(leaves))
80}

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