From add278e443b05ce43089ea6f55c9978a693432a9 Mon Sep 17 00:00:00 2001 From: Korbs Date: Wed, 27 Mar 2024 18:02:35 -0400 Subject: [PATCH] Set focus and blur on macOS --- src/process/window.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/process/window.js b/src/process/window.js index be549c8..01704a7 100644 --- a/src/process/window.js +++ b/src/process/window.js @@ -46,12 +46,16 @@ module.exports = { ipcMain.on('UnmaximizeWindow', () => {mainWindow.restore()}) ipcMain.on('MinimizeWindow', () => {mainWindow.minimize()}) - // Move Tabs when entering or existing fullscreen on macOS if (process.platform === 'darwin') { + // Move Tabs when entering or existing fullscreen on macOS mainWindow.on('enter-full-screen', (e, cmd) => {mainWindow.webContents.executeJavaScript(`document.querySelector("tab-group").shadowRoot.querySelector("nav").style.left = '0px'`)}) mainWindow.on('leave-full-screen', (e, cmd) => {mainWindow.webContents.executeJavaScript(`document.querySelector("tab-group").shadowRoot.querySelector("nav").style.left = '80px'`)}) + // Fade Top Bar if the end-user leaves the window on macOS + mainWindow.on('blur', (e, cmd) => {mainWindow.webContents.executeJavaScript(`document.querySelector("body > sl-include:nth-child(4) > tab-group").shadowRoot.querySelector("div > nav").style.opacity = '0.5'`)}) + mainWindow.on('focus', (e, cmd) => {mainWindow.webContents.executeJavaScript(`document.querySelector("body > sl-include:nth-child(4) > tab-group").shadowRoot.querySelector("div > nav").style.opacity = '1'`)}) } + // Other Functions mainWindowState.manage(mainWindow) Menu.MainMenu()