native

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 1 Imported by: 0

README

native

English | 简体中文

A collection of system capability modules. Each subdirectory is an independent module, you can use only one of them, or you can not use the ui interface at all.

Modules Capabilities Dependencies
permission Check and apply for system permissions native, native/internal/sys
screen Monitor list, screenshots Same as above
input Synthesize mouse and keyboard events Same as above
hotkey Global shortcut keys Same as above
clipboard Asynchronously read clipboard text, encoded images, and file references (macOS / Windows / Linux Wayland, X11) Same as above
notification System notification permissions, delivery and withdrawal (macOS .app / Linux D-Bus) Same as above
process Terminal foreground process group and process working directory (macOS / Linux) native, native/internal/sys

Modules do not reference each other, nor do they reference ui and Gio. This is guaranteed by the tests in internal/deps.

The two shared parts are not independent modules:

  • native (native.go for this directory): Error value native.Err* common to all modules.
  • native/internal/sys: Platform bindings, macOS's cgo and Objective-C, Windows' Win32 calls, Linux's X11 protocol and D-Bus are all here. Cannot be referenced externally.
  • native/internal/wlclip: The cgo binding of the Linux Wayland clipboard is only referenced by clipboard, so other modules will not link to libwayland.

Supports macOS 14+, Windows, and Linux, other platforms return native.ErrUnsupported. On Linux, screenshots and composite input go through X11 (via XWayland in Wayland sessions), notifications go through D-Bus, and the clipboard is supported by both Wayland and X11. For details on each ability on each platform, see Native ability.

Document: Native ability · New native ability

Mobile iOS and Android backends for native/* are not implemented; operations return native.ErrUnsupported. See Mobile support for UI packaging and running.

Documentation

Overview

Package native holds the errors shared by Keel's platform capabilities. The capabilities themselves live in subpackages:

native/permission  check and request system permissions
native/screen      list displays, capture screenshots
native/input       synthesize mouse and keyboard input
native/hotkey      system-wide shortcuts

native/notification local notifications (macOS app bundles and Linux D-Bus)

Implemented on macOS 14+ (cgo), Windows and Linux under X11; elsewhere, and in macOS builds without cgo, every call returns ErrUnsupported. To add a capability, add it to each platform file in internal/sys (plus a stub in sys_other.go) and a small public package that validates arguments.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupported      = errors.New("native: unsupported on this platform")
	ErrPermissionDenied = errors.New("native: permission not granted")
	ErrInvalidArgument  = errors.New("native: invalid argument")
	ErrTimeout          = errors.New("native: operation timed out")
	ErrConflict         = errors.New("native: already registered")
	ErrFailed           = errors.New("native: operation failed")
)

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
Package clipboard reads a bounded snapshot of text, encoded images and file paths without linking to the UI.
Package clipboard reads a bounded snapshot of text, encoded images and file paths without linking to the UI.
Package hotkey registers system-wide shortcuts that fire even when another application is in front.
Package hotkey registers system-wide shortcuts that fire even when another application is in front.
Package input synthesizes mouse and keyboard events.
Package input synthesizes mouse and keyboard events.
internal
sys
Package sys binds the platform code.
Package sys binds the platform code.
wlclip
Package wlclip reads the Wayland clipboard through an application's own wl_display.
Package wlclip reads the Wayland clipboard through an application's own wl_display.
Package notification posts local operating-system notifications independently of Keel's UI.
Package notification posts local operating-system notifications independently of Keel's UI.
Package permission checks and requests macOS privacy permissions.
Package permission checks and requests macOS privacy permissions.
Package process provides terminal foreground process and working-directory queries without a UI dependency.
Package process provides terminal foreground process and working-directory queries without a UI dependency.
Package screen lists displays and captures screenshots.
Package screen lists displays and captures screenshots.

Jump to

Keyboard shortcuts

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