mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-27 10:28:31 +08:00
tweak(menus): "Enter" and "Exit" fullscreen instead of "Toggle"
This commit is contained in:
parent
ffb33f3c93
commit
748c4c899c
2 changed files with 14 additions and 1 deletions
|
@ -48,7 +48,8 @@
|
|||
{
|
||||
label: 'View'
|
||||
submenu: [
|
||||
{ label: 'Toggle Full Screen', command: 'window:toggle-full-screen' }
|
||||
{ label: 'Enter Full Screen', command: 'window:toggle-full-screen' }
|
||||
{ label: 'Exit Full Screen', command: 'window:toggle-full-screen', visible: false }
|
||||
]
|
||||
}
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@ class ApplicationMenu
|
|||
Menu.setApplicationMenu(@menu)
|
||||
|
||||
@showUpdateMenuItem(global.application.autoUpdateManager.getState())
|
||||
@showFullscreenMenuItem(@lastFocusedWindow?.isFullScreen())
|
||||
|
||||
# Register a BrowserWindow with this application menu.
|
||||
addWindow: (window) ->
|
||||
|
@ -47,10 +48,14 @@ class ApplicationMenu
|
|||
@setActiveTemplate(template)
|
||||
|
||||
window.on 'focus', focusHandler
|
||||
window.on 'enter-full-screen', focusHandler
|
||||
window.on 'leave-full-screen', focusHandler
|
||||
window.once 'closed', =>
|
||||
@lastFocusedWindow = null if window is @lastFocusedWindow
|
||||
@windowTemplates.delete(window)
|
||||
window.removeListener 'focus', focusHandler
|
||||
window.removeListener 'enter-full-screen', focusHandler
|
||||
window.removeListener 'leave-full-screen', focusHandler
|
||||
|
||||
@enableWindowSpecificItems(true)
|
||||
|
||||
|
@ -111,6 +116,13 @@ class ApplicationMenu
|
|||
when 'update-available'
|
||||
installUpdateItem.visible = true
|
||||
|
||||
showFullscreenMenuItem: (fullscreen) ->
|
||||
enterItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Enter Full Screen')
|
||||
exitItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Exit Full Screen')
|
||||
return unless enterItem and exitItem
|
||||
enterItem.visible = !fullscreen
|
||||
exitItem.visible = fullscreen
|
||||
|
||||
# Default list of menu items.
|
||||
#
|
||||
# Returns an Array of menu item Objects.
|
||||
|
|
Loading…
Reference in a new issue