mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-12-29 19:20:46 +08:00
More macOS menu bar improvements
This commit is contained in:
parent
c5152eb941
commit
108b40651d
1 changed files with 8 additions and 1 deletions
|
@ -41,12 +41,12 @@ if Mix.target() == :app do
|
|||
|
||||
wx = :wx.new()
|
||||
frame = :wxFrame.new(wx, -1, app_name, size: size)
|
||||
:wxFrame.show(frame)
|
||||
|
||||
if os == :macos do
|
||||
fixup_macos_menubar(frame, app_name)
|
||||
end
|
||||
|
||||
:wxFrame.show(frame)
|
||||
:wxFrame.connect(frame, :command_menu_selected, skip: true)
|
||||
:wxFrame.connect(frame, :close_window, skip: true)
|
||||
|
||||
|
@ -122,8 +122,15 @@ if Mix.target() == :app do
|
|||
defp fixup_macos_menubar(frame, app_name) do
|
||||
menubar = :wxMenuBar.new()
|
||||
:wxFrame.setMenuBar(frame, menubar)
|
||||
|
||||
menu = :wxMenuBar.oSXGetAppleMenu(menubar)
|
||||
|
||||
# without this, for some reason setting the title later will make it non-bold
|
||||
:wxMenu.getTitle(menu)
|
||||
|
||||
# this is useful in dev, not needed when bundled in .app
|
||||
:wxMenu.setTitle(menu, app_name)
|
||||
|
||||
menu
|
||||
|> :wxMenu.findItem(@wx_id_osx_hide)
|
||||
|> :wxMenuItem.setItemLabel("Hide #{app_name}\tCtrl+H")
|
||||
|
|
Loading…
Reference in a new issue