Adding touchbar support with a new action group

Hi guys, I am developing Mac Touchbar support for some actions that we already use in a plugin. However I can't see how to add them. I guess the changes could be made in plugin.xml. So I have tried the following way of including my new action group TouchBarMyAction_alt_r in the Debug Actions available on the touchbar, but it didn't work. (My intention was to have an action group that appears on the touchbar when alt+r are pressed.)

<group id="TouchBar">
<separator text="type.flexible"/>
<group id="TouchBarMyAction_alt_r">
<reference ref="MyAction1"/>
<reference ref="MyAction2"/>
<reference ref="MyAction3"/>
<separator text="type.flexible"/>
How can I achieve this? Is there either a declarative or programmatic way of doing it?
Comment actions Permalink

So I've made a bit of progress: I added an `ActionGroup` class that has the same id as the one I added to `plugin.xml`. In that class, I defined the actions to be displayed. This resulted in the group's action buttons showing up and they were usable with some qualifications.

  1. There were no icons.
  2. They were in the TouchBarDebug_alt action group not in their own group.
  3. I couldn't find out how to configure a special key combination to display the custom action group.

Any suggestions to help me move forward with this?

The custom ActionGroup class I wrote was:

package my.code.intellij.actions;

import com.intellij.openapi.actionSystem.*;
import java.awt.event.InputEvent;
import javax.swing.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class TouchBarMyActionGroup extends DefaultActionGroup {
private static final ShortcutSet shortcutSet =
() ->
new Shortcut[] {
new KeyboardShortcut(
InputEvent.ALT_DOWN_MASK), null)

public TouchBarMyActionGroup() {}

public TouchBarMyActionGroup(String dirPath) {
super("TouchBarMyAction_alt_r", false);
this.registerCustomShortcutSet(shortcutSet, null);

public AnAction[] getChildren(@Nullable AnActionEvent e) {
return new AnAction[] {
new MyAction1(),
new MyAction2(),
new MyAction3()

* This method can be called in popup menus if {@link
* #canBePerformed(DataContext)} is {@code
* true}.
public void actionPerformed(@NotNull AnActionEvent e) {

/** @return {@code true} if {@link
* #actionPerformed(AnActionEvent)} should be called.
public boolean canBePerformed(@NotNull DataContext context)
return true;


Comment actions Permalink

Along with the above code snippet, I revised the plugin.xml which now has:

<group id="TouchBarMyAction_alt_r"         class="my.code.intellij.actions.TouchBarMyActionGroup" text="My Operations"
        popup="false" icon="myicon.png">
    <add-to-group group-id="TouchBarDebug_alt" anchor="last"/>

But as I said it still doesn't work in the ways I described.


Please sign in to leave a comment.