Custom hotkeys for rectangle and ellipse

Is it possible to create separate hotkeys for drawing a rectangle or an ellipse, e.g., rectangle (R) and ellipse (O or L)?

Shift-F toggles between the two.

1 Like

Thank you, Rainer!

I know. For me, it’s still more “intuitive” to use two different hotkeys, like in Illustrator or Figma.

Is there a way to solve this with a script that allows me to assign the hotkey myself?

A script works. Here are the needed pieces:

Font.tool = "PrimitivesTool"
tool = Glyphs.font.parent.windowController().toolEventDelegate()
print(tool)
tool.setCircle_(None)
tool.setRect_(None)
1 Like

Thank you, Georg! I don’t know how to put this together, but I’ll try when I find the time. :slight_smile:

Create a script Select Circle Tool.py and paste this inside:

#MenuTitle: Select Circle Tool
__doc__="""
Triggers the Circle tool.
"""

font = Glyphs.font
font.tool = "PrimitivesTool"
tool = font.parent.windowController().toolEventDelegate()
tool.setCircle_(True)

And analogously you do something similar for the Rectangle tool:

#MenuTitle: Select Rectangle Tool
__doc__="""
Triggers the Rectangle tool.
"""

font = Glyphs.font
font.tool = "PrimitivesTool"
tool = font.parent.windowController().toolEventDelegate()
tool.setRect_(True)

Put the two .py files in the Scripts folder that appears when you choose Script > Open Scripts Folder. Reload Scripts (Cmd-Opt-Shift-Y), assign a shortcut in Glyphs > Settings, and restart the app. Then your shortcuts should work.

2 Likes

Hey Rainer, that works!!
Thank you very much :+1:

1 Like