How do I assign a key to a widget

I must be overlooking something obvious, but I just can’t find it. I want to make it so that e.g. if I type ‘M’ on my computer keyboard, that toggles a widget on my panel. Where do I configure stuff like that?

That’s not directly supported. Widgets were intended to be controlled from MIDI hardware (keyboards with buttons and sliders, or control surfaces) and from OSC (for control from tablets running applications such as Lemur or TouchOSC)

It could be done using the keypress callback in GPscript which could then inject a special MIDI message into the Local GP4 Port which could then be learned by a widget.

A little scripting is necessary, and here is an example how you can change rackspaces using a key on your computer keyboard: Gig Performer | The most flexible MIDI processing

2 Likes

As mentioned, it needs to be a ‘Gig Script’ to be able to detect the keyboard keystrokes. But the flip-side is that you can’t control widgets directly in a gig script (only in rackspace scripts).

The way around this is to have the gig script generate a midi message, which is then ‘midi learned’ by the widget.

This is the basic script, and an example gig file.

Toggle Widget via Keystroke.gig (25.8 KB)

// Generate a MIDI message when pressing a key on the keyboard
On Keystroke matching "m" Description "Toggle Widget"
    InjectMidiEvent("Local GP Port", MakeControlChangeMessage(80, 127))
End
3 Likes

Or just get Bome.

2 Likes

Thanks all! I got it working following @rank13’s script example.

3 Likes