webkit2gtk

package module
v0.0.0-...-0651aa5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 20 Imported by: 0

README

webkit2gtk Go Reference Go Report Card License

pure go webkit library for gtk3 and gtk4.

[!WARNING]
This library is still in development and is not ready for production use.

Installation

go get github.com/malivvan/webkit2gtk

Dependencies

This library depends on either webkit2gtk-4.1 (gtk3) or webkitgtk-6.0 (gtk4) during runtime.

Debian / Ubuntu
apt install libwebkit2gtk-4.1

or

apt install libwebkitgtk-6.0
RHEL / Fedora
dnf install webkitgtk4

or

dnf install webkitgtk3
Arch Linux
pacman -S webkit2gtk-4.1

or

pacman -S webkitgtk-6.0
FreeBSD
pkg install webkit2-gtk3

or

pkg install webkit2-gtk4
OpenBSD
pkg_add webkitgtk41

or

pkg_add webkitgtk60

Credits

License

This project is licensed under the MIT License - see the LICENSE file for details

Documentation

Index

Constants

This section is empty.

Variables

View Source
var URLScheme = "app"
View Source
var UserAgent = "webkit2gtk"

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(options AppOptions) *App

func (*App) CurrentWindow

func (a *App) CurrentWindow() *Window

func (*App) Open

func (a *App) Open(options WindowOptions) (*Window, error)

Open opens a new window with the given options.

func (*App) Quit

func (a *App) Quit()

func (*App) Run

func (a *App) Run() error

type AppOptions

type AppOptions struct {
	Debug                  bool
	Name                   string
	LogLevel               string
	LogWriter              io.Writer
	HideOnLastWindowClosed bool
	PanicHandler           func(any)

	Binding map[string]interface{}
	Handler http.HandlerFunc
}

type WebkitSettings

type WebkitSettings struct {
	EnableJavascript                          bool
	AutoLoadImages                            bool
	LoadIconsIgnoringImageLoadSetting         bool
	EnableOfflineWebApplicationCache          bool
	EnableHtml5LocalStorage                   bool
	EnableHtml5Database                       bool
	EnableXssAuditor                          bool
	EnableFrameFlattening                     bool
	EnablePlugins                             bool
	EnableJava                                bool
	JavascriptCanOpenWindowsAutomatically     bool
	EnableHyperlinkAuditing                   bool
	DefaultFontFamily                         string
	MonospaceFontFamily                       string
	SerifFontFamily                           string
	SansSerifFontFamily                       string
	CursiveFontFamily                         string
	FantasyFontFamily                         string
	PictographFontFamily                      string
	DefaultFontSize                           uint32
	DefaultMonospaceFontSize                  uint32
	MinimumFontSize                           uint32
	DefaultCharset                            string
	EnableDeveloperExtras                     bool
	EnableResizableTextAreas                  bool
	EnableTabsToLinks                         bool
	EnableDnsPrefetching                      bool
	EnableCaretBrowsing                       bool
	EnableFullscreen                          bool
	PrintBackgrounds                          bool
	EnableWebAudio                            bool
	EnableWebgl                               bool
	AllowModalDialogs                         bool
	ZoomTextOnly                              bool
	JavascriptCanAccessClipboard              bool
	MediaPlaybackRequiresUserGesture          bool
	MediaPlaybackAllowsInline                 bool
	DrawCompositingIndicators                 bool
	EnableSiteSpecificQuirks                  bool
	EnablePageCache                           bool
	UserAgent                                 string
	EnableSmoothScrolling                     bool
	EnableAccelerated2DCanvas                 bool
	EnableWriteConsoleMessagesToStdout        bool
	EnableMediaStream                         bool
	EnableMockCaptureDevices                  bool
	EnableSpatialNavigation                   bool
	EnableMediaSource                         bool
	EnableEncryptedMedia                      bool
	EnableMediaCapabilities                   bool
	AllowFileAccessFromFileUrls               bool
	AllowUniversalAccessFromFileUrls          bool
	AllowTopNavigationToDataUrls              bool
	HardwareAccelerationPolicy                int
	EnableBackForwardNavigationGestures       bool
	EnableJavascriptMarkup                    bool
	EnableMedia                               bool
	MediaContentTypesRequiringHardwareSupport string
	EnableWebRTC                              bool
	DisableWebSecurity                        bool
}

type Window

type Window struct {
	// contains filtered or unexported fields
}

func (*Window) AddCSS

func (w *Window) AddCSS(css string)

func (*Window) Center

func (w *Window) Center()

func (*Window) Close

