From 436933caa15fbd2a2d3f0770b1376f539fee69ed Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Sun, 6 Mar 2022 21:09:01 -0800 Subject: [PATCH] feat(kopiaui): support both left and right click to open tray menu (#1805) * feat(kopiaui): support both left and right click to open tray menu Fixes #1798 * feat(kopiaui): show all repository windows on double click --- app/public/electron.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/public/electron.js b/app/public/electron.js index aa8cf8731..eaab5f004 100644 --- a/app/public/electron.js +++ b/app/public/electron.js @@ -305,6 +305,15 @@ function showAllRepoWindows() { allConfigs().forEach(showRepoWindow); } +function safeTrayHandler(ev, h) { + tray.on(ev, () => { + try { + h(); + } catch (e) { + } + }) +} + app.on('ready', () => { loadConfigs(); @@ -327,6 +336,11 @@ app.on('ready', () => { selectByOS({ mac: 'kopia-tray.png', win: 'kopia-tray.ico', linux: 'kopia-tray.png' }))); tray.setToolTip('Kopia'); + + safeTrayHandler("click", () => tray.popUpContextMenu()); + safeTrayHandler("right-click", () => tray.popUpContextMenu()); + safeTrayHandler("double-click", () => showAllRepoWindows()); + updateTrayContextMenu(); refreshWillLaunchAtStartup(); updateDockIcon();