v0.10.0 0f4e9eb

toast_svelte_cgo.go RawHistoryFolder

1//go:build webkit_cgo
2
3package webkit
4
5import (
6	"fmt"
7	"log"
8)
9
10// getToastScript returns the unified GUI bundle-based toast notification script with GTK theme integration.
11// This function is deprecated and should use the new unified approach via BrowserService.InjectToastSystem
12func getToastScript(assets interface{ ReadFile(string) ([]byte, error) }) string {
13	// Read the unified GUI bundle from assets
14	var guiBundle string
15	if assets != nil {
16		bundleBytes, err := assets.ReadFile("gui/gui.min.js")
17		if err != nil {
18			// Fallback to error message if file not found
19			guiBundle = `console.error("❌ Failed to load unified GUI bundle: ` + err.Error() + `");`
20			log.Printf("[webkit] Failed to read GUI bundle: %v", err)
21		} else {
22			guiBundle = string(bundleBytes)
23			log.Printf("[webkit] Successfully loaded unified GUI bundle (%d bytes)", len(bundleBytes))
24		}
25	} else {
26		guiBundle = `console.error("❌ Failed to load unified GUI bundle: assets not provided");`
27		log.Printf("[webkit] GUI bundle error: assets not provided")
28	}
29
30	// GTK Theme Integration with new unified approach
31	themeIntegration := `
32// Set up theme change listener for dynamic updates
33window.__dumber_setTheme = (theme) => {
34  window.__dumber_initial_theme = theme;
35  if (theme === 'dark') {
36    document.documentElement.classList.add('dark');
37  } else {
38    document.documentElement.classList.remove('dark');
39  }
40};
41`
42
43	// Use unified GUI bundle approach
44	return fmt.Sprintf(`(function() {
45  function initializeToast() {
46    try {
47      %s
48
49      %s
50
51      // Initialize toast system via unified GUI bundle
52      if (window.__dumber_gui && window.__dumber_gui.initializeToast) {
53        window.__dumber_gui.initializeToast().then(() => {
54          console.log('✅ Toast system initialized via unified GUI bundle');
55        }).catch((e) => {
56          console.error('❌ Toast initialization failed:', e);
57        });
58      } else {
59        console.error('❌ Unified GUI bundle not properly loaded');
60      }
61    } catch (e) {
62      console.error('❌ Failed to initialize toast system:', e);
63    }
64  }
65
66  // Ensure DOM is ready before initializing
67  if (document.readyState === 'loading') {
68    document.addEventListener('DOMContentLoaded', initializeToast);
69  } else {
70    initializeToast();
71  }
72})();`, themeIntegration, guiBundle)
73}

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