types.go RawHistoryFolder
1package webkit
2
3// WindowType indicates how a new WebView should be treated
4type WindowType int
5
6const (
7 // WindowTypeTab represents an independent WebView (future: tab)
8 WindowTypeTab WindowType = iota
9 // WindowTypePopup represents a related WebView (shares process/context)
10 WindowTypePopup
11 // WindowTypeUnknown indicates type not detected yet
12 WindowTypeUnknown
13)
14
15// WindowFeatures describes the window features detected from WebKitWindowProperties
16type WindowFeatures struct {
17 Width int
18 Height int
19 ToolbarVisible bool
20 LocationbarVisible bool
21 MenubarVisible bool
22 Resizable bool
23}
24
25// Config holds WebView configuration
26type Config struct {
27 // UserAgent string for the WebView
28 UserAgent string
29
30 // EnableJavaScript controls JavaScript execution
31 EnableJavaScript bool
32
33 // EnableWebGL controls WebGL support
34 EnableWebGL bool
35
36 // EnableMediaStream controls media stream support
37 EnableMediaStream bool
38
39 // HardwareAcceleration controls GPU acceleration
40 HardwareAcceleration bool
41
42 // DefaultFontSize in pixels
43 DefaultFontSize int
44
45 // MinimumFontSize in pixels
46 MinimumFontSize int
47
48 // Performance optimizations
49 // EnablePageCache enables back/forward cache for instant navigation
50 EnablePageCache bool
51
52 // EnableSmoothScrolling enables smooth scrolling animations
53 EnableSmoothScrolling bool
54
55 // DataDir is the directory for persistent data (cookies, localStorage, etc.)
56 DataDir string
57
58 // CacheDir is the directory for HTTP cache
59 CacheDir string
60
61 // AppearanceConfigJSON is the JSON string for appearance configuration
62 // This will be injected at document-start via UserContentManager
63 AppearanceConfigJSON string
64
65 // CreateWindow controls whether to create a standalone GTK Window for this WebView
66 // Set to false for WebViews that will be embedded in workspace panes
67 CreateWindow bool
68}
69
70// GetDefaultConfig returns a Config with sensible defaults
71func GetDefaultConfig() *Config {
72 return &Config{
73 UserAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36",
74 EnableJavaScript: true,
75 EnableWebGL: true,
76 EnableMediaStream: true,
77 HardwareAcceleration: true,
78 DefaultFontSize: 16,
79 MinimumFontSize: 8,
80 EnablePageCache: true, // Instant back/forward navigation
81 EnableSmoothScrolling: true, // Better UX
82 CreateWindow: true, // Default to standalone window
83 }
84}