diff --git a/electron/tray.js b/electron/tray.js index d19e2646..45d627ab 100644 --- a/electron/tray.js +++ b/electron/tray.js @@ -34,9 +34,27 @@ exports.create = function(win, config) { appIcon = new Tray(iconPath); appIcon.setToolTip('Rambox'); appIcon.setContextMenu(contextMenu); - appIcon.on('double-click', function() { - win.webContents.executeJavaScript('ipc.send("toggleWin", true);'); - }); + + switch (process.platform) { + case 'darwin': + break; + case 'linux': + case 'freebsd': + case 'sunos': + // Double click is not supported and Click its only supported when app indicator is not used. + // Read more here (Platform limitations): https://github.com/electron/electron/blob/master/docs/api/tray.md + appIcon.on('click', function() { + win.webContents.executeJavaScript('ipc.send("toggleWin", true);'); + }); + break; + case 'win32': + appIcon.on('double-click', function() { + win.webContents.executeJavaScript('ipc.send("toggleWin", true);'); + }); + break; + default: + break; + } }; exports.destroy = function() {