detached 305b057

feat(ui): add progress bar overlay for webpage loading

commit
305b057830dd051df2d075e018a350d5e120e3de
author
bnema · · 2025-12-17 21:23 UTC
parent
445f033
signature
unsigned
7 files · +372 -6
M go.mod +20 -1
@@ -4,6 +4,9 @@ go 1.25.3
44
55 require (
66 github.com/bnema/puregotk-webkit v0.0.0-00010101000000-000000000000
7+ github.com/charmbracelet/bubbles v0.21.0
8+ github.com/charmbracelet/bubbletea v1.3.10
9+ github.com/charmbracelet/lipgloss v1.1.0
710 github.com/fsnotify/fsnotify v1.9.0
811 github.com/jwijenbergh/puregotk v0.0.0-20251022075221-eae1610c7d83
912 github.com/ncruces/go-sqlite3 v0.30.3
@@ -15,25 +18,41 @@ require (
1518 )
1619
1720 require (
21+ github.com/atotto/clipboard v0.1.4 // indirect
22+ github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
23+ github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
24+ github.com/charmbracelet/x/ansi v0.10.1 // indirect
25+ github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
26+ github.com/charmbracelet/x/term v0.2.1 // indirect
1827 github.com/davecgh/go-spew v1.1.1 // indirect
28+ github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
1929 github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
30+ github.com/inconshreveable/mousetrap v1.1.0 // indirect
2031 github.com/jwijenbergh/purego v0.0.0-20251017112123-b71757b9ba42 // indirect
21- github.com/kylelemons/godebug v1.1.0 // indirect
32+ github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
2233 github.com/mattn/go-colorable v0.1.13 // indirect
2334 github.com/mattn/go-isatty v0.0.20 // indirect
35+ github.com/mattn/go-localereader v0.0.1 // indirect
36+ github.com/mattn/go-runewidth v0.0.16 // indirect
2437 github.com/mfridman/interpolate v0.0.2 // indirect
38+ github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
39+ github.com/muesli/cancelreader v0.2.2 // indirect
40+ github.com/muesli/termenv v0.16.0 // indirect
2541 github.com/ncruces/julianday v1.0.0 // indirect
2642 github.com/pelletier/go-toml/v2 v2.2.4 // indirect
2743 github.com/pmezard/go-difflib v1.0.0 // indirect
44+ github.com/rivo/uniseg v0.4.7 // indirect
2845 github.com/sagikazarmark/locafero v0.11.0 // indirect
2946 github.com/sethvargo/go-retry v0.3.0 // indirect
3047 github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
3148 github.com/spf13/afero v1.15.0 // indirect
3249 github.com/spf13/cast v1.10.0 // indirect
50+ github.com/spf13/cobra v1.10.2 // indirect
3351 github.com/spf13/pflag v1.0.10 // indirect
3452 github.com/stretchr/objx v0.5.2 // indirect
3553 github.com/subosito/gotenv v1.6.0 // indirect
3654 github.com/tetratelabs/wazero v1.10.1 // indirect
55+ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
3756 go.uber.org/multierr v1.11.0 // indirect
3857 go.yaml.in/yaml/v3 v3.0.4 // indirect
3958 golang.org/x/sync v0.18.0 // indirect
@@ -4,6 +4,9 @@ go 1.25.3
4 4
5 require (5 require (
6 github.com/bnema/puregotk-webkit v0.0.0-00010101000000-0000000000006 github.com/bnema/puregotk-webkit v0.0.0-00010101000000-000000000000
7+ github.com/charmbracelet/bubbles v0.21.0
8+ github.com/charmbracelet/bubbletea v1.3.10
9+ github.com/charmbracelet/lipgloss v1.1.0
7 github.com/fsnotify/fsnotify v1.9.010 github.com/fsnotify/fsnotify v1.9.0
8 github.com/jwijenbergh/puregotk v0.0.0-20251022075221-eae1610c7d8311 github.com/jwijenbergh/puregotk v0.0.0-20251022075221-eae1610c7d83
9 github.com/ncruces/go-sqlite3 v0.30.312 github.com/ncruces/go-sqlite3 v0.30.3
@@ -15,25 +18,41 @@ require (
15 )18 )
16 19
17 require (20 require (
21+ github.com/atotto/clipboard v0.1.4 // indirect
22+ github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
23+ github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
24+ github.com/charmbracelet/x/ansi v0.10.1 // indirect
25+ github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
26+ github.com/charmbracelet/x/term v0.2.1 // indirect
18 github.com/davecgh/go-spew v1.1.1 // indirect27 github.com/davecgh/go-spew v1.1.1 // indirect
28+ github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
19 github.com/go-viper/mapstructure/v2 v2.4.0 // indirect29 github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
30+ github.com/inconshreveable/mousetrap v1.1.0 // indirect
20 github.com/jwijenbergh/purego v0.0.0-20251017112123-b71757b9ba42 // indirect31 github.com/jwijenbergh/purego v0.0.0-20251017112123-b71757b9ba42 // indirect
21- github.com/kylelemons/godebug v1.1.0 // indirect32+ github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
22 github.com/mattn/go-colorable v0.1.13 // indirect33 github.com/mattn/go-colorable v0.1.13 // indirect
23 github.com/mattn/go-isatty v0.0.20 // indirect34 github.com/mattn/go-isatty v0.0.20 // indirect
35+ github.com/mattn/go-localereader v0.0.1 // indirect
36+ github.com/mattn/go-runewidth v0.0.16 // indirect
24 github.com/mfridman/interpolate v0.0.2 // indirect37 github.com/mfridman/interpolate v0.0.2 // indirect
38+ github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
39+ github.com/muesli/cancelreader v0.2.2 // indirect
40+ github.com/muesli/termenv v0.16.0 // indirect
25 github.com/ncruces/julianday v1.0.0 // indirect41 github.com/ncruces/julianday v1.0.0 // indirect
26 github.com/pelletier/go-toml/v2 v2.2.4 // indirect42 github.com/pelletier/go-toml/v2 v2.2.4 // indirect
27 github.com/pmezard/go-difflib v1.0.0 // indirect43 github.com/pmezard/go-difflib v1.0.0 // indirect
44+ github.com/rivo/uniseg v0.4.7 // indirect
28 github.com/sagikazarmark/locafero v0.11.0 // indirect45 github.com/sagikazarmark/locafero v0.11.0 // indirect
29 github.com/sethvargo/go-retry v0.3.0 // indirect46 github.com/sethvargo/go-retry v0.3.0 // indirect
30 github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect47 github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
31 github.com/spf13/afero v1.15.0 // indirect48 github.com/spf13/afero v1.15.0 // indirect
32 github.com/spf13/cast v1.10.0 // indirect49 github.com/spf13/cast v1.10.0 // indirect
50+ github.com/spf13/cobra v1.10.2 // indirect
33 github.com/spf13/pflag v1.0.10 // indirect51 github.com/spf13/pflag v1.0.10 // indirect
34 github.com/stretchr/objx v0.5.2 // indirect52 github.com/stretchr/objx v0.5.2 // indirect
35 github.com/subosito/gotenv v1.6.0 // indirect53 github.com/subosito/gotenv v1.6.0 // indirect
36 github.com/tetratelabs/wazero v1.10.1 // indirect54 github.com/tetratelabs/wazero v1.10.1 // indirect
55+ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
37 go.uber.org/multierr v1.11.0 // indirect56 go.uber.org/multierr v1.11.0 // indirect
38 go.yaml.in/yaml/v3 v3.0.4 // indirect57 go.yaml.in/yaml/v3 v3.0.4 // indirect
39 golang.org/x/sync v0.18.0 // indirect58 golang.org/x/sync v0.18.0 // indirect
M go.sum +49 -0 generated file: collapsed
M internal/infrastructure/webkit/webview.go +15 -0
@@ -322,6 +322,21 @@ func (wv *WebView) connectSignals() {
322322 }
323323 sigID = gobject.SignalConnect(wv.inner.GoPointer(), "notify::favicon", glib.NewCallback(&faviconCb))
324324 wv.signalIDs = append(wv.signalIDs, sigID)
325+
326+ // notify::estimated-load-progress signal for load progress updates
327+ // This fires frequently during page load with values from 0.0 to 1.0
328+ progressCb := func() {
329+ progress := wv.inner.GetEstimatedLoadProgress()
330+ wv.mu.Lock()
331+ wv.progress = progress
332+ wv.mu.Unlock()
333+
334+ if wv.OnProgressChanged != nil {
335+ wv.OnProgressChanged(progress)
336+ }
337+ }
338+ sigID = gobject.SignalConnect(wv.inner.GoPointer(), "notify::estimated-load-progress", glib.NewCallback(&progressCb))
339+ wv.signalIDs = append(wv.signalIDs, sigID)
325340 }
326341
327342 // ID returns the unique identifier for this WebView.
@@ -322,6 +322,21 @@ func (wv *WebView) connectSignals() {
322 }322 }
323 sigID = gobject.SignalConnect(wv.inner.GoPointer(), "notify::favicon", glib.NewCallback(&faviconCb))323 sigID = gobject.SignalConnect(wv.inner.GoPointer(), "notify::favicon", glib.NewCallback(&faviconCb))
324 wv.signalIDs = append(wv.signalIDs, sigID)324 wv.signalIDs = append(wv.signalIDs, sigID)
325+
326+ // notify::estimated-load-progress signal for load progress updates
327+ // This fires frequently during page load with values from 0.0 to 1.0
328+ progressCb := func() {
329+ progress := wv.inner.GetEstimatedLoadProgress()
330+ wv.mu.Lock()
331+ wv.progress = progress
332+ wv.mu.Unlock()
333+
334+ if wv.OnProgressChanged != nil {
335+ wv.OnProgressChanged(progress)
336+ }
337+ }
338+ sigID = gobject.SignalConnect(wv.inner.GoPointer(), "notify::estimated-load-progress", glib.NewCallback(&progressCb))
339+ wv.signalIDs = append(wv.signalIDs, sigID)
325 }340 }
326 341
327 // ID returns the unique identifier for this WebView.342 // ID returns the unique identifier for this WebView.
M internal/ui/component/pane_view.go +35 -0
@@ -22,6 +22,7 @@ type PaneView struct {
2222 overlay layout.OverlayWidget
2323 webViewWidget layout.Widget // The actual WebView widget
2424 borderBox layout.BoxWidget // Border overlay for active indication
25+ progressBar *ProgressBar // Loading progress indicator
2526 paneID entity.PaneID
2627 isActive bool
2728
@@ -62,11 +63,18 @@ func NewPaneView(factory layout.WidgetFactory, paneID entity.PaneID, webViewWidg
6263 overlay.SetClipOverlay(borderBox, false)
6364 overlay.SetMeasureOverlay(borderBox, false)
6465
66+ // Create progress bar overlay at bottom
67+ progressBar := NewProgressBar(factory)
68+ overlay.AddOverlay(progressBar.Widget())
69+ overlay.SetClipOverlay(progressBar.Widget(), false)
70+ overlay.SetMeasureOverlay(progressBar.Widget(), false)
71+
6572 return &PaneView{
6673 factory: factory,
6774 overlay: overlay,
6875 webViewWidget: webViewWidget,
6976 borderBox: borderBox,
77+ progressBar: progressBar,
7078 paneID: paneID,
7179 isActive: false,
7280 }
@@ -267,3 +275,30 @@ func (pv *PaneView) RemoveOverlayWidget(widget layout.Widget) {
267275 func (pv *PaneView) GetContentDimensions() (width, height int) {
268276 return pv.overlay.GetAllocatedWidth(), pv.overlay.GetAllocatedHeight()
269277 }
278+
279+// SetLoadProgress updates the progress bar with the current load progress.
280+// progress should be between 0.0 and 1.0.
281+func (pv *PaneView) SetLoadProgress(progress float64) {
282+ pv.mu.RLock()
283+ pb := pv.progressBar
284+ pv.mu.RUnlock()
285+
286+ if pb != nil {
287+ pb.SetProgress(progress)
288+ }
289+}
290+
291+// SetLoading shows or hides the progress bar.
292+func (pv *PaneView) SetLoading(loading bool) {
293+ pv.mu.RLock()
294+ pb := pv.progressBar
295+ pv.mu.RUnlock()
296+
297+ if pb != nil {
298+ if loading {
299+ pb.Show()
300+ } else {
301+ pb.Hide()
302+ }
303+ }
304+}
@@ -22,6 +22,7 @@ type PaneView struct {
22 overlay layout.OverlayWidget22 overlay layout.OverlayWidget
23 webViewWidget layout.Widget // The actual WebView widget23 webViewWidget layout.Widget // The actual WebView widget
24 borderBox layout.BoxWidget // Border overlay for active indication24 borderBox layout.BoxWidget // Border overlay for active indication
25+ progressBar *ProgressBar // Loading progress indicator
25 paneID entity.PaneID26 paneID entity.PaneID
26 isActive bool27 isActive bool
27 28
@@ -62,11 +63,18 @@ func NewPaneView(factory layout.WidgetFactory, paneID entity.PaneID, webViewWidg
62 overlay.SetClipOverlay(borderBox, false)63 overlay.SetClipOverlay(borderBox, false)
63 overlay.SetMeasureOverlay(borderBox, false)64 overlay.SetMeasureOverlay(borderBox, false)
64 65
66+ // Create progress bar overlay at bottom
67+ progressBar := NewProgressBar(factory)
68+ overlay.AddOverlay(progressBar.Widget())
69+ overlay.SetClipOverlay(progressBar.Widget(), false)
70+ overlay.SetMeasureOverlay(progressBar.Widget(), false)
71+
65 return &PaneView{72 return &PaneView{
66 factory: factory,73 factory: factory,
67 overlay: overlay,74 overlay: overlay,
68 webViewWidget: webViewWidget,75 webViewWidget: webViewWidget,
69 borderBox: borderBox,76 borderBox: borderBox,
77+ progressBar: progressBar,
70 paneID: paneID,78 paneID: paneID,
71 isActive: false,79 isActive: false,
72 }80 }
@@ -267,3 +275,30 @@ func (pv *PaneView) RemoveOverlayWidget(widget layout.Widget) {
267 func (pv *PaneView) GetContentDimensions() (width, height int) {275 func (pv *PaneView) GetContentDimensions() (width, height int) {
268 return pv.overlay.GetAllocatedWidth(), pv.overlay.GetAllocatedHeight()276 return pv.overlay.GetAllocatedWidth(), pv.overlay.GetAllocatedHeight()
269 }277 }
278+
279+// SetLoadProgress updates the progress bar with the current load progress.
280+// progress should be between 0.0 and 1.0.
281+func (pv *PaneView) SetLoadProgress(progress float64) {
282+ pv.mu.RLock()
283+ pb := pv.progressBar
284+ pv.mu.RUnlock()
285+
286+ if pb != nil {
287+ pb.SetProgress(progress)
288+ }
289+}
290+
291+// SetLoading shows or hides the progress bar.
292+func (pv *PaneView) SetLoading(loading bool) {
293+ pv.mu.RLock()
294+ pb := pv.progressBar
295+ pv.mu.RUnlock()
296+
297+ if pb != nil {
298+ if loading {
299+ pb.Show()
300+ } else {
301+ pb.Hide()
302+ }
303+ }
304+}
A internal/ui/component/progress_bar.go +174 -0
@@ -0,0 +1,174 @@
1+// Package component provides UI components for the browser.
2+package component
3+
4+import (
5+ "sync"
6+
7+ "github.com/jwijenbergh/puregotk/v4/glib"
8+ "github.com/jwijenbergh/puregotk/v4/gtk"
9+
10+ "github.com/bnema/dumber/internal/ui/layout"
11+)
12+
13+const (
14+ // Animation step size - how much to increment per frame
15+ progressStep = 0.02
16+ // Animation interval in milliseconds
17+ progressIntervalMs = 16 // ~60fps
18+)
19+
20+// ProgressBar displays a slim loading progress indicator at the bottom of a pane.
21+// Uses native GtkProgressBar with "osd" styling for overlay appearance.
22+// Implements smooth animation by incrementing towards the target value.
23+type ProgressBar struct {
24+ factory layout.WidgetFactory
25+ progressBar *gtk.ProgressBar
26+ widget layout.Widget // Wrapped widget for layout compatibility
27+
28+ visible bool
29+ currentValue float64 // Current displayed value
30+ targetValue float64 // Target value to animate towards
31+ animationTimer uint // Timer source ID for animation
32+
33+ mu sync.Mutex
34+}
35+
36+// NewProgressBar creates a new progress bar component using native GtkProgressBar.
37+func NewProgressBar(factory layout.WidgetFactory) *ProgressBar {
38+ progressBar := gtk.NewProgressBar()
39+
40+ // Add "osd" class for on-screen-display overlay styling (like Epiphany)
41+ progressBar.AddCssClass("osd")
42+
43+ // Position at bottom, full width
44+ progressBar.SetValign(gtk.AlignEndValue)
45+ progressBar.SetHalign(gtk.AlignFillValue)
46+ progressBar.SetHexpand(true)
47+
48+ // Don't intercept pointer events - let clicks pass through to WebView
49+ progressBar.SetCanTarget(false)
50+ progressBar.SetCanFocus(false)
51+
52+ // Hidden by default
53+ progressBar.SetVisible(false)
54+
55+ // Wrap for layout compatibility
56+ widget := factory.WrapWidget(&progressBar.Widget)
57+
58+ return &ProgressBar{
59+ factory: factory,
60+ progressBar: progressBar,
61+ widget: widget,
62+ visible: false,
63+ currentValue: 0,
64+ targetValue: 0,
65+ }
66+}
67+
68+// SetProgress sets the target progress value and starts smooth animation.
69+// progress should be between 0.0 and 1.0.
70+func (pb *ProgressBar) SetProgress(progress float64) {
71+ pb.mu.Lock()
72+ defer pb.mu.Unlock()
73+
74+ // Clamp progress to valid range
75+ if progress < 0 {
76+ progress = 0
77+ } else if progress > 1 {
78+ progress = 1
79+ }
80+
81+ pb.targetValue = progress
82+
83+ // For large jumps (>0.3) or completion, update immediately
84+ diff := progress - pb.currentValue
85+ if diff > 0.3 || progress >= 1.0 {
86+ pb.currentValue = progress
87+ pb.progressBar.SetFraction(progress)
88+ return
89+ }
90+
91+ // Start animation if not already running
92+ if pb.animationTimer == 0 {
93+ pb.startAnimation()
94+ }
95+}
96+
97+// startAnimation begins the smooth progress animation.
98+// Must be called with lock held.
99+func (pb *ProgressBar) startAnimation() {
100+ var cb glib.SourceFunc
101+ cb = func(_ uintptr) bool {
102+ pb.mu.Lock()
103+ defer pb.mu.Unlock()
104+
105+ // Check if we've reached the target
106+ if pb.currentValue >= pb.targetValue {
107+ pb.animationTimer = 0
108+ return false // Stop the timer
109+ }
110+
111+ // Increment towards target
112+ pb.currentValue += progressStep
113+ if pb.currentValue > pb.targetValue {
114+ pb.currentValue = pb.targetValue
115+ }
116+
117+ pb.progressBar.SetFraction(pb.currentValue)
118+
119+ // Continue animation if not at target
120+ return pb.currentValue < pb.targetValue
121+ }
122+
123+ pb.animationTimer = glib.TimeoutAdd(progressIntervalMs, &cb, 0)
124+}
125+
126+// Show makes the progress bar visible.
127+func (pb *ProgressBar) Show() {
128+ pb.mu.Lock()
129+ defer pb.mu.Unlock()
130+
131+ if !pb.visible {
132+ pb.visible = true
133+ pb.progressBar.SetVisible(true)
134+ }
135+}
136+
137+// Hide makes the progress bar invisible and resets state.
138+func (pb *ProgressBar) Hide() {
139+ pb.mu.Lock()
140+ defer pb.mu.Unlock()
141+
142+ if pb.visible {
143+ pb.visible = false
144+ pb.progressBar.SetVisible(false)
145+
146+ // Stop any running animation
147+ if pb.animationTimer != 0 {
148+ glib.SourceRemove(pb.animationTimer)
149+ pb.animationTimer = 0
150+ }
151+
152+ // Reset values
153+ pb.currentValue = 0
154+ pb.targetValue = 0
155+ pb.progressBar.SetFraction(0)
156+ }
157+}
158+
159+// IsVisible returns whether the progress bar is currently visible.
160+func (pb *ProgressBar) IsVisible() bool {
161+ pb.mu.Lock()
162+ defer pb.mu.Unlock()
163+ return pb.visible
164+}
165+
166+// Widget returns the underlying GtkProgressBar widget for embedding in overlays.
167+func (pb *ProgressBar) Widget() layout.Widget {
168+ return pb.widget
169+}
170+
171+// GtkWidget returns the raw GtkProgressBar for direct GTK operations.
172+func (pb *ProgressBar) GtkWidget() *gtk.ProgressBar {
173+ return pb.progressBar
174+}
@@ -0,0 +1,174 @@
1+// Package component provides UI components for the browser.
2+package component
3+
4+import (
5+ "sync"
6+
7+ "github.com/jwijenbergh/puregotk/v4/glib"
8+ "github.com/jwijenbergh/puregotk/v4/gtk"
9+
10+ "github.com/bnema/dumber/internal/ui/layout"
11+)
12+
13+const (
14+ // Animation step size - how much to increment per frame
15+ progressStep = 0.02
16+ // Animation interval in milliseconds
17+ progressIntervalMs = 16 // ~60fps
18+)
19+
20+// ProgressBar displays a slim loading progress indicator at the bottom of a pane.
21+// Uses native GtkProgressBar with "osd" styling for overlay appearance.
22+// Implements smooth animation by incrementing towards the target value.
23+type ProgressBar struct {
24+ factory layout.WidgetFactory
25+ progressBar *gtk.ProgressBar
26+ widget layout.Widget // Wrapped widget for layout compatibility
27+
28+ visible bool
29+ currentValue float64 // Current displayed value
30+ targetValue float64 // Target value to animate towards
31+ animationTimer uint // Timer source ID for animation
32+
33+ mu sync.Mutex
34+}
35+
36+// NewProgressBar creates a new progress bar component using native GtkProgressBar.
37+func NewProgressBar(factory layout.WidgetFactory) *ProgressBar {
38+ progressBar := gtk.NewProgressBar()
39+
40+ // Add "osd" class for on-screen-display overlay styling (like Epiphany)
41+ progressBar.AddCssClass("osd")
42+
43+ // Position at bottom, full width
44+ progressBar.SetValign(gtk.AlignEndValue)
45+ progressBar.SetHalign(gtk.AlignFillValue)
46+ progressBar.SetHexpand(true)
47+
48+ // Don't intercept pointer events - let clicks pass through to WebView
49+ progressBar.SetCanTarget(false)
50+ progressBar.SetCanFocus(false)
51+
52+ // Hidden by default
53+ progressBar.SetVisible(false)
54+
55+ // Wrap for layout compatibility
56+ widget := factory.WrapWidget(&progressBar.Widget)
57+
58+ return &ProgressBar{
59+ factory: factory,
60+ progressBar: progressBar,
61+ widget: widget,
62+ visible: false,
63+ currentValue: 0,
64+ targetValue: 0,
65+ }
66+}
67+
68+// SetProgress sets the target progress value and starts smooth animation.
69+// progress should be between 0.0 and 1.0.
70+func (pb *ProgressBar) SetProgress(progress float64) {
71+ pb.mu.Lock()
72+ defer pb.mu.Unlock()
73+
74+ // Clamp progress to valid range
75+ if progress < 0 {
76+ progress = 0
77+ } else if progress > 1 {
78+ progress = 1
79+ }
80+
81+ pb.targetValue = progress
82+
83+ // For large jumps (>0.3) or completion, update immediately
84+ diff := progress - pb.currentValue
85+ if diff > 0.3 || progress >= 1.0 {
86+ pb.currentValue = progress
87+ pb.progressBar.SetFraction(progress)
88+ return
89+ }
90+
91+ // Start animation if not already running
92+ if pb.animationTimer == 0 {
93+ pb.startAnimation()
94+ }
95+}
96+
97+// startAnimation begins the smooth progress animation.
98+// Must be called with lock held.
99+func (pb *ProgressBar) startAnimation() {
100+ var cb glib.SourceFunc
101+ cb = func(_ uintptr) bool {
102+ pb.mu.Lock()
103+ defer pb.mu.Unlock()
104+
105+ // Check if we've reached the target
106+ if pb.currentValue >= pb.targetValue {
107+ pb.animationTimer = 0
108+ return false // Stop the timer
109+ }
110+
111+ // Increment towards target
112+ pb.currentValue += progressStep
113+ if pb.currentValue > pb.targetValue {
114+ pb.currentValue = pb.targetValue
115+ }
116+
117+ pb.progressBar.SetFraction(pb.currentValue)
118+
119+ // Continue animation if not at target
120+ return pb.currentValue < pb.targetValue
121+ }
122+
123+ pb.animationTimer = glib.TimeoutAdd(progressIntervalMs, &cb, 0)
124+}
125+
126+// Show makes the progress bar visible.
127+func (pb *ProgressBar) Show() {
128+ pb.mu.Lock()
129+ defer pb.mu.Unlock()
130+
131+ if !pb.visible {
132+ pb.visible = true
133+ pb.progressBar.SetVisible(true)
134+ }
135+}
136+
137+// Hide makes the progress bar invisible and resets state.
138+func (pb *ProgressBar) Hide() {
139+ pb.mu.Lock()
140+ defer pb.mu.Unlock()
141+
142+ if pb.visible {
143+ pb.visible = false
144+ pb.progressBar.SetVisible(false)
145+
146+ // Stop any running animation
147+ if pb.animationTimer != 0 {
148+ glib.SourceRemove(pb.animationTimer)
149+ pb.animationTimer = 0
150+ }
151+
152+ // Reset values
153+ pb.currentValue = 0
154+ pb.targetValue = 0
155+ pb.progressBar.SetFraction(0)
156+ }
157+}
158+
159+// IsVisible returns whether the progress bar is currently visible.
160+func (pb *ProgressBar) IsVisible() bool {
161+ pb.mu.Lock()
162+ defer pb.mu.Unlock()
163+ return pb.visible
164+}
165+
166+// Widget returns the underlying GtkProgressBar widget for embedding in overlays.
167+func (pb *ProgressBar) Widget() layout.Widget {
168+ return pb.widget
169+}
170+
171+// GtkWidget returns the raw GtkProgressBar for direct GTK operations.
172+func (pb *ProgressBar) GtkWidget() *gtk.ProgressBar {
173+ return pb.progressBar
174+}
M internal/ui/coordinator/content.go +51 -2
@@ -113,13 +113,23 @@ func (c *ContentCoordinator) EnsureWebView(ctx context.Context, paneID entity.Pa
113113 c.onFaviconChanged(ctx, paneID, favicon)
114114 }
115115
116- // Set up load change callback to re-apply zoom on navigation
116+ // Set up load change callback to re-apply zoom on navigation and handle progress bar
117117 wv.OnLoadChanged = func(event webkit.LoadEvent) {
118- if event == webkit.LoadCommitted {
118+ switch event {
119+ case webkit.LoadStarted:
120+ c.onLoadStarted(ctx, paneID)
121+ case webkit.LoadCommitted:
119122 c.onLoadCommitted(ctx, paneID, wv)
123+ case webkit.LoadFinished:
124+ c.onLoadFinished(ctx, paneID)
120125 }
121126 }
122127
128+ // Set up progress callback for loading indicator
129+ wv.OnProgressChanged = func(progress float64) {
130+ c.onProgressChanged(ctx, paneID, progress)
131+ }
132+
123133 // Set up URI change callback for SPA navigation (History API)
124134 // This fires when URL changes via JavaScript without a full page load
125135 wv.OnURIChanged = func(uri string) {
@@ -479,3 +489,42 @@ func (c *ContentCoordinator) onSPANavigation(ctx context.Context, paneID entity.
479489 c.onHistoryRecord(ctx, paneID, url)
480490 }
481491 }
492+
493+// onLoadStarted shows the progress bar when page loading begins.
494+func (c *ContentCoordinator) onLoadStarted(ctx context.Context, paneID entity.PaneID) {
495+ _, wsView := c.getActiveWS()
496+ if wsView == nil {
497+ return
498+ }
499+
500+ paneView := wsView.GetPaneView(paneID)
501+ if paneView != nil {
502+ paneView.SetLoading(true)
503+ }
504+}
505+
506+// onLoadFinished hides the progress bar when page loading completes.
507+func (c *ContentCoordinator) onLoadFinished(ctx context.Context, paneID entity.PaneID) {
508+ _, wsView := c.getActiveWS()
509+ if wsView == nil {
510+ return
511+ }
512+
513+ paneView := wsView.GetPaneView(paneID)
514+ if paneView != nil {
515+ paneView.SetLoading(false)
516+ }
517+}
518+
519+// onProgressChanged updates the progress bar with current load progress.
520+func (c *ContentCoordinator) onProgressChanged(ctx context.Context, paneID entity.PaneID, progress float64) {
521+ _, wsView := c.getActiveWS()
522+ if wsView == nil {
523+ return
524+ }
525+
526+ paneView := wsView.GetPaneView(paneID)
527+ if paneView != nil {
528+ paneView.SetLoadProgress(progress)
529+ }
530+}
@@ -113,13 +113,23 @@ func (c *ContentCoordinator) EnsureWebView(ctx context.Context, paneID entity.Pa
113 c.onFaviconChanged(ctx, paneID, favicon)113 c.onFaviconChanged(ctx, paneID, favicon)
114 }114 }
115 115
116- // Set up load change callback to re-apply zoom on navigation116+ // Set up load change callback to re-apply zoom on navigation and handle progress bar
117 wv.OnLoadChanged = func(event webkit.LoadEvent) {117 wv.OnLoadChanged = func(event webkit.LoadEvent) {
118- if event == webkit.LoadCommitted {118+ switch event {
119+ case webkit.LoadStarted:
120+ c.onLoadStarted(ctx, paneID)
121+ case webkit.LoadCommitted:
119 c.onLoadCommitted(ctx, paneID, wv)122 c.onLoadCommitted(ctx, paneID, wv)
123+ case webkit.LoadFinished:
124+ c.onLoadFinished(ctx, paneID)
120 }125 }
121 }126 }
122 127
128+ // Set up progress callback for loading indicator
129+ wv.OnProgressChanged = func(progress float64) {
130+ c.onProgressChanged(ctx, paneID, progress)
131+ }
132+
123 // Set up URI change callback for SPA navigation (History API)133 // Set up URI change callback for SPA navigation (History API)
124 // This fires when URL changes via JavaScript without a full page load134 // This fires when URL changes via JavaScript without a full page load
125 wv.OnURIChanged = func(uri string) {135 wv.OnURIChanged = func(uri string) {
@@ -479,3 +489,42 @@ func (c *ContentCoordinator) onSPANavigation(ctx context.Context, paneID entity.
479 c.onHistoryRecord(ctx, paneID, url)489 c.onHistoryRecord(ctx, paneID, url)
480 }490 }
481 }491 }
492+
493+// onLoadStarted shows the progress bar when page loading begins.
494+func (c *ContentCoordinator) onLoadStarted(ctx context.Context, paneID entity.PaneID) {
495+ _, wsView := c.getActiveWS()
496+ if wsView == nil {
497+ return
498+ }
499+
500+ paneView := wsView.GetPaneView(paneID)
501+ if paneView != nil {
502+ paneView.SetLoading(true)
503+ }
504+}
505+
506+// onLoadFinished hides the progress bar when page loading completes.
507+func (c *ContentCoordinator) onLoadFinished(ctx context.Context, paneID entity.PaneID) {
508+ _, wsView := c.getActiveWS()
509+ if wsView == nil {
510+ return
511+ }
512+
513+ paneView := wsView.GetPaneView(paneID)
514+ if paneView != nil {
515+ paneView.SetLoading(false)
516+ }
517+}
518+
519+// onProgressChanged updates the progress bar with current load progress.
520+func (c *ContentCoordinator) onProgressChanged(ctx context.Context, paneID entity.PaneID, progress float64) {
521+ _, wsView := c.getActiveWS()
522+ if wsView == nil {
523+ return
524+ }
525+
526+ paneView := wsView.GetPaneView(paneID)
527+ if paneView != nil {
528+ paneView.SetLoadProgress(progress)
529+ }
530+}
M internal/ui/theme/css.go +28 -3
@@ -46,6 +46,10 @@ func GenerateCSSWithScale(p Palette, scale float64) string {
4646
4747 // Stacked pane styling
4848 sb.WriteString(generateStackedPaneCSS(p))
49+ sb.WriteString("\n")
50+
51+ // Progress bar styling
52+ sb.WriteString(generateProgressBarCSS(p))
4953
5054 return sb.String()
5155 }
@@ -200,7 +204,7 @@ entry.omnibox-entry > *:focus-visible {
200204 border-radius: 0;
201205 border-left: 0.1875em solid transparent;
202206 border-bottom: 0.0625em solid alpha(var(--border), 0.5);
203- transition: background-color 100ms ease-in-out, border-left-color 100ms ease-in-out;
207+ transition: background-color 100ms ease-in-out, border-left 100ms ease-in-out;
204208 min-height: 2.75em;
205209 }
206210
@@ -210,12 +214,12 @@ entry.omnibox-entry > *:focus-visible {
210214
211215 .omnibox-row:hover {
212216 background-color: alpha(var(--accent), 0.12);
213- border-left-color: var(--accent);
217+ border-left: 0.1875em solid var(--accent);
214218 }
215219
216220 .omnibox-row:selected {
217221 background-color: alpha(var(--accent), 0.2);
218- border-left-color: var(--accent);
222+ border-left: 0.1875em solid var(--accent);
219223 }
220224
221225 /* Favicon in omnibox rows */
@@ -378,3 +382,24 @@ button.stacked-pane-title-button:hover .stacked-pane-titlebar label {
378382 }
379383 `
380384 }
385+
386+// generateProgressBarCSS creates progress bar styles for page loading indication.
387+func generateProgressBarCSS(p Palette) string {
388+ return `/* ===== Progress Bar Styling ===== */
389+
390+/* Native GtkProgressBar with osd class */
391+progressbar.osd {
392+ min-height: 4px;
393+}
394+
395+progressbar.osd trough {
396+ min-height: 4px;
397+ background-color: alpha(var(--bg), 0.3);
398+}
399+
400+progressbar.osd progress {
401+ min-height: 4px;
402+ background-color: var(--accent);
403+}
404+`
405+}
@@ -46,6 +46,10 @@ func GenerateCSSWithScale(p Palette, scale float64) string {
46 46
47 // Stacked pane styling47 // Stacked pane styling
48 sb.WriteString(generateStackedPaneCSS(p))48 sb.WriteString(generateStackedPaneCSS(p))
49+ sb.WriteString("\n")
50+
51+ // Progress bar styling
52+ sb.WriteString(generateProgressBarCSS(p))
49 53
50 return sb.String()54 return sb.String()
51 }55 }
@@ -200,7 +204,7 @@ entry.omnibox-entry > *:focus-visible {
200 border-radius: 0;204 border-radius: 0;
201 border-left: 0.1875em solid transparent;205 border-left: 0.1875em solid transparent;
202 border-bottom: 0.0625em solid alpha(var(--border), 0.5);206 border-bottom: 0.0625em solid alpha(var(--border), 0.5);
203- transition: background-color 100ms ease-in-out, border-left-color 100ms ease-in-out;207+ transition: background-color 100ms ease-in-out, border-left 100ms ease-in-out;
204 min-height: 2.75em;208 min-height: 2.75em;
205 }209 }
206 210
@@ -210,12 +214,12 @@ entry.omnibox-entry > *:focus-visible {
210 214
211 .omnibox-row:hover {215 .omnibox-row:hover {
212 background-color: alpha(var(--accent), 0.12);216 background-color: alpha(var(--accent), 0.12);
213- border-left-color: var(--accent);217+ border-left: 0.1875em solid var(--accent);
214 }218 }
215 219
216 .omnibox-row:selected {220 .omnibox-row:selected {
217 background-color: alpha(var(--accent), 0.2);221 background-color: alpha(var(--accent), 0.2);
218- border-left-color: var(--accent);222+ border-left: 0.1875em solid var(--accent);
219 }223 }
220 224
221 /* Favicon in omnibox rows */225 /* Favicon in omnibox rows */
@@ -378,3 +382,24 @@ button.stacked-pane-title-button:hover .stacked-pane-titlebar label {
378 }382 }
379 `383 `
380 }384 }
385+
386+// generateProgressBarCSS creates progress bar styles for page loading indication.
387+func generateProgressBarCSS(p Palette) string {
388+ return `/* ===== Progress Bar Styling ===== */
389+
390+/* Native GtkProgressBar with osd class */
391+progressbar.osd {
392+ min-height: 4px;
393+}
394+
395+progressbar.osd trough {
396+ min-height: 4px;
397+ background-color: alpha(var(--bg), 0.3);
398+}
399+
400+progressbar.osd progress {
401+ min-height: 4px;
402+ background-color: var(--accent);
403+}
404+`
405+}

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