-
-
Save okay-type/03fd0544dda20b05cadb0cb3d9c81a8a to your computer and use it in GitHub Desktop.
Convert arrow functions to ASWD keys in the glyphView. If you have shortcuts already set up for any of these keys you will run into issues!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mojo.subscriber import Subscriber, registerRoboFontSubscriber | |
from mojo.events import extractNSEvent | |
class KeyTest(Subscriber): | |
debug = True | |
def build(self): | |
if self.debug == True: | |
print('KeyTest', 'build!') | |
def destroy(self): | |
if self.debug == True: | |
print('KeyTest', 'destroy!') | |
def glyphEditorKeyDown(self, notification): | |
info = notification['lowLevelEvents'][0] | |
characters = info['event'].characters() | |
shiftDown = extractNSEvent(info)['shiftDown'] | |
commandDown = extractNSEvent(info)['commandDown'] | |
capLockDown = extractNSEvent(info)['capLockDown'] | |
optionDown = extractNSEvent(info)['optionDown'] | |
controlDown = extractNSEvent(info)['controlDown'] | |
locationInWindow = notification['iterations'][0]['deviceState']['locationInWindow'] | |
locationInView = notification['iterations'][0]['deviceState']['locationInView'] | |
print('KeyTest characters:', characters) | |
print('KeyTest shiftDown:', shiftDown) | |
print('KeyTest commandDown:', commandDown) | |
print('KeyTest capLockDown:', capLockDown) | |
print('KeyTest optionDown:', optionDown) | |
print('KeyTest controlDown:', controlDown) | |
print('KeyTest locationInWindow:', locationInWindow) | |
print('KeyTest locationInView:', locationInView) | |
registerRoboFontSubscriber(KeyTest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment