func ParseKeys(s string) (KeyCombination, error) {
	parts := strings.Split(s, " ")
	if strings.Contains(s, "+") {
		parts = strings.Split(s, "+")
	}
	if len(parts) == 0 {
		return KeyCombination{}, errEmptyShortcut
	}
	var keys KeyCombination
	keys.Key = parts[len(parts)-1]
	if len(keys.Key) == 0 {
		return KeyCombination{}, errEmptyKey
	}
	for _, part := range parts[:len(parts)-1] {
		switch strings.ToLower(part) {
		case "cmd":
			keys.Modifiers |= ModifierCmd
		case "ctrl":
			keys.Modifiers |= ModifierCtrl
		case "cmdctrl":
			keys.Modifiers |= ModifierCmdOrCtrl
		case "alt":
			keys.Modifiers |= ModifierAltOrOption
		case "option":
			keys.Modifiers |= ModifierAltOrOption
		case "fn":
			keys.Modifiers |= ModifierFn
		case "shift":
			keys.Modifiers |= ModifierShift
		default:
			return KeyCombination{}, fmt.Errorf("unknown modifier: %s", part)
		}
	}
	return keys, nil
}
ParseKeys parses a key combination specified as a string like "cmd shift a".
package gallium
import "C"
import (
	"errors"
	"fmt"
	"log"
	"strings"
)
var (
	nextID   int
	handlers = make(map[int]func())
)
func cgo_onGlobalShortcut(id int) {
	fmt.Println("cgo_onGlobalShortcut received ID", id)
	if handler, found := handlers[id]; found {
		handler()
	} else {
		log.Println("no handler for global shortcut ID", id)
	}
}
type Modifier int
const (
	ModifierCmd Modifier = 1 << iota
	ModifierCtrl
	ModifierCmdOrCtrl
	ModifierAltOrOption
	ModifierFn
	ModifierShift
)
type KeyCombination struct {
	Key       string
	Modifiers Modifier
}
var (
	errEmptyKey      = errors.New("empty key")
	errEmptyShortcut = errors.New("empty shortcut")
)