[os x]Add support for tray click event on os x #1635

Merged
merged 1 commit into from Mar 3, 2014

Projects

None yet
@FWeinb
Contributor
FWeinb commented Feb 28, 2014

As @trevorlinton doesn't created a pull request for this for the last 4 month I am doing it now. This will fix Issue #510.

Simple example:

<html>
<body>
  <div>Click on the tray icon</div>
  <script>
    // Load library
    var gui = require('nw.gui');

    // Reference to tray
    var tray = new gui.Tray({ icon: 'icon.png' });

    // Alert on click
    tray.on('click', function() {
      alert("tray clicked");
    });
  </script>
</body>
</html>
@sindresorhus

👍

@miklschmidt

Awesome! Looking forward to using this!

@rogerwang rogerwang merged commit fe02e16 into nwjs:master Mar 3, 2014
@rogerwang
Member

@FWeinb please add another pull request to add yourself to AUTHORS Thanks.

@FWeinb FWeinb referenced this pull request Mar 3, 2014
Merged

Added myself to AUTHORS #1653

@mauvm
mauvm commented Apr 16, 2014

Will this be merged anytime soon?

@Mithgol
Contributor
Mithgol commented Apr 16, 2014

The code is already merged to the master branch as seen in the GitHub message above.

However, a new node-webkit's version containing the new code has not yet been released (the last release is dated Feb 2014, while the merge happened in March).

@joernroeder

Hey,
i just stumbled into the same issue on the current 0.8.6 release. Is this fix already released?

@cz-Michael

Could you please fix this in 0.8.4 and release it?

@ninjamonkno1

This is fixed, check the rc1 release.

@cz-Michael

@ninjamonkno1 Do you mean 0.8.4rc1? I need to use 0.8.4 which support child_process of Node.

@ninjamonkno1

@cz-Michael aha no, I only noticed it was in the latest release and can confirm it works in there. I would look at the release notes to see when the fix was added between 0.8.4 and 1rc.

@cz-Michael

@ninjamonkno1 cool, thank you. Cause higher versions of node-webkit do not support child_process of node right now. Only 0.8.4 works good for me.

@sashahilton00

Hi, I'm using the latest NW binary, and am once again seeing this problem:

var tray = new gui.Tray({ title: '', icon: 'images/Icon-Small.png' });

var menu = new gui.Menu();
//menu.append(new gui.MenuItem({ type: 'checkbox', label: 'box1' }));
tray.menu = menu;
tray.on('click',function() {
win.maximize();
console.log('maximized');
});

The code above is not working, any ideas why/mistakes I have made? I have defined the gui btw ;)

@mrfabbri
Member
mrfabbri commented Feb 5, 2015

Hi Sasha could you post a full example? What does not work? The window.maximize()? Does the message 'maximize' get logged to console?

On Feb 6, 2015, at 12:05 AM, Sasha Hilton notifications@github.com wrote:

Hi, I'm using the latest NW binary, and am once again seeing this problem:

var tray = new gui.Tray({ title: '', icon: 'images/Icon-Small.png' });

var menu = new gui.Menu();
//menu.append(new gui.MenuItem({ type: 'checkbox', label: 'box1' }));
tray.menu = menu;
tray.on('click',function() {
win.maximize();
console.log('maximized');
});

The code above is not working, any ideas why/mistakes I have made? I have defined the gui btw ;)


Reply to this email directly or view it on GitHub.

@sashahilton00

Nothing at all works. Not the maximize, or anything else I put in the function. The callback just isn't being executed. Nothing is logged to the console. I'm running OSX 10.9 btw.

I have just created a new project, and used the sample code to check if it is my fault, but still the same result, with the following:

var gui = require('nw.gui');
var tray = new gui.Tray({ title: '', icon: 'images/Icon-Small.png' });

tray.on('click', function() {
alert('Success');
});

@mrfabbri
Member
mrfabbri commented Feb 6, 2015

@sashahilton00 I couldn't reproduce it (example app: http://cl.ly/3u402n0y3j0N ). Tried on Mac OS X 10.10.2 (either with v0.11.6 or with v0.12.0-alpha2, 32-bit and 64-bit) and on Mac OS X 10.9.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment