Skip to content

Changing KeyToggle parameter type for args to ...string #739

@andrewfstratton

Description

@andrewfstratton

Would the KeyToggle function args parameters be better changed to ...string, i.e

func robotgo.KeyToggle(key string, args ...string) error
// was func robotgo.KeyToggle(key string, args ...interface{}) error

e.g. See the sample code below, where to build a slice of strings, I have to declare the modifiers as []any{} when I would prefer to declare []string{} which would match the (intended) parameters better.

func press_release(key keyJSON) {
	modifiers := []any{}
	state := "up"
	if key.Press {
		state = "down"
	}
	modifiers = append(modifiers, state)
	if key.Shift {
		modifiers = append(modifiers, "shift")
	}
	if key.Ctrl {
		modifiers = append(modifiers, "ctrl")
	}
	if key.Alt {
		modifiers = append(modifiers, "alt")
	}
	robotgo.KeyToggle(key.Key, modifiers...)
}

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