func (w *Window) Close()

func (*Window) DisableSizeConstraints

func (w *Window) DisableSizeConstraints()

func (*Window) ExecJS

func (w *Window) ExecJS(js string)

func (*Window) Focus

func (w *Window) Focus()

func (*Window) Fullscreen

func (w *Window) Fullscreen()

func (*Window) GetSize

func (w *Window) GetSize() (int, int)

func (*Window) GetZoom

func (w *Window) GetZoom() float64

func (*Window) Hide

func (w *Window) Hide()

func (*Window) ID

func (w *Window) ID() uint

func (*Window) IsFocused

func (w *Window) IsFocused() bool

func (*Window) IsFullscreen

func (w *Window) IsFullscreen() bool

func (*Window) IsMaximised

func (w *Window) IsMaximised() bool

func (*Window) IsMinimised

func (w *Window) IsMinimised() bool

func (*Window) Maximise

func (w *Window) Maximise()

func (*Window) Minimise

func (w *Window) Minimise()

func (*Window) Restore

func (w *Window) Restore()

func (*Window) SetFrameless

func (w *Window) SetFrameless(frameless bool)

func (*Window) SetMaxSize

func (w *Window) SetMaxSize(width, height int)

func (*Window) SetMinMaxSize

func (w *Window) SetMinMaxSize(minWidth, minHeight, maxWidth, maxHeight int)

func (*Window) SetMinSize

func (w *Window) SetMinSize(width, height int)

func (*Window) SetOverlay

func (w *Window) SetOverlay(alwaysOnTop bool)

func (*Window) SetSize

func (w *Window) SetSize(width, height int)

func (*Window) SetTitle

func (w *Window) SetTitle(title string)

func (*Window) SetURL

func (w *Window) SetURL(uri string)

func (*Window) SetZoom

func (w *Window) SetZoom(zoom float64)

func (*Window) Show

func (w *Window) Show()

func (*Window) ToggleDevTools

func (w *Window) ToggleDevTools()

func (*Window) Unfullscreen

func (w *Window) Unfullscreen()

func (*Window) Unmaximise

func (w *Window) Unmaximise()

func (*Window) Unminimise

func (w *Window) Unminimise()

func (*Window) ZoomIn

func (w *Window) ZoomIn()

func (*Window) ZoomOut

func (w *Window) ZoomOut()

func (*Window) ZoomReset

func (w *Window) ZoomReset()

type WindowOptions

type WindowOptions struct {
	// Name is a unique identifier of the window.
	Name string

	// Title is the title of the page.
	Title string

	// URL is the URL of the page to load.
	URL string

	// HTML Content to load (if URL is not set).
	HTML string

	// CSS to load after the page has loaded.
	CSS []string

	// JS to load after the page has loaded.
	JS []string

	// Define global Variables and APIs.
	Define map[string]interface{}

	// Width is the starting width of the window.
	Width int

	// Height is the starting height of the window.
	Height int

	// Overlay will make the window float above other windows.
	Overlay bool

	// Frameless will remove the window frame.
	Frameless bool

	// MinWidth is the minimum width of the window.
	MinWidth int

	// MinHeight is the minimum height of the window.
	MinHeight int

	// MaxWidth is the maximum width of the window.
	MaxWidth int

	// MaxHeight is the maximum height of the window.
	MaxHeight int

	// State indicates the state of the window when it is first shown.
	// Default: WindowStateNormal
	State WindowState

	// Centered will Center the window on the screen.
	Centered bool

	// Color specified the window color as a hex string (#RGB, #RGBA, #RRGGBB, #RRGGBBAA)
	Color string

	// X is the starting X position of the window.
	X int

	// Y is the starting Y position  of the window.
	Y int

	// Hidden will Hide the window when it is first created.
	Hidden bool

	// Zoom is the initial Zoom level of the window.
	Zoom float64

	// ZoomControlEnabled will enable the Zoom control.
	ZoomControlEnabled bool

	// OpenInspectorOnStartup will open the inspector when the window is first shown.
	OpenInspectorOnStartup bool

	// Focused indicates the window should be focused when initially shown
	Focused bool

	// HideOnClose will hide the window when it is closed instead of destroying it.
	HideOnClose bool

	// WebkitSettings exposes the underlying WebkitSettings object.
	WebkitSettings WebkitSettings
}

type WindowState

type WindowState int
const (
	WindowStateNormal WindowState = iota
	WindowStateMinimised
	WindowStateMaximised
	WindowStateFullscreen
)

Directories

Path Synopsis
examples
echo command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL