From 560933c8a3d310692bbafd47361925dd2d5c183a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=98stergren?= Date: Tue, 18 Feb 2020 18:57:43 +0100 Subject: [PATCH 01/14] Added 'Reset Position' to Tray menu --- source/tray.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/tray.ts b/source/tray.ts index a3024c5a4..14bd6116b 100644 --- a/source/tray.ts +++ b/source/tray.ts @@ -73,6 +73,14 @@ export default { toggleWindow(); } }, + { + label: 'Reset Position', + visible: !is.macos, + click() { + win.setPosition(0,0); + } + + }, ...macosMenuItems, { type: 'separator' From 05283b82974c87c0b07e01edfabf9360129538a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=98stergren?= Date: Tue, 18 Feb 2020 18:59:02 +0100 Subject: [PATCH 02/14] Added ability to quit program with Ctrl+Q --- readme.md | 1 + source/menu.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 3e7083be6..cfae824f4 100644 --- a/readme.md +++ b/readme.md @@ -188,6 +188,7 @@ Toggle sidebar | Command/Control Shift sCommand/Control Shift 1 Switch to Workchat | Command/Control Shift 2 Preferences | Command/Control , +Quit | Command/Control Q ###### Tip diff --git a/source/menu.ts b/source/menu.ts index 70def8468..65c0a5a0f 100644 --- a/source/menu.ts +++ b/source/menu.ts @@ -744,6 +744,7 @@ ${debugInfo()}`; type: 'separator' }, { + accelerator: 'CommandOrControl+Q', role: 'quit' } ] From fbdadf3aed5c24f83ae81cffcd7b4925bd572bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=98stergren?= Date: Tue, 18 Feb 2020 19:05:42 +0100 Subject: [PATCH 03/14] Fix linting issues --- source/browser.ts | 1 - source/tray.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/source/browser.ts b/source/browser.ts index 19e2896e8..2e48a8419 100644 --- a/source/browser.ts +++ b/source/browser.ts @@ -573,7 +573,6 @@ document.addEventListener('DOMContentLoaded', async () => { // Prevent flash of white on startup when in dark mode // TODO: find a CSS-only solution if (!is.macos && config.get('darkMode')) { - // eslint-disable-next-line require-atomic-updates document.documentElement.style.backgroundColor = '#1e1e1e'; } diff --git a/source/tray.ts b/source/tray.ts index 14bd6116b..6be25e0d0 100644 --- a/source/tray.ts +++ b/source/tray.ts @@ -77,7 +77,7 @@ export default { label: 'Reset Position', visible: !is.macos, click() { - win.setPosition(0,0); + win.setPosition(0, 0); } }, From 1102072e10f5ebac65d4b8bcd1574f118e3adb16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=98stergren?= Date: Tue, 18 Feb 2020 20:00:18 +0100 Subject: [PATCH 04/14] Fix linting and override default rule. --- package.json | 5 ++++- source/browser.ts | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ba405359e..711fb35c6 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,10 @@ "envs": [ "node", "browser" - ] + ], + "rules": { + "eslint-comments/no-unused-disable": "warn" + } }, "stylelint": { "extends": "stylelint-config-xo", diff --git a/source/browser.ts b/source/browser.ts index 2e48a8419..e88e29b86 100644 --- a/source/browser.ts +++ b/source/browser.ts @@ -573,6 +573,7 @@ document.addEventListener('DOMContentLoaded', async () => { // Prevent flash of white on startup when in dark mode // TODO: find a CSS-only solution if (!is.macos && config.get('darkMode')) { + /* eslint-disable-next-line require-atomic-updates */ document.documentElement.style.backgroundColor = '#1e1e1e'; } From 9f6e1adb3b92e705f7881bd325ee076edb3d9b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=98stergren?= Date: Tue, 25 Feb 2020 21:42:24 +0100 Subject: [PATCH 05/14] Feature to restore mainWindow position when screen is removed --- source/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/index.ts b/source/index.ts index b82b2a6d7..2681c12fc 100644 --- a/source/index.ts +++ b/source/index.ts @@ -92,6 +92,14 @@ app.on('second-instance', () => { } }); +// Main window should move to the same position as when it was another screen +app.on('ready', () => { + electronScreen.on('display-removed', () => { + const oldPosition = mainWindow.getPosition(); + mainWindow.setPosition(oldPosition[0], oldPosition[1]); + }); +}); + function getMessageCount(conversations: Conversation[]): number { return conversations.filter(({unread}) => unread).length; } From 073ebf120773db10354deefb89afd44a904dcbdc Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 7 Mar 2020 00:07:31 +0800 Subject: [PATCH 06/14] Update package.json --- package.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/package.json b/package.json index 711fb35c6..ba405359e 100644 --- a/package.json +++ b/package.json @@ -68,10 +68,7 @@ "envs": [ "node", "browser" - ], - "rules": { - "eslint-comments/no-unused-disable": "warn" - } + ] }, "stylelint": { "extends": "stylelint-config-xo", From 5443b6ce164cf6080225ac26f65f5883b8fbefad Mon Sep 17 00:00:00 2001 From: tomioe <37123611+tomioe@users.noreply.github.com> Date: Sun, 8 Mar 2020 20:38:19 +0100 Subject: [PATCH 07/14] Update source/index.ts based on PR comment Co-Authored-By: Sindre Sorhus --- source/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.ts b/source/index.ts index 2681c12fc..ac990d428 100644 --- a/source/index.ts +++ b/source/index.ts @@ -95,7 +95,7 @@ app.on('second-instance', () => { // Main window should move to the same position as when it was another screen app.on('ready', () => { electronScreen.on('display-removed', () => { - const oldPosition = mainWindow.getPosition(); + const [x, y] = mainWindow.getPosition(); mainWindow.setPosition(oldPosition[0], oldPosition[1]); }); }); From c19cab81fa934546f86de9a3db975e7236a6f200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=98stergren?= Date: Sun, 8 Mar 2020 20:44:11 +0100 Subject: [PATCH 08/14] Improved readability and fixed incorrect comment grammar --- source/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/index.ts b/source/index.ts index ac990d428..d5c16af73 100644 --- a/source/index.ts +++ b/source/index.ts @@ -92,11 +92,11 @@ app.on('second-instance', () => { } }); -// Main window should move to the same position as when it was another screen +// Main window should move to the same position as it had on another screen app.on('ready', () => { electronScreen.on('display-removed', () => { const [x, y] = mainWindow.getPosition(); - mainWindow.setPosition(oldPosition[0], oldPosition[1]); + mainWindow.setPosition(x, y); }); }); From fd1a60c29608b12e8e45e793699f27ee6ec2b6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=98stergren?= Date: Sun, 8 Mar 2020 20:44:54 +0100 Subject: [PATCH 09/14] Reverted unintentional, irrelevant change and removed tray meny element. --- source/browser.ts | 2 +- source/tray.ts | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/source/browser.ts b/source/browser.ts index e88e29b86..19e2896e8 100644 --- a/source/browser.ts +++ b/source/browser.ts @@ -573,7 +573,7 @@ document.addEventListener('DOMContentLoaded', async () => { // Prevent flash of white on startup when in dark mode // TODO: find a CSS-only solution if (!is.macos && config.get('darkMode')) { - /* eslint-disable-next-line require-atomic-updates */ + // eslint-disable-next-line require-atomic-updates document.documentElement.style.backgroundColor = '#1e1e1e'; } diff --git a/source/tray.ts b/source/tray.ts index 6be25e0d0..a3024c5a4 100644 --- a/source/tray.ts +++ b/source/tray.ts @@ -73,14 +73,6 @@ export default { toggleWindow(); } }, - { - label: 'Reset Position', - visible: !is.macos, - click() { - win.setPosition(0, 0); - } - - }, ...macosMenuItems, { type: 'separator' From fe06bc1d3c6f772d0d137ff973c474ffd8fc8a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=98stergren?= Date: Sun, 8 Mar 2020 21:13:49 +0100 Subject: [PATCH 10/14] Added generated accelerators to top-level menu items and removed unconventional 'Quit' shortcut. --- source/menu.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/menu.ts b/source/menu.ts index 65c0a5a0f..6c35486ba 100644 --- a/source/menu.ts +++ b/source/menu.ts @@ -720,6 +720,7 @@ ${debugInfo()}`; const linuxWindowsTemplate: MenuItemConstructorOptions[] = [ { role: 'fileMenu', + label: '&File', submenu: [ newConversationItem, { @@ -744,24 +745,27 @@ ${debugInfo()}`; type: 'separator' }, { - accelerator: 'CommandOrControl+Q', + label: 'E&xit', role: 'quit' } ] }, { - role: 'editMenu' + role: 'editMenu', + label: '&Edit' }, { role: 'viewMenu', + label: '&View', submenu: viewSubmenu }, { - label: 'Conversation', + label: '&Conversation', submenu: conversationSubmenu }, { role: 'help', + label: '&Help', submenu: helpSubmenu } ]; @@ -770,7 +774,7 @@ ${debugInfo()}`; if (is.development) { template.push({ - label: 'Debug', + label: '&Debug', submenu: debugSubmenu }); } From 820c59a44ac40e2c1bf90dea03dbd7accdffd2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=98stergren?= Date: Sun, 8 Mar 2020 21:15:54 +0100 Subject: [PATCH 11/14] Removed newly introduced keyboard shortcut from README --- readme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/readme.md b/readme.md index cfae824f4..3e7083be6 100644 --- a/readme.md +++ b/readme.md @@ -188,7 +188,6 @@ Toggle sidebar | Command/Control Shift sCommand/Control Shift 1 Switch to Workchat | Command/Control Shift 2 Preferences | Command/Control , -Quit | Command/Control Q ###### Tip From 6404ed12a3c585a069a5225d93c45f642a3619b9 Mon Sep 17 00:00:00 2001 From: tomioe <37123611+tomioe@users.noreply.github.com> Date: Mon, 9 Mar 2020 09:43:45 +0100 Subject: [PATCH 12/14] Rephrased comment in source/index.ts Co-Authored-By: Sindre Sorhus --- source/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.ts b/source/index.ts index d5c16af73..e2c3704f2 100644 --- a/source/index.ts +++ b/source/index.ts @@ -92,7 +92,7 @@ app.on('second-instance', () => { } }); -// Main window should move to the same position as it had on another screen +// Preserves the window position when a display is removed and Caprine is moved to a different screen. app.on('ready', () => { electronScreen.on('display-removed', () => { const [x, y] = mainWindow.getPosition(); From 46083f35a5465dc76485728218f494213b74ab9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=98stergren?= Date: Mon, 9 Mar 2020 18:31:58 +0100 Subject: [PATCH 13/14] Removed indicator for auto generated accelerators --- source/menu.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/source/menu.ts b/source/menu.ts index 6c35486ba..f273f623b 100644 --- a/source/menu.ts +++ b/source/menu.ts @@ -720,7 +720,6 @@ ${debugInfo()}`; const linuxWindowsTemplate: MenuItemConstructorOptions[] = [ { role: 'fileMenu', - label: '&File', submenu: [ newConversationItem, { @@ -745,27 +744,22 @@ ${debugInfo()}`; type: 'separator' }, { - label: 'E&xit', role: 'quit' } ] }, { - role: 'editMenu', - label: '&Edit' + role: 'editMenu' }, { role: 'viewMenu', - label: '&View', submenu: viewSubmenu }, { - label: '&Conversation', submenu: conversationSubmenu }, { role: 'help', - label: '&Help', submenu: helpSubmenu } ]; @@ -774,7 +768,6 @@ ${debugInfo()}`; if (is.development) { template.push({ - label: '&Debug', submenu: debugSubmenu }); } From 0ac9b6baec7959ac8c4628bb294273dbb8a082fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=98stergren?= Date: Mon, 9 Mar 2020 20:41:31 +0100 Subject: [PATCH 14/14] restored original menu item labels --- source/menu.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/menu.ts b/source/menu.ts index f273f623b..70def8468 100644 --- a/source/menu.ts +++ b/source/menu.ts @@ -756,6 +756,7 @@ ${debugInfo()}`; submenu: viewSubmenu }, { + label: 'Conversation', submenu: conversationSubmenu }, { @@ -768,6 +769,7 @@ ${debugInfo()}`; if (is.development) { template.push({ + label: 'Debug', submenu: debugSubmenu }); }