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' @displayName: 'ComposeButton'
render: => render: =>
<button style={order: 101} <button className="btn btn-toolbar item-compose"
className="btn btn-toolbar"
data-tooltip="Compose new message" data-tooltip="Compose new message"
onClick={@_onNewCompose}> onClick={@_onNewCompose}>
<RetinaImg name="toolbar-compose.png" mode={RetinaImg.Mode.ContentIsMask}/> <RetinaImg name="toolbar-compose.png" mode={RetinaImg.Mode.ContentIsMask}/>

View file

@ -1,19 +1,7 @@
'menu': [ 'menu': [
{ { label: '&New Message', command: 'application:new-message' }
label: '&File' { type: 'separator' }
submenu: [ { label: 'Link External Account', command: 'atom-workspace:add-account' }
{ 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: '&Edit' label: '&Edit'
submenu: [ submenu: [
@ -65,6 +53,11 @@
{ label: 'Send Feedback to Nylas', command: 'application:send-feedback' } { 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':[ 'context-menu':[

View file

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

View file

@ -2,6 +2,7 @@ React = require 'react/addons'
Sheet = require './sheet' Sheet = require './sheet'
Flexbox = require './components/flexbox' Flexbox = require './components/flexbox'
RetinaImg = require './components/retina-img' RetinaImg = require './components/retina-img'
Utils = require './flux/models/utils'
TimeoutTransitionGroup = require './components/timeout-transition-group' TimeoutTransitionGroup = require './components/timeout-transition-group'
_str = require 'underscore.string' _str = require 'underscore.string'
_ = require 'underscore' _ = require 'underscore'
@ -78,9 +79,27 @@ class ToolbarWindowControls extends React.Component
<button className="maximize" onClick={ -> atom.maximize()}></button> <button className="maximize" onClick={ -> atom.maximize()}></button>
</div> </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, ComponentRegistry.register ToolbarWindowControls,
location: WorkspaceStore.Sheet.Global.Toolbar.Left location: WorkspaceStore.Sheet.Global.Toolbar.Left
ComponentRegistry.register ToolbarMenuControl,
location: WorkspaceStore.Sheet.Global.Toolbar.Right
class Toolbar extends React.Component class Toolbar extends React.Component
@displayName: 'Toolbar' @displayName: 'Toolbar'

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

View file

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