hotkey

package
v0.0.5 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: 4 Imported by: 0

README

native/hotkey

注册全局快捷键,其他应用在前台时也能触发。

  • 依赖:native(错误值)、native/internal/sys。
  • 单独使用:可以,但进程要运行 macOS 主线程事件循环,快捷键事件才会派发。和 ui 一起用时,ui.Main() 就是这个循环。
import "github.com/dyike/keel/native/hotkey"

unregister, err := hotkey.Register("cmd+shift+k", func() {
    // 在独立 goroutine 里运行;要改界面,用 ui.Update
})

详见 原生能力 · hotkey。

Documentation

Overview

Package hotkey registers system-wide shortcuts that fire even when another application is in front.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(accel string, fn func()) (unregister func() error, err error)

Register reserves an accelerator such as "cmd+shift+k". fn runs on its own goroutine, so wrap UI changes in ui.Update. Presses that arrive while fn is running are merged. Call the returned func to unregister.

Types

This section is empty.

Jump to

Keyboard shortcuts

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