hotkey

package
v0.35.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VkBackspace = 0x08
	VkTab       = 0x09
	VkReturn    = 0x0D
	VkEscape    = 0x1B
	VkSpace     = 0x20

	VkLShift   = 0xA0
	VkRShift   = 0xA1
	VkLControl = 0xA2
	VkRControl = 0xA3
	VkLMenu    = 0xA4 // Left Alt
	VkRMenu    = 0xA5 // Right Alt
	VkLWin     = 0x5B
	VkRWin     = 0x5C
	VkShift    = 0x10
	VkControl  = 0x11
	VkMenu     = 0x12 // Alt
)

Virtual key codes

Variables

This section is empty.

Functions

func ComboAlt

func ComboAlt() []uint32

ComboAlt returns VK code for Alt.

func ComboCtrlShift

func ComboCtrlShift() []uint32

ComboCtrlShift returns VK codes for Ctrl+Shift.

func ComboF8

func ComboF8() []uint32

ComboF8 returns VK code for F8.

func ComboWinAlt

func ComboWinAlt() []uint32

ComboWinAlt returns VK codes for Win+Alt.

func ParseCombo

func ParseCombo(s string) []uint32

ParseCombo parses strings like "alt" or "ctrl+shift+d" into VK codes.

Types

type Event

type Event struct {
	Type    EventType
	Binding string
}

type EventType

type EventType int
const (
	EventKeyDown EventType = iota
	EventKeyUp
)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager captures a push-to-talk key combination through a low-level keyboard hook.

func NewManager

func NewManager(combo []uint32) *Manager

NewManager creates a PTT manager. combo is a list of VK codes that must ALL be pressed.

func (*Manager) Events

func (m *Manager) Events() <-chan Event

func (*Manager) Reconfigure

func (m *Manager) Reconfigure(combo []uint32)

Reconfigure swaps the key combination while the hook is running. The keyboard hook stays installed; only the combo tracker is replaced.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start installs a low-level keyboard hook and emits key down/up events for the configured combo.

func (*Manager) Stop

func (m *Manager) Stop()

Jump to

Keyboard shortcuts

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