Skip to content

I want to use key code instead of string. #678

Open
@VacantHusky

Description

@VacantHusky

I would like to add a function:

func KeyCode2String(key int) (k string, err error) {
	for keyStr, keyCode := range keyNames {
		if keyCode == C.int(key) {
			return keyStr, nil
		}
	}
	return "", errors.New("Invalid key specified.")
}

key, _ = KeyCode2String(112)  // F1
robotgo.KeyToggle(key)

But I can't use keyNames.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions