Skip to content

Commit

Permalink
Add ctrl-D keyboard shortcut (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jenskutilek committed May 17, 2024
1 parent 50a3101 commit 01bb22c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Favourites.glyphsPlugin/Contents/Resources/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
NSApplicationDidBecomeActiveNotification,
NSApplicationWillResignActiveNotification,
NSApplicationWillTerminateNotification,
NSCommandKeyMask,
NSControlKeyMask,
NSMenuItem,
NSNotificationCenter,
NSWindowDidBecomeMainNotification,
Expand Down Expand Up @@ -51,12 +53,15 @@ def settings(self) -> None:
"zh-Hant": "收藏",
}
)
self.keyboardShortcut = "d"
self.keyboardShortcutModifier = NSControlKeyMask
self.menuItem = NSMenuItem(self.name, self.showWindow_)
self.menuItem.setKeyEquivalent_(self.keyboardShortcut)
self.menuItem.setKeyEquivalentModifierMask_(self.keyboardShortcutModifier)

@objc.python_method
def start(self) -> None:
# print()
newMenuItem = NSMenuItem(self.name, self.showWindow_)
Glyphs.menu[WINDOW_MENU].append(newMenuItem)
Glyphs.menu[WINDOW_MENU].append(self.menuItem)
self.window = None
self.launch_time = int(time())
self.became_active_time = self.launch_time
Expand Down

0 comments on commit 01bb22c

Please sign in to comment.