diff --git a/src/components/DevToolbar.js b/src/components/DevToolbar.js index 5c37a4c3..a677f8b7 100644 --- a/src/components/DevToolbar.js +++ b/src/components/DevToolbar.js @@ -15,6 +15,8 @@ import sortBy from 'lodash/fp/sortBy' import chunk from 'lodash/chunk' import styled from 'styled-components' import color from 'color' +import fs from 'fs' +import path from 'path' import Box from 'components/base/Box' import Bar from 'components/base/Bar' @@ -23,6 +25,9 @@ import { ChartWrapper } from 'components/base/Chart' import theme from 'styles/theme' +const getLanguages = p => fs.readdirSync(p).filter(f => fs.statSync(path.join(p, f)).isDirectory()) +const languages = getLanguages(path.join(__static, './i18n')) + const mainWindow = remote.BrowserWindow.getAllWindows().find(w => w.name === 'MainWindow') type HslColor = { @@ -149,14 +154,13 @@ class DevToolbar extends PureComponent { } render() { - const { i18n } = this.props const { cpuUsage } = this.state return (
- {Object.keys(i18n.store.data).map(lang => ( + {languages.map(lang => ( {lang} diff --git a/src/main/app.js b/src/main/app.js index c13b4514..17140308 100644 --- a/src/main/app.js +++ b/src/main/app.js @@ -85,6 +85,7 @@ function createMainWindow() { titleBarStyle: 'hiddenInset', } : {}), + autoHideMenuBar: true, height, minHeight: MIN_HEIGHT, minWidth: MIN_WIDTH, @@ -152,6 +153,7 @@ function createDevWindow() { saveWindowSettings(window) window.loadURL(`${url}/#/dev`) + window.setMenu(null) window.on('close', handleCloseWindow(window)) @@ -243,16 +245,12 @@ app.on('ready', async () => { await installExtensions() } - if (process.platform === 'darwin') { - Menu.setApplicationMenu(menu) - } else { - Menu.setApplicationMenu(null) - } + Menu.setApplicationMenu(menu) preloadWindow = createPreloadWindow() }) -ipcMain.on('app-finish-rendering', () => { +ipcMain.once('app-finish-rendering', () => { if (preloadWindow !== null) { preloadWindow.destroy() preloadWindow = null diff --git a/src/main/menu.js b/src/main/menu.js index 590b7b26..0c4a63ec 100644 --- a/src/main/menu.js +++ b/src/main/menu.js @@ -46,7 +46,7 @@ const template = [ } }, }, - { type: 'separator' }, + ...props(process.platform === 'darwin', [{ type: 'separator' }], []), ], [], ),