keys

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NSEventModifierFlagShift   = 1 << 17 // Set if Shift key is pressed.
	NSEventModifierFlagControl = 1 << 18 // Set if Control key is pressed.
	NSEventModifierFlagOption  = 1 << 19 // Set if Option or Alternate key is pressed.
	NSEventModifierFlagCommand = 1 << 20 // Set if Command key is pressed.
)

Variables

This section is empty.

Functions

func Stringify

func Stringify(accelerator *Accelerator, platform string) string

func ToMacModifier

func ToMacModifier(accelerator *Accelerator) int

Types

type Accelerator

type Accelerator struct {
	Key       string
	Modifiers []Modifier
}

Accelerator holds the keyboard shortcut for a menu item

func CmdOrCtrl

func CmdOrCtrl(key string) *Accelerator

CmdOrCtrl creates a 'CmdOrCtrl' Accelerator

func Combo

func Combo(key string, modifier1 Modifier, modifier2 Modifier, rest ...Modifier) *Accelerator

Combo creates an Accelerator with multiple Modifiers

func Control

func Control(key string) *Accelerator

Control creates a 'Control' Accelerator

func Key

func Key(key string) *Accelerator

Key creates a standard key Accelerator

func OptionOrAlt

func OptionOrAlt(key string) *Accelerator

OptionOrAlt creates a 'OptionOrAlt' Accelerator

func Parse

func Parse(shortcut string) (*Accelerator, error)

func Shift

func Shift(key string) *Accelerator

Shift creates a 'Shift' Accelerator

type Modifier

type Modifier string

Modifier is actually a string

const (
	// CmdOrCtrlKey represents Command on Mac and Control on other platforms
	CmdOrCtrlKey Modifier = "cmdorctrl"
	// OptionOrAltKey represents Option on Mac and Alt on other platforms
	OptionOrAltKey Modifier = "optionoralt"
	// ShiftKey represents the shift key on all systems
	ShiftKey Modifier = "shift"
	// SuperKey represents Command on Mac and the Windows key on the other platforms
	//SuperKey Modifier = "super"
	// ControlKey represents the control key on all systems
	ControlKey Modifier = "ctrl"
)

Jump to

Keyboard shortcuts

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