Adding touchbar support with a new action group
Answered
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"/>
</group>
</group>
How can I achieve this? Is there either a declarative or programmatic way of doing it?
Please sign in to leave a comment.
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.
Any suggestions to help me move forward with this?
The custom ActionGroup class I wrote was:
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">
<separator/>
<add-to-group group-id="TouchBarDebug_alt" anchor="last"/>
<separator/>
</group>
But as I said it still doesn't work in the ways I described.
Unfortunately, touchbar doesn't support custom shortcuts (like alt+r) now, it supports only simple modifier keys (ctlr, alt, shift, meta and combinations of them). Such shortcuts will be added in nearest EAP 20.3.
In current version you can define 'default' or 'debugger' action groups (and corresponding subgroups for modifier keys), example: