From b1ab1c75d63a4e71d25aab2b9627e45f6c90b85a Mon Sep 17 00:00:00 2001 From: d Date: Thu, 6 Feb 2020 23:43:27 +0200 Subject: [PATCH] 3.6.6 remove global Escape key registering, interfiered other app normal behaviours. Registered Escape key locally instead. So user can exit fullscreen with that. --- electron/app/menu-builder.ts | 9 +++++++++ electron/app/window-manager.ts | 14 +------------- electron/package.json | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/electron/app/menu-builder.ts b/electron/app/menu-builder.ts index c173f12f..7baee1cd 100644 --- a/electron/app/menu-builder.ts +++ b/electron/app/menu-builder.ts @@ -34,6 +34,15 @@ export default class MenuBuilder { { role: 'zoomout' }, { type: 'separator' }, { role: 'togglefullscreen' }, + { + label: 'Exit fullscreen', + accelerator: 'Escape', + click() { + if (WindowManager.mainWindow) { + WindowManager.mainWindow.setFullScreen(false); + } + }, + }, ], }, { diff --git a/electron/app/window-manager.ts b/electron/app/window-manager.ts index c693e960..b7d52008 100644 --- a/electron/app/window-manager.ts +++ b/electron/app/window-manager.ts @@ -1,12 +1,11 @@ import { menubar } from 'menubar'; import MenuBuilder from './menu-builder'; import { throttle } from 'lodash'; -import { app, ipcMain, BrowserWindow, globalShortcut } from 'electron'; +import { app, ipcMain, BrowserWindow } from 'electron'; import config from './config'; import * as os from 'os'; import { logManager } from './log-manager'; import { join } from 'path'; -import { stateManager } from '../app/state-manager'; let logger = logManager.getLogger('WindowManager'); @@ -77,18 +76,7 @@ export default class WindowManager { this.mainWindow.focus(); }); - globalShortcut.register('Escape', () => { - logger.info('Escape is pressed'); - - if (this.mainWindow) { - this.mainWindow.setFullScreen(false); - } - }); - this.mainWindow.on('close', () => { - // Unregister all shortcuts. - globalShortcut.unregisterAll(); - if (this.mainWindow) { logger.info('Closing window'); this.mainWindow = null; diff --git a/electron/package.json b/electron/package.json index 996b77e6..3031ba2e 100644 --- a/electron/package.json +++ b/electron/package.json @@ -1,6 +1,6 @@ { "name": "tockler", - "version": "3.6.5", + "version": "3.6.6", "description": "Automatically track applications usage and working time", "author": "Maigo Erit ", "license": "GPL-2.0",