schriftgestalt / GlyphsSDK

Scripting SDK for Glyphs
Apache License 2.0
89 stars 37 forks source link

Can't set the keyboard shortcut for the SelectTool Plugin #48

Open mumchristmas opened 3 years ago

mumchristmas commented 3 years ago

Glyphs Version: 3.0.3 (3075)

Codes in def settings(self):

self.keyboardShortcut = 'g'

or

Defaults = NSUserDefaults.standardUserDefaults()
Defaults.registerDefaults_({"Pixel45.hotKey" : "g"})
self.keyboardShortcut = Glyphs.defaults["Pixel45.hotKey"]

Not working right now.

WX20210402-000224@2x And the tool will get a hotkey 'V' from some where. Also not working.

schriftgestalt commented 3 years ago

What happens when you implement a trigger() method and return the hot key?

mumchristmas commented 3 years ago

What happens when you implement a trigger() method and return the hot key?

Sorry, I don't quite get your words. The print(self.trigger()) always return a ‘g’ here.

schriftgestalt commented 3 years ago

In your plugin implementation, add this:

def trigger(self):
    return "g"
mumchristmas commented 3 years ago

In your plugin implementation, add this:

def trigger(self):
    return "g"

I tried this already. Still not working.

schriftgestalt commented 3 years ago

Can you send me your plugin?

mumchristmas commented 3 years ago

Can you send me your plugin?

Okay, plz check the support inbox.

update: Ha, I removed the @objc part before my code. then the def trigger(self): way is working now.