From 65d922a9fd461cd5c211ce498145e2e4c09ec832 Mon Sep 17 00:00:00 2001 From: Richard Killen Date: Tue, 9 Nov 2021 15:34:12 -0600 Subject: [PATCH 1/2] Fix problem with app menu appearing on modal dialogs in Linux --- electron/app/js/promptUtils.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/electron/app/js/promptUtils.js b/electron/app/js/promptUtils.js index 957a63ff8..26b1f6777 100644 --- a/electron/app/js/promptUtils.js +++ b/electron/app/js/promptUtils.js @@ -32,6 +32,7 @@ async function getCredentialPassphrase(parentWindow) { alwaysOnTop: false, useContentSize: true, modal: Boolean(parentWindow), + autoHideMenuBar: true, menuBarVisible: false, webPreferences: { nodeIntegration: false, @@ -42,7 +43,9 @@ async function getCredentialPassphrase(parentWindow) { }, }); + // hide app menu for various platforms promptWindow.setMenu(null); + promptWindow.removeMenu(); promptWindow.setMenuBarVisibility(false); const getOptionsListener = event => { @@ -128,7 +131,8 @@ async function showAboutDialog(wktApp, parentWindow) { skipTaskbar: true, alwaysOnTop: false, useContentSize: true, - modal: Boolean(parentWindow), + modal: Boolean(parentWindow), // false causes problems with app menu appearing + autoHideMenuBar: true, menuBarVisible: false, webPreferences: { nodeIntegration: false, @@ -139,7 +143,9 @@ async function showAboutDialog(wktApp, parentWindow) { }, }); + // hide app menu for various platforms promptWindow.setMenu(null); + promptWindow.removeMenu(); promptWindow.setMenuBarVisibility(false); const getOptionsListener = event => { From 3f4a345865ceaf31172ac04adc6d4b378a5b815c Mon Sep 17 00:00:00 2001 From: Richard Killen Date: Tue, 9 Nov 2021 15:51:16 -0600 Subject: [PATCH 2/2] Remove OK button from about dialog, close on escape --- electron/app/js/prompt/about.html | 3 --- electron/app/js/prompt/about.js | 8 +------- electron/app/js/promptUtils.js | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/electron/app/js/prompt/about.html b/electron/app/js/prompt/about.html index 10dfaff61..691b45033 100644 --- a/electron/app/js/prompt/about.html +++ b/electron/app/js/prompt/about.html @@ -17,9 +17,6 @@
...
...
-
- -
diff --git a/electron/app/js/prompt/about.js b/electron/app/js/prompt/about.js index 0f1799f95..55c01f5c7 100644 --- a/electron/app/js/prompt/about.js +++ b/electron/app/js/prompt/about.js @@ -32,9 +32,7 @@ function promptRegister() { return promptError(error); } - const okButton = document.querySelector('#ok'); - - okButton.addEventListener('keyup', event => { + document.addEventListener('keyup', event => { if (event.key === 'Escape') { promptCancel(); } @@ -42,8 +40,6 @@ function promptRegister() { document.querySelector('#form').addEventListener('submit', promptSubmit); - okButton.focus(); - window.api.i18n.ready.then(() => { const versionText = window.api.i18n.t('dialog-about-version', { version: promptOptions.applicationVersion, @@ -55,8 +51,6 @@ function promptRegister() { document.querySelector('#version').textContent = versionText; document.querySelector('#copyright').textContent = promptOptions.copyright; - okButton.textContent = window.api.i18n.t('dialog-button-ok'); - const height = document.querySelector('body').offsetHeight; window.api.ipc.sendSync('prompt-size:' + promptId, height); }); diff --git a/electron/app/js/promptUtils.js b/electron/app/js/promptUtils.js index 26b1f6777..610c5cde0 100644 --- a/electron/app/js/promptUtils.js +++ b/electron/app/js/promptUtils.js @@ -113,7 +113,7 @@ async function showAboutDialog(wktApp, parentWindow) { const preloadFile = path.join(__dirname, 'prompt', 'preload.js'); const WIDTH = 400; - const HEIGHT = 234; // renderer will send IPC to adjust this + const HEIGHT = 186; // renderer will send IPC to adjust this const MIN_HEIGHT = 120; // needs to be smaller than content height return new Promise((resolve, reject) => {