Skip to content

Commit

Permalink
Merge pull request #1262 from layday/add-standard-macos-app-menu-items
Browse files Browse the repository at this point in the history
cocoa: add standard app menu items
  • Loading branch information
freakboy3742 authored May 23, 2021
2 parents 1d64bee + a3bbb5f commit 0447a36
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions src/cocoa/toga_cocoa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,37 @@ def create(self):
'About ' + formal_name,
group=toga.Group.APP
),
toga.Command(None, 'Preferences', group=toga.Group.APP),
# Quit should always be the last item, in a section on it's own
toga.Command(
None,
'Preferences',
shortcut=toga.Key.MOD_1 + ',',
group=toga.Group.APP,
section=20,
),
toga.Command(
lambda _: self.native.hide(self.native),
'Hide ' + formal_name,
shortcut=toga.Key.MOD_1 + 'h',
group=toga.Group.APP,
order=0,
section=sys.maxsize - 1,
),
toga.Command(
lambda _: self.native.hideOtherApplications(self.native),
'Hide Others',
shortcut=toga.Key.MOD_1 + toga.Key.MOD_2 + 'h',
group=toga.Group.APP,
order=1,
section=sys.maxsize - 1,
),
toga.Command(
lambda _: self.native.unhideAllApplications(self.native),
'Show All',
group=toga.Group.APP,
order=2,
section=sys.maxsize - 1,
),
# Quit should always be the last item, in a section on its own
toga.Command(
lambda _: self.interface.exit(),
'Quit ' + formal_name,
Expand Down

0 comments on commit 0447a36

Please sign in to comment.