tweak(win32): Hide the app menu on Windows, show in a right-side button instead

This commit is contained in:
Ben Gotow 2015-09-11 14:49:21 -07:00
parent c7f38cc851
commit ece7f2e649
6 changed files with 67 additions and 18 deletions

View file

@ -6,8 +6,7 @@ class ComposeButton extends React.Component
@displayName: 'ComposeButton'
render: =>
<button style={order: 101}
className="btn btn-toolbar"
<button className="btn btn-toolbar item-compose"
data-tooltip="Compose new message"
onClick={@_onNewCompose}>
<RetinaImg name="toolbar-compose.png" mode={RetinaImg.Mode.ContentIsMask}/>

View file

@ -1,19 +1,7 @@
'menu': [
{
label: '&File'
submenu: [
{ label: '&New Message', command: 'application:new-message' }
{ type: 'separator' }
{ label: 'Link External Account', command: 'atom-workspace:add-account' }
{ label: 'Clos&e Window', command: 'window:close' }
{ type: 'separator' }
{ label: 'Preferences', command: 'application:open-preferences' }
{ label: 'Log Out', command: 'application:logout' }
{ type: 'separator' }
{ label: 'E&xit', command: 'application:quit' }
]
}
{ label: '&New Message', command: 'application:new-message' }
{ type: 'separator' }
{ label: 'Link External Account', command: 'atom-workspace:add-account' }
{
label: '&Edit'
submenu: [
@ -65,6 +53,11 @@
{ label: 'Send Feedback to Nylas', command: 'application:send-feedback' }
]
}
{ type: 'separator' }
{ label: 'Preferences', command: 'application:open-preferences' }
{ label: 'Log Out', command: 'application:logout' }
{ type: 'separator' }
{ label: 'E&xit', command: 'application:quit' }
]
'context-menu':[

View file

@ -214,9 +214,12 @@ class Atom extends Model
@styles = new StyleManager
document.head.appendChild(new StylesElement)
@themes = new ThemeManager({packageManager: @packages, configDirPath, resourcePath, safeMode})
@menu = new MenuManager({resourcePath})
@clipboard = new Clipboard()
@menu = new MenuManager({resourcePath})
if process.platform is 'win32'
@getCurrentWindow().setMenuBarVisibility(false)
# initialize spell checking
require('web-frame').setSpellCheckProvider("en-US", false, {
spellCheck: (text) ->

View file

@ -2,6 +2,7 @@ React = require 'react/addons'
Sheet = require './sheet'
Flexbox = require './components/flexbox'
RetinaImg = require './components/retina-img'
Utils = require './flux/models/utils'
TimeoutTransitionGroup = require './components/timeout-transition-group'
_str = require 'underscore.string'
_ = require 'underscore'
@ -78,9 +79,27 @@ class ToolbarWindowControls extends React.Component
<button className="maximize" onClick={ -> atom.maximize()}></button>
</div>
class ToolbarMenuControl extends React.Component
@displayName: 'ToolbarMenuControl'
render: =>
<div className="toolbar-menu-control">
<div className="btn btn-toolbar" onClick={@_openMenu}>
<RetinaImg name="windows-menu-icon.png" mode={RetinaImg.Mode.ContentIsMask} />
</div>
</div>
_openMenu: =>
applicationMenu = require('remote').getGlobal('application').applicationMenu
activeTemplate = Utils.deepClone(applicationMenu.activeTemplate)
menu = require('remote').require('menu').buildFromTemplate(activeTemplate)
menu.popup(atom.getCurrentWindow())
ComponentRegistry.register ToolbarWindowControls,
location: WorkspaceStore.Sheet.Global.Toolbar.Left
ComponentRegistry.register ToolbarMenuControl,
location: WorkspaceStore.Sheet.Global.Toolbar.Right
class Toolbar extends React.Component
@displayName: 'Toolbar'

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

View file

@ -65,6 +65,10 @@ atom-workspace {
opacity: 0;
}
.toolbar-menu-control {
display:none;
}
.toolbar-window-controls {
margin-top:14px;
margin-left:@spacing-half;
@ -176,6 +180,10 @@ body.is-blurred {
-webkit-app-region: drag;
}
.item-compose {
order: 101;
}
.item-container {
.window-title {
position: absolute;
@ -209,6 +217,13 @@ body.is-blurred {
}
}
.toolbar-menu-control {
order:10000;
padding-top: 5px;
.btn { margin-left: 0; }
img.content-mask { background-color: @text-color-heading; }
}
.btn-toolbar {
margin-top: @spacing-three-quarters;
margin-left: @spacing-three-quarters;
@ -310,6 +325,16 @@ body.is-blurred {
// WINDOWS
body.platform-win32 {
&.window-type-default {
.toolbar-menu-control {
display:inherit;
}
}
.item-compose {
order: -101;
}
.flexbox-handle-vertical {
cursor:ns-resize;
}
@ -324,8 +349,14 @@ body.platform-win32 {
.sheet-toolbar-container {
background-image: none;
background: @background-primary;
.btn-toolbar {
border: 0;
box-shadow: none;
background: none;
}
}
}
body.platform-win32.is-blurred {
.sheet-toolbar-container {
background-image: none;
@ -339,4 +370,8 @@ body.platform-linux {
.toolbar-window-controls {
display:none;
}
.item-compose {
order: -101;
}
}