From 1ddf8f0dbe22f94d6bffddf70636706d2d142ecf Mon Sep 17 00:00:00 2001 From: Giulio Ganci Date: Sat, 23 Oct 2021 17:56:42 +0200 Subject: [PATCH 1/2] fix: copy&paste and basic usability on macOS --- src/main/index.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index 08355612..10096eee 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -115,16 +115,16 @@ function createAppMenu () { if (process.platform === 'darwin') { menu = Menu.buildFromTemplate([ { - label: app.name, - submenu: [ - { - role: 'about' - }, - { type: 'separator' }, - { - role: 'quit' - } - ] + role: 'appMenu' + }, + { + role: 'editMenu' + }, + { + role: 'viewMenu' + }, + { + role: 'windowMenu' } ]); } From 7657d05edfbeaed6a14eb337fc562da5126e6ba0 Mon Sep 17 00:00:00 2001 From: Giulio Ganci Date: Sat, 23 Oct 2021 18:15:32 +0200 Subject: [PATCH 2/2] feat(UI): improved topbar look&feel on MacOS --- src/main/index.js | 7 +++++-- src/renderer/components/TheTitleBar.vue | 27 ++++++++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index 10096eee..cb86a662 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -11,6 +11,7 @@ import ipcHandlers from './ipc-handlers'; Store.initRenderer(); const isDevelopment = process.env.NODE_ENV !== 'production'; +const isMacOS = process.platform === 'darwin'; const gotTheLock = app.requestSingleInstanceLock(); process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true'; @@ -35,6 +36,8 @@ async function createMainWindow () { spellcheck: false }, frame: false, + titleBarStyle: isMacOS ? 'hidden' : 'default', + trafficLightPosition: isMacOS ? { x: 10, y: 8 } : undefined, backgroundColor: '#1d1d1d' }); @@ -81,7 +84,7 @@ else { // quit application when all windows are closed app.on('window-all-closed', () => { // on macOS it is common for applications to stay open until the user explicitly quits - if (process.platform !== 'darwin') app.quit(); + if (isMacOS) app.quit(); }); app.on('activate', async () => { @@ -112,7 +115,7 @@ else { function createAppMenu () { let menu = null; - if (process.platform === 'darwin') { + if (isMacOS) { menu = Menu.buildFromTemplate([ { role: 'appMenu' diff --git a/src/renderer/components/TheTitleBar.vue b/src/renderer/components/TheTitleBar.vue index 73a29dfd..f82d6d5d 100644 --- a/src/renderer/components/TheTitleBar.vue +++ b/src/renderer/components/TheTitleBar.vue @@ -2,7 +2,11 @@
- +
{{ windowTitle }} @@ -22,14 +26,26 @@ >
-
+
-
+
-
+
@@ -47,7 +63,8 @@ export default { return { w: getCurrentWindow(), isMaximized: getCurrentWindow().isMaximized(), - isDevelopment: process.env.NODE_ENV === 'development' + isDevelopment: process.env.NODE_ENV === 'development', + isMacOS: process.platform === 'darwin' }; }, computed: {