How to bind arrow keys shortcuts to a plugin

Hi!

I am working on a custom move tool. And I want to use it with arrow keys shortcuts. But it’s seems like using self.keyboardShortcut is the only way to bind plugins to shortcuts.

Another option is to use {←,→,↑,↓} × {1, 10, 100} different scripts – but it’s too lame.
Is there any better options?

Thank you.

What should the arrow keys do in your plugin? There are different ways in which your plugin could respond to arrow keys depending on the desired implementation.

Arrow keys (with modifier) should move a selected node with a side effect on other nodes.

I wrote a proof of concept script with python SDK, and I am trying to to connect it with arrow keys.

What have you done so far? You need to implement a plugin. Start with the SelectTool. Then implement the moveSelectionWithPoint_withModifier_() method. In it you get the active layer from layer = self.editViewController.graphicView.activeLayer()

What have you done so far?

I implemented a method customMove(layer, node, deltaX, deltaY)

Thank you for the answer, I will take a look at select tool template. But I don’t like this option, because I will need to change Glyphs mode to perform an action. Maybe it is not a problem.

Where I can read more about moveSelectionWithPoint_withModifier_? There is no mentions of the method in the GlyphSDK repository and whole Github either.

There is some info in the header files in: Glyphs 3.app/Contents/Frameworks/GlyphsCore.framework/Versions/A/Headers/. e.g. GlyphsPathPlugin.h. Other than that you needs to ask me :wink:

1 Like