sys

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package sys binds the platform code. Public packages validate arguments and call it; it never selects behavior by OS outside build tags.

Index

Constants

View Source
const (
	ModCtrl = 1 << iota
	ModAlt
	ModShift
	ModCmd
)

Modifier bits understood by the native hotkey code.

View Source
const ClipboardByteLimit = clipboardByteLimit

ClipboardByteLimit bounds one clipboard snapshot.

Variables

This section is empty.

Functions

func Capture

func Capture(id uint32) ([]byte, error)

Capture reads the display's pixels from the root window and encodes them as PNG. It handles the 24- and 32-bit true color visuals X servers use.

func Click

func Click(button int) error

func ClipboardRead

func ClipboardRead(done func([]byte, error))

func CollectMIMEClipboard added in v0.0.4

func CollectMIMEClipboard(targets map[string]bool, read func(string) ([]byte, error)) ([]byte, error)

CollectMIMEClipboard builds a snapshot from MIME-typed data, as X11 and Wayland offer it; targets lists the offered types.

func HasKey

func HasKey(key string) bool

func Hotkey

func Hotkey(key string, mods uint, fn func()) (func() error, error)

Hotkey grabs key+mods; fn runs on its own goroutine and presses that arrive while it runs are merged.

func Key

func Key(key string, down bool) error

func MouseMove

func MouseMove(px, py float64) error

func MousePosition

func MousePosition() (float64, float64, error)

func NotificationAvailable

func NotificationAvailable() bool

func NotificationPermission

func NotificationPermission(done func(error))

func NotificationPost

func NotificationPost(id, title, body string, done func(error))

func NotificationPostActivated

func NotificationPostActivated(id, title, body string, onClick func(string), done func(error))

func NotificationPostInteractive

func NotificationPostInteractive(id, title, body string, onClick func(), done func(error))

func NotificationRemove

func NotificationRemove(id string, done func(error))

func Permission

func Permission(kind int, request bool) (bool, error)

func ProcessDirectory added in v0.1.6

func ProcessDirectory(pid int) (string, error)

func ProcessForegroundPID added in v0.1.6

func ProcessForegroundPID(fd uintptr) (int, error)

Types

type Display

type Display struct {
	ID                      uint32
	X, Y, Width, Height     float64
	PixelWidth, PixelHeight int
	Primary                 bool
}

Display bounds are logical points; the origin is the primary display's top left.

func Displays

func Displays() ([]Display, error)

Jump to

Keyboard shortcuts

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