Create keyboard shortcuts in plugins

Is there a way to create keyboard shortcuts for use in a plugin in a plugin (for example to do an action that is normally done by a button by pressing a key)? I guess the ApplicationCommandManager could be used for that, but I cant quite figure out hot to get started.

I am not quite sure what you mean by that? You are doing a plugin that hosts another plugin? In that case, there’s really no “official” way to interact with the hosted plugin. The hosted plugin’s GUI may have been made with whatever GUI toolkit and Juce of course can’t interact with those directly.

If this is simply about your own plugin, you can override your editor component’s keyPressed method with something like :

bool MyPluginAudioProcessorEditor::keyPressed(const KeyPress & press)
{
    if (press == 'I')
    {
        myButton.triggerClick();
        return true; // return true when the keypress was handled
    }
    return false; // return false if you don't handle the keypress
}

Trying to use ApplicationCommandManager would probably be overkill for a plugin, unless you have dozens of commands to handle.

Thank you, this was exactly what I was looking for!

Ok so now I have a follow up question. So I basically have a plugin that has some keyboard shortcuts (for example O for toggle audio on/off). I would however like all other keys to go to the DAW (for example start recording when pressing R like usually happens in my DAW). This does works fine in Reaper, but sadly not in Sequoia which is my DAW of choice. Is there any way to solve this problem?