From ff8422d6c1b68d15796952a353c84fbf5a2e921c Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 3 Jun 2019 08:41:19 -0400 Subject: [PATCH] alwaysOnTop --- jslib | 2 +- src/locales/en/messages.json | 4 ++++ src/main/menu.main.ts | 18 +++++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/jslib b/jslib index 38fc0432..3d93696f 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 38fc0432c3b352628b0114ac98b49ca69ee01675 +Subproject commit 3d93696fb51b6a0c3d29c6df626e60fab9cca789 diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index 768e9363..1b1fb549 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -569,6 +569,10 @@ "hideToTray": { "message": "Hide to Tray" }, + "alwaysOnTop": { + "message": "Always on Top", + "description": "Application window should always stay on top of other windows" + }, "hideToMenuBar": { "message": "Hide to Menu Bar" }, diff --git a/src/main/menu.main.ts b/src/main/menu.main.ts index d9d61497..c84534b8 100644 --- a/src/main/menu.main.ts +++ b/src/main/menu.main.ts @@ -48,11 +48,19 @@ export class MenuMain extends BaseMenu { template[template.length - 1].submenu = this.macWindowSubmenuOptions; } - (template[template.length - 1].submenu as MenuItemConstructorOptions[]).splice(1, 0, { - label: this.main.i18nService.t(process.platform === 'darwin' ? 'hideToMenuBar' : 'hideToTray'), - click: () => this.main.messagingService.send('hideToTray'), - accelerator: 'CmdOrCtrl+Shift+M', - }); + (template[template.length - 1].submenu as MenuItemConstructorOptions[]).splice(1, 0, + { + label: this.main.i18nService.t(process.platform === 'darwin' ? 'hideToMenuBar' : 'hideToTray'), + click: () => this.main.messagingService.send('hideToTray'), + accelerator: 'CmdOrCtrl+Shift+M', + }, + { + type: 'checkbox', + label: this.main.i18nService.t('alwaysOnTop'), + checked: this.windowMain.win.isAlwaysOnTop(), + click: () => this.main.windowMain.toggleAlwaysOnTop(), + accelerator: 'CmdOrCtrl+Shift+T', + }); this.menu = Menu.buildFromTemplate(template); Menu.setApplicationMenu(this.menu);