Documentation
¶
Index ¶
- Constants
- Variables
- func AddCSSProvider(css string) error
- func ApplyFiltersToWebView(view *WebView, filterJSON []byte) error
- func ApplyURISchemeHandlers(view *webkit.WebView) error
- func CleanupExpiredCertificateValidations() error
- func EvaluateJavascript(view *webkit.WebView, script string)
- func EvaluateJavascriptInWorld(view *webkit.WebView, script string, worldName string)
- func FaviconFinishSafe(database *webkit.FaviconDatabase, result gio.AsyncResulter) (*gdk.Texture, error)
- func FinishURISchemeRequest(req *webkit.URISchemeRequest, mimeType string, data []byte) error
- func GetGlobalNetworkSession() *webkit.NetworkSession
- func HashURL(pageURL string) []byte
- func IdleAdd(fn func() bool) uint
- func IdleRemove(sourceID uint)
- func InitMainThread()
- func InitPersistentSession(dataDir, cacheDir string) error
- func InitWebKitLogCapture() error
- func IsMainThread() bool
- func IsNativeAvailable() bool
- func JSCValueToString(value interface{}) string
- func NewBareRelatedWebView(parentView *webkit.WebView) *webkit.WebView
- func ParseURL(rawURL string) (*url.URL, error)
- func ParseWebViewID(idStr string) uint64
- func PrefersDarkTheme() bool
- func PrefetchDNS(hostname string)
- func QuitMainLoop()
- func RegisterURIScheme(scheme string, callback URISchemeRequestCallback)
- func RunMainLoop()
- func RunOnMainThread(fn func())
- func SaveTextureAsPNG(texture *gdk.Texture, path string, targetSize int) error
- func ScaleTexture(texture *gdk.Texture, targetWidth, targetHeight int) *gdk.Texture
- func SetupUserContentManager(view *webkit.WebView, appearanceConfigJSON string, webviewID uint64) error
- func SetupWebKitDebugLogging()
- func StartWebKitOutputCapture()
- func StopWebKitLogCapture()
- func TextureFromImageBytes(data []byte) (*gdk.Texture, error)
- func WidgetAddCSSClass(w gtk.Widgetter, className string)
- func WidgetAddController(w gtk.Widgetter, controller gtk.EventControllerer)
- func WidgetAddFocusController(w gtk.Widgetter, onEnter, onLeave func()) *gtk.EventControllerFocus
- func WidgetAddHoverHandler(w gtk.Widgetter, fn func()) *gtk.EventControllerMotion
- func WidgetAllocation(w gtk.Widgetter) (x, y, width, height int)
- func WidgetAttachClickHandler(w gtk.Widgetter, callback func()) *gtk.GestureClick
- func WidgetGetAllocation(w gtk.Widgetter) (x, y, width, height int)
- func WidgetGetBounds(w gtk.Widgetter) (x, y, width, height float64)
- func WidgetGetParent(w gtk.Widgetter) gtk.Widgetter
- func WidgetGetWindowBounds(w gtk.Widgetter) (x, y, width, height int)
- func WidgetGrabFocus(w gtk.Widgetter)
- func WidgetHasCSSClass(w gtk.Widgetter, className string) bool
- func WidgetHide(w gtk.Widgetter)
- func WidgetIsValid(w gtk.Widgetter) bool
- func WidgetQueueAllocate(w gtk.Widgetter)
- func WidgetQueueDraw(w gtk.Widgetter)
- func WidgetQueueResize(w gtk.Widgetter)
- func WidgetRealize(w gtk.Widgetter)
- func WidgetRealizeInContainer(w gtk.Widgetter, container gtk.Widgetter)
- func WidgetRemoveCSSClass(w gtk.Widgetter, className string)
- func WidgetRemoveFocusController(w gtk.Widgetter, controller *gtk.EventControllerFocus)
- func WidgetRemoveHoverHandler(w gtk.Widgetter, controller *gtk.EventControllerMotion)
- func WidgetSetFocusChild(w gtk.Widgetter, child gtk.Widgetter)
- func WidgetSetHExpand(w gtk.Widgetter, expand bool)
- func WidgetSetMargin(w gtk.Widgetter, margin int)
- func WidgetSetMarginBottom(w gtk.Widgetter, margin int)
- func WidgetSetMarginEnd(w gtk.Widgetter, margin int)
- func WidgetSetMarginStart(w gtk.Widgetter, margin int)
- func WidgetSetMarginTop(w gtk.Widgetter, margin int)
- func WidgetSetSizeRequest(w gtk.Widgetter, width, height int)
- func WidgetSetVExpand(w gtk.Widgetter, expand bool)
- func WidgetSetVisible(w gtk.Widgetter, visible bool)
- func WidgetShow(w gtk.Widgetter)
- func WidgetUnparent(w gtk.Widgetter)
- type Box
- type Config
- type ContentBlockingManager
- type FaviconDatabase
- type GdkTexture
- type Image
- type Label
- type Paned
- func (p *Paned) AsWidget() gtk.Widgetter
- func (p *Paned) EndChild() gtk.Widgetter
- func (p *Paned) GetPosition() int
- func (p *Paned) SetEndChild(child gtk.Widgetter)
- func (p *Paned) SetPosition(pos int)
- func (p *Paned) SetResizeEndChild(resize bool)
- func (p *Paned) SetResizeStartChild(resize bool)
- func (p *Paned) SetStartChild(child gtk.Widgetter)
- func (p *Paned) StartChild() gtk.Widgetter
- type TLSCertificateInfo
- type URISchemeHandler
- type URISchemeRequestCallback
- type WebView
- func (w *WebView) AsWidget() gtk.Widgetter
- func (w *WebView) AttachKeyboardBridge()
- func (w *WebView) AttachMouseGestures()
- func (w *WebView) AttachTouchpadGestures()
- func (w *WebView) Destroy() error
- func (w *WebView) DispatchCustomEvent(eventName string, data interface{}) error
- func (w *WebView) GetCurrentURL() string
- func (w *WebView) GetFaviconDatabase() *webkit.FaviconDatabase
- func (w *WebView) GetTitle() string
- func (w *WebView) GetWebView() *webkit.WebView
- func (w *WebView) GetZoom() float64
- func (w *WebView) GoBack() error
- func (w *WebView) GoForward() error
- func (w *WebView) GtkWebView() *webkit.WebView
- func (w *WebView) Hide() error
- func (w *WebView) ID() uint64
- func (w *WebView) IDString() string
- func (w *WebView) InitializeContentBlocking(filterJSON []byte) error
- func (w *WebView) InitializeFromBare(cfg *Config) error
- func (w *WebView) InjectScript(script string) error
- func (w *WebView) IsActive() bool
- func (w *WebView) IsDestroyed() bool
- func (w *WebView) LoadURL(url string) error
- func (w *WebView) OnNavigate(handler func(url string))
- func (w *WebView) OnWindowTypeDetected(handler func(WindowType, *WindowFeatures))
- func (w *WebView) RegisterCloseHandler(handler func())
- func (w *WebView) RegisterFaviconChangedHandler(handler func([]byte))
- func (w *WebView) RegisterFaviconURIChangedHandler(handler func(pageURI, faviconURI string))
- func (w *WebView) RegisterKeyboardShortcut(key string, modifiers uint, handler func()) error
- func (w *WebView) RegisterLoadCommittedHandler(handler func(string))
- func (w *WebView) RegisterMiddleClickLinkHandler(handler func(url string) bool)
- func (w *WebView) RegisterNavigationPolicyHandler(handler func(url string, isUserGesture bool) bool)
- func (w *WebView) RegisterPaneModeHandler(handler func(action string) bool, isActiveChecker func() bool)
- func (w *WebView) RegisterPopupCreateHandler(handler func(*webkit.NavigationAction) *WebView)
- func (w *WebView) RegisterReadyToShowHandler(handler func())
- func (w *WebView) RegisterScriptMessageHandler(handler func(string))
- func (w *WebView) RegisterTitleChangedHandler(handler func(string))
- func (w *WebView) RegisterURIChangedHandler(handler func(string))
- func (w *WebView) RegisterWorkspaceNavigationHandler(handler func(direction string) bool)
- func (w *WebView) RegisterZoomChangedHandler(handler func(float64))
- func (w *WebView) Reload() error
- func (w *WebView) ReloadBypassCache() error
- func (w *WebView) RootWidget() gtk.Widgetter
- func (w *WebView) RunOnMainThread(fn func())
- func (w *WebView) SeedDomZoom(zoom float64) error
- func (w *WebView) SetWindowFeatures(features *WindowFeatures)
- func (w *WebView) SetZoom(zoom float64) error
- func (w *WebView) Show() error
- func (w *WebView) ShowDevTools() error
- func (w *WebView) ShowPrintDialog() error
- func (w *WebView) UpdateContentFilters(rules string) error
- func (w *WebView) UsesDomZoom() bool
- func (w *WebView) Widget() gtk.Widgetter
- func (w *WebView) Window() *Window
- type Window
- func (w *Window) AsWindow() *gtk.Window
- func (w *Window) Close()
- func (w *Window) Destroy()
- func (w *Window) InitializeGlobalShortcuts(shortcuts map[string]func())
- func (w *Window) Present()
- func (w *Window) SetChild(child gtk.Widgetter)
- func (w *Window) SetDefaultSize(width, height int)
- func (w *Window) SetTitle(title string)
- func (w *Window) Show()
- type WindowFeatures
- type WindowShortcuts
- type WindowType
Constants ¶
const ( // DumberIsolatedWorld is the name of the isolated JavaScript world // where Dumber's GUI scripts run. This prevents page scripts from // interfering with the browser's UI components. DumberIsolatedWorld = "dumber-isolated" )
Variables ¶
var ( // ErrNotImplemented indicates a feature is not yet implemented ErrNotImplemented = errors.New("webkit: not implemented") // ErrWebViewNotInitialized indicates the WebView was not properly initialized ErrWebViewNotInitialized = errors.New("webkit: webview not initialized") // ErrWebViewDestroyed indicates the WebView has been destroyed ErrWebViewDestroyed = errors.New("webkit: webview destroyed") // ErrInvalidURL indicates an invalid URL was provided ErrInvalidURL = errors.New("webkit: invalid URL") // ErrMainThreadRequired indicates an operation must be called from the main thread ErrMainThreadRequired = errors.New("webkit: operation must be called from main thread") )
Functions ¶
func AddCSSProvider ¶ added in v0.9.0
AddCSSProvider adds a CSS provider for styling
func ApplyFiltersToWebView ¶ added in v0.12.0
ApplyFiltersToWebView applies content blocking filters to a WebView
func ApplyURISchemeHandlers ¶ added in v0.12.0
ApplyURISchemeHandlers registers all pending URI schemes on the WebContext This should be called after creating the first WebView
func CleanupExpiredCertificateValidations ¶ added in v0.12.0
func CleanupExpiredCertificateValidations() error
CleanupExpiredCertificateValidations removes expired certificate validations from the database This should be called on application startup
func EvaluateJavascript ¶ added in v0.12.0
EvaluateJavascript executes JavaScript code in the WebView in the default world This is a wrapper around webkit_web_view_evaluate_javascript that wasn't generated by gotk4
func EvaluateJavascriptInWorld ¶ added in v0.12.0
EvaluateJavascriptInWorld executes JavaScript code in a specific world Pass empty string for worldName to use the main/page world
func FaviconFinishSafe ¶ added in v0.12.1
func FaviconFinishSafe(database *webkit.FaviconDatabase, result gio.AsyncResulter) (*gdk.Texture, error)
FaviconFinishSafe mirrors gotk4's FaviconFinish but guards against NULL returns.
func FinishURISchemeRequest ¶ added in v0.12.0
func FinishURISchemeRequest(req *webkit.URISchemeRequest, mimeType string, data []byte) error
FinishURISchemeRequest finishes a URI scheme request with data
func GetGlobalNetworkSession ¶ added in v0.12.0
func GetGlobalNetworkSession() *webkit.NetworkSession
GetGlobalNetworkSession returns the global network session. Returns nil if InitPersistentSession hasn't been called successfully.
func IdleAdd ¶ added in v0.9.0
IdleAdd adds a function to be called in an idle callback Returns an idle source ID that can be used with IdleRemove
func IdleRemove ¶ added in v0.11.0
func IdleRemove(sourceID uint)
IdleRemove removes an idle callback by its source ID
func InitMainThread ¶ added in v0.11.0
func InitMainThread()
InitMainThread locks the current goroutine to the OS thread for GTK operations and initializes GTK. This must be called before any GTK operations.
func InitPersistentSession ¶ added in v0.12.0
InitPersistentSession creates and initializes a persistent NetworkSession with the provided data and cache directories. This should be called before creating any WebViews to ensure they use persistent storage. Returns an error if initialization fails.
IMPORTANT: Once created, this session is stored globally and will be used by all WebViews created afterward, as per WebKitGTK 6.0's design where the first created session becomes the default for the network process.
func InitWebKitLogCapture ¶ added in v0.5.0
func InitWebKitLogCapture() error
InitWebKitLogCapture initializes WebKit log capture In gotk4, WebKit logging is handled differently
func IsMainThread ¶ added in v0.11.0
func IsMainThread() bool
IsMainThread returns true if called from the GTK main thread.
func IsNativeAvailable ¶
func IsNativeAvailable() bool
IsNativeAvailable returns true if the native GTK/WebKit libraries are available In gotk4, this is always true if the import succeeded
func JSCValueToString ¶ added in v0.12.0
func JSCValueToString(value interface{}) string
JSCValueToString converts a JSCValue from a GTK signal to a Go string
func NewBareRelatedWebView ¶ added in v0.12.0
NewBareRelatedWebView creates a bare gotk4 WebView with the related-view property set This ensures the popup shares the same session/process context as the parent The returned WebView is bare (no wrapper, no initialization) and must be initialized later
Since gotk4-webkitgtk's wrapWebView() is internal and cannot be accessed, we manually construct the WebView struct hierarchy using CGO.
func ParseWebViewID ¶ added in v0.12.0
ParseWebViewID converts a string WebView ID to uint64 Returns 0 if the string cannot be parsed
func PrefersDarkTheme ¶ added in v0.10.0
func PrefersDarkTheme() bool
PrefersDarkTheme checks if the system prefers dark theme
func PrefetchDNS ¶ added in v0.13.0
func PrefetchDNS(hostname string)
PrefetchDNS prefetches DNS for the given hostname to speed up future requests. This is useful for preloading DNS for links that the user might click. Safe to call even if the hostname is invalid or session is not initialized.
func RegisterURIScheme ¶ added in v0.12.0
func RegisterURIScheme(scheme string, callback URISchemeRequestCallback)
RegisterURIScheme registers a custom URI scheme handler In WebKitGTK 6.0, this must be called BEFORE creating any WebViews The actual registration happens in InitPersistentSession
func RunMainLoop ¶
func RunMainLoop()
RunMainLoop starts the GTK main event loop. This function blocks until QuitMainLoop is called.
func RunOnMainThread ¶ added in v0.12.0
func RunOnMainThread(fn func())
RunOnMainThread executes a function on the GTK main thread. If already on the main thread, executes immediately. Otherwise, schedules the function via glib.IdleAdd.
func SaveTextureAsPNG ¶ added in v0.12.1
SaveTextureAsPNG saves a GdkTexture as a PNG file at target size WebKit provides GdkTexture which can be any format (ICO, PNG, JPEG, SVG) This function normalizes everything to PNG at the target size (32x32)
func ScaleTexture ¶ added in v0.12.1
ScaleTexture scales a texture to the target size using GdkPixbuf Uses high-quality bilinear interpolation
func SetupUserContentManager ¶ added in v0.12.0
func SetupUserContentManager(view *webkit.WebView, appearanceConfigJSON string, webviewID uint64) error
SetupUserContentManager configures UserContentManager for the WebView This injects GUI scripts at document-start and registers message handlers
func SetupWebKitDebugLogging ¶ added in v0.7.0
func SetupWebKitDebugLogging()
SetupWebKitDebugLogging enables WebKit debug logging
func StartWebKitOutputCapture ¶ added in v0.5.0
func StartWebKitOutputCapture()
StartWebKitOutputCapture starts capturing WebKit output
func StopWebKitLogCapture ¶ added in v0.5.0
func StopWebKitLogCapture()
StopWebKitLogCapture stops WebKit log capture
func TextureFromImageBytes ¶ added in v0.12.1
TextureFromImageBytes creates a texture from raw image bytes. Supported formats depend on the available GdkPixbuf loaders (PNG, SVG, etc.).
func WidgetAddCSSClass ¶ added in v0.9.0
WidgetAddCSSClass adds a CSS class to a widget
func WidgetAddController ¶ added in v0.12.0
func WidgetAddController(w gtk.Widgetter, controller gtk.EventControllerer)
WidgetAddController adds an event controller to a widget
func WidgetAddFocusController ¶ added in v0.11.0
func WidgetAddFocusController(w gtk.Widgetter, onEnter, onLeave func()) *gtk.EventControllerFocus
WidgetAddFocusController adds a focus event controller to a widget
func WidgetAddHoverHandler ¶ added in v0.9.0
func WidgetAddHoverHandler(w gtk.Widgetter, fn func()) *gtk.EventControllerMotion
WidgetAddHoverHandler registers a hover callback for the given widget and returns a controller that can be used to detach it later.
func WidgetAllocation ¶ added in v0.11.0
WidgetAllocation returns the widget's allocation (alias for WidgetGetAllocation)
func WidgetAttachClickHandler ¶ added in v0.14.0
func WidgetAttachClickHandler(w gtk.Widgetter, callback func()) *gtk.GestureClick
WidgetAttachClickHandler attaches a left-click handler to a widget
func WidgetGetAllocation ¶ added in v0.11.0
WidgetGetAllocation returns the widget's allocated area
func WidgetGetBounds ¶ added in v0.9.0
WidgetGetBounds returns the widget's bounds relative to its parent
func WidgetGetParent ¶ added in v0.9.0
WidgetGetParent returns the parent widget
func WidgetGetWindowBounds ¶ added in v0.14.0
WidgetGetWindowBounds returns the widget's bounds relative to the toplevel window This provides window-absolute coordinates needed for navigation geometry calculations
func WidgetGrabFocus ¶ added in v0.9.0
WidgetGrabFocus gives focus to a widget
func WidgetHasCSSClass ¶ added in v0.11.0
WidgetHasCSSClass checks if a widget has a CSS class
func WidgetHide ¶ added in v0.11.0
WidgetHide makes a widget invisible
func WidgetIsValid ¶ added in v0.9.0
WidgetIsValid checks if a widget pointer is valid (non-nil)
func WidgetQueueAllocate ¶ added in v0.9.0
WidgetQueueAllocate queues an allocate operation
func WidgetQueueDraw ¶ added in v0.11.0
WidgetQueueDraw queues a redraw operation
func WidgetQueueResize ¶ added in v0.11.0
WidgetQueueResize queues a resize operation
func WidgetRealize ¶ added in v0.12.0
WidgetRealize realizes a widget
func WidgetRealizeInContainer ¶ added in v0.9.0
WidgetRealizeInContainer realizes a widget within a container
func WidgetRemoveCSSClass ¶ added in v0.9.0
WidgetRemoveCSSClass removes a CSS class from a widget
func WidgetRemoveFocusController ¶ added in v0.11.0
func WidgetRemoveFocusController(w gtk.Widgetter, controller *gtk.EventControllerFocus)
WidgetRemoveFocusController removes a focus event controller from a widget
func WidgetRemoveHoverHandler ¶ added in v0.9.0
func WidgetRemoveHoverHandler(w gtk.Widgetter, controller *gtk.EventControllerMotion)
WidgetRemoveHoverHandler removes a previously registered hover controller
func WidgetSetFocusChild ¶ added in v0.11.0
WidgetSetFocusChild sets the focus child of a widget
func WidgetSetHExpand ¶ added in v0.9.0
WidgetSetHExpand sets whether the widget should expand horizontally
func WidgetSetMargin ¶ added in v0.11.0
WidgetSetMargin sets all margins for a widget
func WidgetSetMarginBottom ¶ added in v0.11.0
WidgetSetMarginBottom sets the bottom margin for a widget
func WidgetSetMarginEnd ¶ added in v0.11.0
WidgetSetMarginEnd sets the end margin for a widget
func WidgetSetMarginStart ¶ added in v0.11.0
WidgetSetMarginStart sets the start margin for a widget
func WidgetSetMarginTop ¶ added in v0.11.0
WidgetSetMarginTop sets the top margin for a widget
func WidgetSetSizeRequest ¶ added in v0.11.0
WidgetSetSizeRequest sets the minimum size request
func WidgetSetVExpand ¶ added in v0.9.0
WidgetSetVExpand sets whether the widget should expand vertically
func WidgetSetVisible ¶ added in v0.11.0
WidgetSetVisible sets the visibility of a widget
func WidgetShow ¶ added in v0.9.0
WidgetShow makes a widget visible
func WidgetUnparent ¶ added in v0.9.0
WidgetUnparent removes a widget from its parent
Types ¶
type Box ¶ added in v0.12.0
type Box struct {
// contains filtered or unexported fields
}
Box wraps gtk.Box for layout management
func NewBox ¶ added in v0.11.0
func NewBox(orientation gtk.Orientation, spacing int) *Box
NewBox creates a new Box with the given orientation and spacing
func (*Box) InsertChildAfter ¶ added in v0.12.0
InsertChildAfter inserts a child after the specified sibling
type Config ¶
type Config struct {
// UserAgent string for the WebView
UserAgent string
// EnableJavaScript controls JavaScript execution
EnableJavaScript bool
// EnableWebGL controls WebGL support
EnableWebGL bool
// EnableMediaStream controls media stream support
EnableMediaStream bool
// HardwareAcceleration controls GPU acceleration
HardwareAcceleration bool
// DefaultFontSize in pixels
DefaultFontSize int
// MinimumFontSize in pixels
MinimumFontSize int
// Performance optimizations
// EnablePageCache enables back/forward cache for instant navigation
EnablePageCache bool
// EnableSmoothScrolling enables smooth scrolling animations
EnableSmoothScrolling bool
// DataDir is the directory for persistent data (cookies, localStorage, etc.)
DataDir string
// CacheDir is the directory for HTTP cache
CacheDir string
// AppearanceConfigJSON is the JSON string for appearance configuration
// This will be injected at document-start via UserContentManager
AppearanceConfigJSON string
// CreateWindow controls whether to create a standalone GTK Window for this WebView
// Set to false for WebViews that will be embedded in workspace panes
CreateWindow bool
}
Config holds WebView configuration
func GetDefaultConfig ¶ added in v0.12.0
func GetDefaultConfig() *Config
GetDefaultConfig returns a Config with sensible defaults
type ContentBlockingManager ¶ added in v0.12.0
type ContentBlockingManager struct {
// contains filtered or unexported fields
}
ContentBlockingManager handles WebKit content filtering
func NewContentBlockingManager ¶ added in v0.12.0
func NewContentBlockingManager(storagePath string) (*ContentBlockingManager, error)
NewContentBlockingManager creates a new content blocking manager
func (*ContentBlockingManager) ApplyFiltersFromJSON ¶ added in v0.12.0
func (cbm *ContentBlockingManager) ApplyFiltersFromJSON(ucm *webkit.UserContentManager, identifier string, jsonRules []byte) error
ApplyFiltersFromJSON compiles and applies WebKit JSON filter rules to a UserContentManager The jsonRules parameter should be a JSON array of WebKit content blocker rules
func (*ContentBlockingManager) GetFilterStore ¶ added in v0.12.0
func (cbm *ContentBlockingManager) GetFilterStore() *webkit.UserContentFilterStore
GetFilterStore returns the underlying UserContentFilterStore
func (*ContentBlockingManager) RemoveAllFilters ¶ added in v0.12.0
func (cbm *ContentBlockingManager) RemoveAllFilters(ucm *webkit.UserContentManager)
RemoveAllFilters removes all content filters from a UserContentManager
type FaviconDatabase ¶ added in v0.12.1
type FaviconDatabase = webkit.FaviconDatabase
FaviconDatabase is an alias for WebKit's FaviconDatabase
type GdkTexture ¶ added in v0.12.1
GdkTexture is an alias for gotk4's Texture type
type Image ¶ added in v0.12.0
type Image struct {
// contains filtered or unexported fields
}
Image wraps gtk.Image for displaying images (e.g., favicons)
func NewImageFromFile ¶ added in v0.12.0
NewImageFromFile creates a new Image from a file
func (*Image) SetFromFile ¶ added in v0.12.0
SetFromFile loads an image from a file
func (*Image) SetPixelSize ¶ added in v0.12.0
SetPixelSize sets the pixel size for the image
type Label ¶ added in v0.12.0
type Label struct {
// contains filtered or unexported fields
}
Label wraps gtk.Label for text display
func (*Label) SetEllipsize ¶ added in v0.12.0
func (l *Label) SetEllipsize(mode pango.EllipsizeMode)
SetEllipsize sets the ellipsization mode
func (*Label) SetMaxWidthChars ¶ added in v0.12.0
SetMaxWidthChars sets the maximum width in characters
type Paned ¶ added in v0.12.0
type Paned struct {
// contains filtered or unexported fields
}
Paned wraps gtk.Paned for split pane layouts
func NewPaned ¶ added in v0.9.0
func NewPaned(orientation gtk.Orientation) *Paned
NewPaned creates a new Paned widget with the given orientation
func (*Paned) GetPosition ¶ added in v0.12.0
GetPosition returns the divider position
func (*Paned) SetEndChild ¶ added in v0.12.0
SetEndChild sets the second child of the paned
func (*Paned) SetPosition ¶ added in v0.12.0
SetPosition sets the divider position
func (*Paned) SetResizeEndChild ¶ added in v0.12.0
SetResizeEndChild sets whether the end child should resize
func (*Paned) SetResizeStartChild ¶ added in v0.12.0
SetResizeStartChild sets whether the start child should resize
func (*Paned) SetStartChild ¶ added in v0.12.0
SetStartChild sets the first child of the paned
func (*Paned) StartChild ¶ added in v0.12.0
StartChild returns the start child
type TLSCertificateInfo ¶ added in v0.12.0
type TLSCertificateInfo struct {
Subject string
Issuer string
NotBefore string
NotAfter string
IsExpired bool
Errors []string
}
TLSCertificateInfo holds information about a TLS certificate for display
type URISchemeHandler ¶ added in v0.12.0
type URISchemeHandler struct {
// contains filtered or unexported fields
}
URISchemeHandler stores registered URI scheme handlers
type URISchemeRequestCallback ¶ added in v0.12.0
type URISchemeRequestCallback func(request *webkit.URISchemeRequest)
URISchemeRequestCallback is called when a custom URI scheme is requested
type WebView ¶
type WebView struct {
// contains filtered or unexported fields
}
WebView wraps a WebKitGTK WebView
func NewWebView ¶
NewWebView creates a new WebView with the given configuration
func WrapBareWebView ¶ added in v0.12.0
WrapBareWebView creates a minimal WebView wrapper around a bare gotk4 WebView This is used during popup creation to return a WebView to WebKit before initialization Full initialization (container, scripts, event handlers) should be done later
func (*WebView) AttachKeyboardBridge ¶ added in v0.12.0
func (w *WebView) AttachKeyboardBridge()
TODO(#8): Refactor this function to reduce cyclomatic complexity (52 -> <30)
AttachKeyboardBridge attaches an EventControllerKey to bridge keyboard events to JavaScript This is critical for allowing JavaScript KeyboardService to receive keyboard events that would otherwise be consumed by GTK shortcuts
func (*WebView) AttachMouseGestures ¶ added in v0.12.1
func (w *WebView) AttachMouseGestures()
AttachMouseGestures attaches mouse button gesture handling to the WebView This enables hardware mouse button navigation (back/forward buttons)
func (*WebView) AttachTouchpadGestures ¶ added in v0.12.1
func (w *WebView) AttachTouchpadGestures()
AttachTouchpadGestures attaches touchpad swipe gesture handling to the WebView This enables two-finger swipe navigation (left/right for back/forward)
func (*WebView) DispatchCustomEvent ¶ added in v0.9.0
DispatchCustomEvent dispatches a custom event via JavaScript This works across JavaScript world boundaries because it uses document.dispatchEvent. GUI scripts running in the isolated world (see DumberIsolatedWorld in user_content.go) can listen for these events because they share the same Document object with the main world.
func (*WebView) GetCurrentURL ¶
GetCurrentURL returns the current URL
func (*WebView) GetFaviconDatabase ¶ added in v0.12.1
func (w *WebView) GetFaviconDatabase() *webkit.FaviconDatabase
GetFaviconDatabase returns the WebKit FaviconDatabase for this WebView Returns nil if the favicon database is not available
func (*WebView) GetWebView ¶ added in v0.12.0
GetWebView returns the underlying webkit.WebView for advanced operations
func (*WebView) GtkWebView ¶ added in v0.12.0
GtkWebView returns the underlying gotk4 WebView for advanced operations This is used when creating related views (popups) that need to share the same session
func (*WebView) IDString ¶ added in v0.12.0
IDString returns the WebView ID as a string This is a convenience method for compatibility with code expecting string IDs
func (*WebView) InitializeContentBlocking ¶ added in v0.8.0
InitializeContentBlocking initializes content blocking with filter lists
func (*WebView) InitializeFromBare ¶ added in v0.12.0
InitializeFromBare completes initialization of a bare WebView wrapper This should be called in ready-to-show after WebKit has configured the view
func (*WebView) InjectScript ¶
InjectScript executes JavaScript in the WebView
func (*WebView) IsActive ¶ added in v0.9.0
IsActive returns whether this WebView is currently active/focused
func (*WebView) IsDestroyed ¶ added in v0.10.0
IsDestroyed returns true if the WebView has been destroyed
func (*WebView) OnNavigate ¶ added in v0.8.0
OnNavigate registers a navigation handler
func (*WebView) OnWindowTypeDetected ¶ added in v0.9.0
func (w *WebView) OnWindowTypeDetected(handler func(WindowType, *WindowFeatures))
OnWindowTypeDetected registers a handler for window type detection
func (*WebView) RegisterCloseHandler ¶ added in v0.9.0
func (w *WebView) RegisterCloseHandler(handler func())
RegisterCloseHandler registers a handler for close requests
func (*WebView) RegisterFaviconChangedHandler ¶ added in v0.10.0
RegisterFaviconChangedHandler registers a handler for favicon changes
func (*WebView) RegisterFaviconURIChangedHandler ¶ added in v0.10.0
RegisterFaviconURIChangedHandler registers a handler for favicon URI changes
func (*WebView) RegisterKeyboardShortcut ¶
RegisterKeyboardShortcut registers a keyboard shortcut handler This is a compatibility method - actual shortcut handling is done at the window level
func (*WebView) RegisterLoadCommittedHandler ¶ added in v0.14.0
RegisterLoadCommittedHandler registers a handler for load committed events This fires when the page actually starts loading new content (after URI change)
func (*WebView) RegisterMiddleClickLinkHandler ¶ added in v0.14.0
RegisterMiddleClickLinkHandler registers a handler for middle mouse button clicks on links The handler receives the link URL and returns true if handled
func (*WebView) RegisterNavigationPolicyHandler ¶ added in v0.11.0
func (w *WebView) RegisterNavigationPolicyHandler(handler func(url string, isUserGesture bool) bool)
RegisterNavigationPolicyHandler registers a handler for navigation policy decisions
func (*WebView) RegisterPaneModeHandler ¶ added in v0.12.0
func (w *WebView) RegisterPaneModeHandler(handler func(action string) bool, isActiveChecker func() bool)
RegisterPaneModeHandler registers a handler for pane mode shortcuts The handler receives the action ("enter", "close", "split-right", etc.) and returns true if handled
func (*WebView) RegisterPopupCreateHandler ¶ added in v0.12.0
func (w *WebView) RegisterPopupCreateHandler(handler func(*webkit.NavigationAction) *WebView)
RegisterPopupCreateHandler registers a handler for WebKit's create signal This is called when JavaScript calls window.open() or a link with target="_blank" is clicked The handler should create and return a new WebView for the popup, or return nil to block it The returned WebView should NOT be shown yet - WebKit will emit ready-to-show when it's ready
func (*WebView) RegisterReadyToShowHandler ¶ added in v0.12.0
func (w *WebView) RegisterReadyToShowHandler(handler func())
RegisterReadyToShowHandler registers a handler for WebKit's ready-to-show signal This is called when a popup WebView is ready to be displayed At this point it's safe to insert the popup into the UI (workspace, window, etc.)
func (*WebView) RegisterScriptMessageHandler ¶
RegisterScriptMessageHandler registers a handler for script messages
func (*WebView) RegisterTitleChangedHandler ¶
RegisterTitleChangedHandler registers a handler for title changes
func (*WebView) RegisterURIChangedHandler ¶
RegisterURIChangedHandler registers a handler for URI changes
func (*WebView) RegisterWorkspaceNavigationHandler ¶ added in v0.12.0
RegisterWorkspaceNavigationHandler registers a handler for workspace pane navigation The handler receives the direction ("up", "down", "left", "right") and returns true if handled
func (*WebView) RegisterZoomChangedHandler ¶ added in v0.3.0
RegisterZoomChangedHandler registers a handler for zoom changes
func (*WebView) ReloadBypassCache ¶ added in v0.6.0
ReloadBypassCache reloads the current page, bypassing cache
func (*WebView) RootWidget ¶ added in v0.9.0
RootWidget returns the root container widget for this WebView This is the GtkBox container that holds the WebView and can be reparented
func (*WebView) RunOnMainThread ¶ added in v0.9.0
func (w *WebView) RunOnMainThread(fn func())
RunOnMainThread executes a function on the GTK main thread
func (*WebView) SeedDomZoom ¶ added in v0.9.0
SeedDomZoom is a no-op in gotk4 as we use viewport zoom
func (*WebView) SetWindowFeatures ¶ added in v0.9.0
func (w *WebView) SetWindowFeatures(features *WindowFeatures)
SetWindowFeatures sets window features for popup windows
func (*WebView) ShowDevTools ¶
ShowDevTools opens the WebKit inspector/developer tools
func (*WebView) ShowPrintDialog ¶ added in v0.10.0
ShowPrintDialog shows the print dialog for the current page
func (*WebView) UpdateContentFilters ¶ added in v0.8.0
UpdateContentFilters updates the content filtering rules
func (*WebView) UsesDomZoom ¶ added in v0.9.0
UsesDomZoom indicates if this WebView uses DOM-based zoom In gotk4/WebKitGTK, zoom is always viewport-based
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window wraps a GTK Window for the browser
func (*Window) AsWindow ¶ added in v0.12.0
AsWindow returns the underlying gtk.Window for advanced operations
func (*Window) InitializeGlobalShortcuts ¶ added in v0.9.0
InitializeGlobalShortcuts initializes global keyboard shortcuts for a window
func (*Window) Present ¶ added in v0.12.0
func (w *Window) Present()
Present brings the window to the front
func (*Window) SetDefaultSize ¶ added in v0.12.0
SetDefaultSize sets the default window size
type WindowFeatures ¶ added in v0.9.0
type WindowFeatures struct {
Width int
Height int
ToolbarVisible bool
LocationbarVisible bool
MenubarVisible bool
Resizable bool
}
WindowFeatures describes the window features detected from WebKitWindowProperties
type WindowShortcuts ¶ added in v0.9.0
type WindowShortcuts struct {
// contains filtered or unexported fields
}
WindowShortcuts manages keyboard shortcuts for a window
func NewWindowShortcuts ¶ added in v0.12.0
func NewWindowShortcuts(win *Window) *WindowShortcuts
NewWindowShortcuts creates a new WindowShortcuts manager
func (*WindowShortcuts) RegisterShortcut ¶ added in v0.12.0
func (ws *WindowShortcuts) RegisterShortcut(accelerator string, handler func())
RegisterShortcut registers a keyboard shortcut
type WindowType ¶ added in v0.9.0
type WindowType int
WindowType indicates how a new WebView should be treated
const ( // WindowTypeTab represents an independent WebView (future: tab) WindowTypeTab WindowType = iota // WindowTypePopup represents a related WebView (shares process/context) WindowTypePopup // WindowTypeUnknown indicates type not detected yet WindowTypeUnknown )