arboleya / electrify

Package your Meteor apps with Electron, and butter
MIT License
247 stars 52 forks source link

Electrify menubar #52

Open ebradbury opened 8 years ago

ebradbury commented 8 years ago

How can I use Electrify with menubar?

I took a working electron+menubar app and tried to integrate meteor with Electrify. But can't get it working...

Is it something with how menubar hooks into the electron app? Maybe here?

Tried this:

var app       = require('app');
var menubar = require('menubar');
var electrify = require('electrify')(__dirname);

var mb = null;

app.on('ready', function() {
  // gets here
  console.log('app ready');

  electrify.start(function(meteor_root_url) {
    // gets here
    console.log('electrify started');

    mb = menubar({
      index: meteor_root_url,
    });

    mb.on('ready', function() {
      // never gets here
      console.log('menubar ready');
    });
  }); 
});

Also tried:

electrify.start(function(meteor_root_url) {
  // gets here
  console.log('electrify started');

  mb = menubar({
    index: meteor_root_url,
  });

  mb.on('ready', function() {
    // never gets here
    console.log('menubar ready');
  });
});

There are no errors in the console and an electron app starts but there is no window or tray icon.

Any help would be much appreciated!

ebradbury commented 8 years ago

Update...

This works:

mb = menubar({
  index: 'http://127.0.0.1:3000',
});

mb.on('ready', function() {
  // gets here
  electrify.start(function(meteor_root_url) {
    // and here
  });
});

Why?