native

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

README

native

系统能力模块集合。每个子目录是一个独立模块,可以只用其中一个,也可以完全不用 ui 界面。

模块 能力 依赖
permission 检查、申请系统权限 native、native/internal/sys
screen 显示器列表、截图 同上
input 合成鼠标、键盘事件 同上
hotkey 全局快捷键 同上
clipboard 异步读取剪贴板文本、编码图片和文件引用(macOS / Windows / Linux X11) 同上
notification 系统通知权限、投递与撤回(macOS .app / Linux D-Bus) 同上

模块之间互不引用,也不引用 ui 和 Gio,这一点由 internal/deps 里的测试保证。

两个共享部分不是独立模块:

  • native(本目录的 native.go):所有模块共用的错误值 native.Err*。
  • native/internal/sys:平台绑定,macOS 的 cgo 与 Objective-C、Windows 的 Win32 调用、Linux 的 X11 协议都只在这里。外部不能引用。

支持 macOS 14+、Windows 和 Linux(X11),其他平台返回 native.ErrUnsupported。

文档:原生能力 · 新增原生能力

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 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