v0.12.1 1453d21

main.go RawHistoryFolder

1package main
2
3import (
4	"embed"
5	"log"
6	"os"
7	"runtime"
8
9	"github.com/bnema/dumber/internal/app/browser"
10	"github.com/bnema/dumber/internal/app/cli"
11	"github.com/bnema/dumber/internal/config"
12	"github.com/bnema/dumber/internal/logging"
13	"github.com/bnema/dumber/pkg/webkit"
14)
15
16//go:embed assets
17var assets embed.FS
18
19// Build information set via ldflags
20var (
21	version   = "dev"
22	commit    = "none"
23	buildDate = "unknown"
24)
25
26func main() {
27	// Setup basic crash handling early (before any potential crashes)
28	logging.SetupCrashHandler()
29
30	// Check if we should run the CLI mode
31	if shouldRunCLI() {
32		cli.Execute(version, commit, buildDate)
33		return
34	}
35
36	// Initialize logging early for GUI mode using default config
37	cfg := config.New()
38	if err := logging.Init(
39		cfg.Logging.LogDir,
40		cfg.Logging.Level,
41		cfg.Logging.Format,
42		cfg.Logging.EnableFileLog,
43		cfg.Logging.MaxSize,
44		cfg.Logging.MaxBackups,
45		cfg.Logging.MaxAge,
46		cfg.Logging.Compress,
47	); err != nil {
48		log.Printf("Warning: failed to initialize logging: %v", err)
49	}
50
51	log.Printf("Starting dumber browser v%s (commit: %s, built: %s)", version, commit, buildDate)
52
53	// GTK requires all UI calls to run on the main OS thread
54	if webkit.IsNativeAvailable() {
55		runtime.LockOSThread()
56		defer runtime.UnlockOSThread()
57	}
58
59	// Otherwise run the GUI browser
60	browser.Run(assets, version, commit, buildDate)
61}
62
63// shouldRunCLI determines if we should run in CLI mode based on arguments
64func shouldRunCLI() bool {
65	// No args = show CLI help with available commands
66	if len(os.Args) <= 1 {
67		return true
68	}
69
70	// Check for GUI-specific flags
71	for _, arg := range os.Args[1:] {
72		if arg == "--gui" || arg == "-g" {
73			return false // Explicit GUI mode
74		}
75	}
76
77	// Check for browse command - this should open GUI in direct navigation mode
78	if len(os.Args) >= 2 && os.Args[1] == "browse" {
79		return false // Browse command uses GUI mode but navigates directly
80	}
81
82	// Any other arguments mean CLI mode
83	return true
84}

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