I try to capture a click even on the tray icon by clicking the context menu on OSX, but according to the docs, this is somehow disabled in OSX:
Platform limitations: On OS X clicked event will be ignored if the tray icon has context menu.
I am wondering if there is another way to find out when it interacts with the tray icon with the context menu?
Relavent code:
var app = require('app'); var path = require('path') var Menu = require('menu'); var MenuItem = require('menu-item'); var Tray = require('tray'); var appIcon = null; var menu = null; app.on('ready', function(){ appIcon = new Tray(path.join(__dirname, 'images/icon.png')); appIcon.on('clicked', function(event, bounds) { console.log('clicked'); }); menu = new Menu(); menu.append(new MenuItem({ label: 'Quit', id: 'quit', click: function() { app.quit(); } })); appIcon.setContextMenu(menu); });
source share