linux

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package linux implements the Linux backend (GTK 3 + WebKitGTK) in pure Go: the libraries are loaded at run time with purego, no cgo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestActivateMenuItem

func TestActivateMenuItem(handle uintptr, path ...string) error

TestActivateMenuItem activates an item of a window's menu bar, found by the labels along its path.

func TestDefaultURLHandler

func TestDefaultURLHandler(scheme string) string

TestDefaultURLHandler returns the id of the application GLib opens URLs of scheme with, as xdg-open and GTK apps do.

func TestDismissPopups

func TestDismissPopups() int

TestDismissPopups closes the context menus being shown, as if the user pressed Escape, and reports how many there were.

func TestMovePointer added in v0.1.5

func TestMovePointer(x, y int) bool

TestMovePointer moves the pointer to a point of the screen through the XTEST extension like a mouse would. It reports false without an X server.

func TestPressButton added in v0.1.5

func TestPressButton(press bool) bool

TestPressButton presses or releases the first mouse button the same way.

func TestPressKeys

func TestPressKeys(names ...string) bool

TestPressKeys presses keys, X keysym names such as "Control_L", together and releases them, through the XTEST extension like a keyboard would. It reports false without an X server.

func TestResizeCursor added in v0.1.5

func TestResizeCursor(handle uintptr) string

TestResizeCursor returns the name of the resize cursor a frameless window shows over an edge of its page, or "".

func TestSetDroppedFiles

func TestSetDroppedFiles(handle uintptr, paths []string)

TestSetDroppedFiles makes paths the files of the next drop on a window's page, as if they had been dragged there.

func TestUsePortalShortcuts

func TestUsePortalShortcuts(on bool) bool

TestUsePortalShortcuts makes global shortcuts bind through the XDG desktop portal, as on Wayland, and reports whether the desktop offers it.

Types

type Backend

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

Backend is the Linux (GTK 3 + WebKitGTK) implementation of platform.Backend.

func New

func New() *Backend

New creates the Linux backend. Libraries are loaded by Init so that programs still start (and report a clear error) on machines without GTK.

func (*Backend) App

func (b *Backend) App() platform.AppController

func (*Backend) Clipboard

func (b *Backend) Clipboard() platform.Clipboard

func (*Backend) Dialogs

func (b *Backend) Dialogs() platform.Dialogs

func (*Backend) Init

func (*Backend) IsMainThread

func (b *Backend) IsMainThread() bool

IsMainThread reports whether the caller runs on the thread the process started with, whose thread id is the process id. Package mygo locks the main goroutine to it, so this holds before Init too.

func (*Backend) Name

func (b *Backend) Name() string

func (*Backend) NewTray

func (b *Backend) NewTray(h platform.TrayHandler) (platform.Tray, error)

func (*Backend) NewWindow

func (*Backend) NotificationsSupported

func (b *Backend) NotificationsSupported() bool

func (*Backend) PopupMenu

func (b *Backend) PopupMenu(m *platform.Menu, pw platform.Window, pos *platform.Point)

PopupMenu shows a context menu and blocks until it is dismissed.

func (*Backend) Power

func (b *Backend) Power() platform.Power

func (*Backend) Quit

func (b *Backend) Quit()

func (*Backend) RegisterHotkey

func (b *Backend) RegisterHotkey(id int, acc string) error

func (*Backend) RemoveNotification

func (b *Backend) RemoveNotification(id string)

func (*Backend) Run

func (b *Backend) Run() error

func (*Backend) Screen

func (b *Backend) Screen() platform.Screen

func (*Backend) SetApplicationMenu

func (b *Backend) SetApplicationMenu(m *platform.Menu)

func (*Backend) Shell

func (b *Backend) Shell() platform.Shell

func (*Backend) ShowNotification

func (b *Backend) ShowNotification(n *platform.Notification) error

func (*Backend) Signal

func (b *Backend) Signal()

func (*Backend) Step

func (b *Backend) Step()

func (*Backend) Theme

func (b *Backend) Theme() platform.Theme

func (*Backend) UnregisterHotkey

func (b *Backend) UnregisterHotkey(id int)

func (*Backend) UpdateMenuItem

func (b *Backend) UpdateMenuItem(it *platform.MenuItem)

func (*Backend) Wake

func (b *Backend) Wake()

Jump to

Keyboard shortcuts

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