Home

Awesome

xtray

create minimal tray apps on osx.

screenshot

Note: Swift 1.2 is no longer supported, so this module doesn't compile anymore. You can port the Swift part to Obj-C or look into the new Swift syntax if you really need to get this working.

example

var xtray = require('xtray');

xtray({
  name: 'Demo',
  icon: __dirname + '/icon.pdf'
}, function onlaunch () {
  console.log('launched');
  setInterval(function () {
    console.log('loop is safe');
  }, 1000);
}, function onquit () {
  console.log('will quit');
});

api

var xtray = require('xtray')

xtray(opts, [onlaunch, onquit])

Creates and launches the application.

opts object can have these properties:

You can provide the onlaunch callback that will be dispatched after the application is finished launching. This doesn't block node.js i/o.

A Quit [name] menu item is added by default. There is no explicit terminate method; you can provide the onquit callback that will be dispatched before the application quits.

building

This is indeed a super minimal demonstration of building a simple node.js ⇆ Swift bridge using objc runtime. Requires a Xcode build (>=6.3-beta) which is capable of compiling Swift 1.2.

packaging

Now, I haven't yet tested packaging a Swift framework, but it seems Xcode makes sure linked dependencies are also copied into build folder. I have tweaked search paths, so it should be safe to pack up node_modules as it is- greatly appreciated if you can open an issue if something goes wrong.

license

mit