Preview bar shortcut

Hello, I wonder is there any way to assign a shortcut to turn on/off the preview bar on the bottom of the app screen? I checked the forum but could not find anything.

Generally, I go System Preferences > Keyboard > Shortcuts to customise or add shortcuts but I do not know the exact name of the turn on/off feature of the preview bar.

There is no menu command to toggle the preview. You would need to write a script that does the toggling and assign a shortcut to that script.

I see. I need to learn how to write a script then. Thanks for the information

@obiobik alternative: try Keyboard Maestro or SikuliX for a no-code solution if you need to click that button multiple times a day

1 Like

Yes. Altering app functionality requires a little coding. But it is not difficult. Here is a code snippet that probably does something close to what you want. Read through the first two Scripting tutorials and you should be able to easily adjust it to what you want

previewSize = 200.0

font = Glyphs.font # frontmost font
tab = font.currentTab # frontmost tab

# open a new tab if none is open:
if not tab:
	tab = font.newTab() 

if tab.previewHeight != previewSize:
	# set the preview to the intended opened size:
	tab.previewHeight = previewSize
else:
	# close it if it was at the size already:
	tab.previewHeight = -1.0
1 Like

Thank you so much. It seems I managed to add this code as a script into the Script Menu. It works perfectly now!

1 Like