hotkey

package
v0.1.4 Latest Latest
Warning

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

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

README

native/hotkey

English | 简体中文

Register global shortcut keys, which can be triggered when other applications are in the foreground.

  • Dependencies: native (error value), native/internal/sys.
  • Use alone: Yes, but the process must run the macOS main thread event loop before the shortcut key event will be dispatched. When used with ui, ui.Main() is this loop.
import "github.com/dyike/keel/native/hotkey"

unregister, err := hotkey.Register("cmd+shift+k", func() {
    // Runs in an independent goroutine; to change the interface, use ui.Update
})

For details, see Native capabilities · 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