Discover Packages
github.com/dyike/keel
native
hotkey
package
Version:
v0.0.6
Opens a new window with list of versions in this module.
Published: Oct 4, 2026
License: AGPL-3.0
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
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 。
Expand ▾
Collapse ▴
Documentation
¶
Package hotkey registers system-wide shortcuts that fire even when another
application is in front.
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.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.