Example #1
0
		show: function(notificationID, info, callback) {
			var notifier = require('node-notifier'),
				path = require('path'), 
				execPath = path.dirname(process.execPath),
				imagePath = execPath + '/notification.png'

			// nwjs execution path is in Peerio.app/Contents/Frameworks/nwjs\ Helper.app/Contents/MacOS/
			if (process.platform == 'darwin') {
				imagePath = path.join(execPath, '..', '..', '..', '..', 'Resources', 'app.nw', 'img', 'notification.png');
			}

			notifier.notify({
				'title': info.title,
				'subtitle': info.contextMessage,
				'message': info.message,
				'sound': false,
				'icon':  imagePath,
				'contentImage': imagePath,
				'wait': true
			}, function() {
				if (typeof(callback) === 'function') {
					callback(notificationID)
				}
			})
			notifier.on('click', function() {
				window.focus()
				var conversationID = notificationID.match(/^\w{16,32}/)[0]
				Peerio.UI.selectConversation(conversationID)
			})
		},
Example #2
0
}, () => {
    notifier.on('click', (obj, opts) => {
      open(requestUrl);
    });
    let message = `Found a match, for keywords ${searchKey} ${os.type() != 'Windows_NT' ? `, <a href="${requestUrl}">Go</a>` : '' }` 
    notifier.notify({
        title: 'Found something!',
        message: message,
        sound: true, 
        wait: true
    });
}, true);
Example #3
0
gulp.task('notify', function () {
  // Desktop notifications for PHP errors
  var logFile = new Tail('/Applications/MAMP/logs/php_error.log'),
      baseDir = __dirname.replace(/\/theme.*/, ''),
      dirRegex = new RegExp(baseDir, 'gi'),
      lastMessage = null,
      messageTimeout = null;

  notifier.on('click', function (a, b) {
    exec('open -a Terminal');
  });

  logFile.on('line', function (data) {
    if (!/^\[.+?UTC\]\s*/.test(data)) {
      return;
    }

    var title = proxy_url,
        string = data.replace(dirRegex, '')
                     .replace(/\/theme[^\/]+\/[^\/]+\//g, '')
                     .replace(/^\[.+?UTC\]\s*/, '')
                     .replace(/^([A-Za-z]+\s*){1,3}:\s*/, function (m) {
                        title = m;
                        return '';
                     })
                     .replace(/(\/[^\/\s]+)+/, function (path) {
                        return path.truncate(35, 'middle');
                     });

    console.log(data);

    if (string == lastMessage) {
      return;
    }

    lastMessage = string;
    clearTimeout(messageTimeout);

    messageTimeout = setTimeout(function () {
      notifier.notify({
        title: title,
        message: string,
        icon: baseDir + '/uploads/2017/04/cropped-spc-logo-only-100x100.png',
        timeout: 5,
        actions: 'Console'
      });
    }, 2500);
  });
});
Example #4
0
function init(config, events) {
	events.on('friendly-hero', function(data){
		friendlyClass = data.cardName;
		notify();
	});
	events.on('opposing-hero', function(data){
		opposingClass = data.cardName;
		notify();
	});

	events.on('game-over', function(data){
		opposingClass = null;
		friendlyClass = null;
	});


	notifier.on('click', function (notifierObject, options) {
		window.focus();
	});

	notifier.on('timeout', function (notifierObject, options) {

	});
}
Example #5
0
exports.notify = (title, message, fn) => {
	notifier.notify({
		title: title,
		message: message,
		icon: path.join(__dirname, '*****@*****.**'),
		sound: true,
		contentImage: void 0,
		wait: false
	}, (err, response) => {
		console.log(arguments);
	});

	notifier.on('click', (notifierObject, options) => {
		fn();
	});
}
Example #6
0
process.on('message', function onMessage(data) {
  notifier.notify({
    title: data.title,
    message: data.message,
    wait: true
  }, function callback() {
    _.defer(function deferredExit() {
      process.exit();
    });
  });

  notifier.on('click', function onClick() {
    var editor = process.env.EDITOR || 'subl';
    exec(editor + ' ' + data.files.join(' '));
  });
});
Example #7
0
		show: function(notificationID, info, callback) {
			var notifier = require('node-notifier')
			var path = require('path')
			var execPath = path.dirname(process.execPath)
			notifier.notify({
				'title': info.title,
				'subtitle': info.contextMessage,
				'message': info.message,
				'sound': false,
				'icon':  execPath + '/notification.png',
				'contentImage': execPath + '/notification.png',
				'wait': true
			}, function() {
				if (typeof(callback) === 'function') {
					callback(notificationID)
				}
			})
			notifier.on('click', function() {
				window.focus()
				var conversationID = notificationID.match(/^\w{16,32}/)[0]
				Peerio.UI.selectConversation(conversationID)
			})
		},
Example #8
0
  time = color(getTime() + ": ", "cyan");
  console_out(leader + time + data.message);
});

socket.on('fileDownload', function(data){
  fs.writeFile(data.name, data.fileData,(err)=>{
    if(err) throw err;
    console_out("The file " + data.name + " was saved successfully...");
  })
});

socket.on('message', function (data) {
    var leader;
    var time;
    if (data.type == 'chat') {
        leader = color(data.nick+ getTime() + ": ", "cyan");
        console_out(leader + data.message);
    }
    else if (data.type == "notice") {
        console_out(color(data.message, 'cyan'));
    }
    else if (data.type == "emote") {
        console_out(color(data.message, "blue_bg+white"));
    }
});

notifier.on('click', function (notifierObject, options) {
  // Triggers if `wait: true` and user clicks notification
  socket.emit('toastread',{toastFrom: options.from});
});
Example #9
0
module.exports.on = function (event, fn) {
  if (!notifier) return;
  return notifier.on(event, function (notifyObject, options) {
    return fn(options);
  });
};
Example #10
0
var hg = require('node--hg');
var HGMonitor = require('node--hg-monitor');
var MainView = require('./main-view.js');
var React = require('react');

require('../styles/main.css');
var imgDir = path.join(process.cwd(), 'content/images');

var directory = 'C:/html5';
var repo = null;
var monitor = null;
var repoState = hg.State.clean;
var waiting = false;

notifier.on('click', function(){
    win.show();
});

win.on('close', function(){
    this.hide();
    notifier.notify({
        title: 'Source Command still running',
        message: 'click tray icon to open.',
        icon: path.join(imgDir, 'check-in.png'),
        tag: 'running'
    });
});

function update(){
    return repo.getCurrentState().then(function(state){
        switch (state){
Example #11
0
 init() {
     nn.on('click', () => {
         opn('', { app: 'Discord' });
     });
 }
Example #12
0
var notifier = require('node-notifier');
var path = require('path');

console.log(path.join(__dirname, '/app/img/a.png'));

// notifier
notifier.notify({
    title: 'My notification',
    message: 'Hello World!',
    icon: path.join(__dirname, '/app/img/a.png'),
    sound: true,
    contentImage: path.join(__dirname, '/app/img/a.png'),
    open: 'http://github.com',
    wait: true
}, function (err, response) {
    // Response is response from notification
    console.log(response);
});

notifier.on('click', function (notifierObject, options) {
    // Triggers if `wait: true` and user clicks notification
    console.log(notifierObject);
});

notifier.on('timeout', function (notifierObject, options) {
    // Triggers if `wait: true` and notification closes
    console.log(notifierObject);
});
Example #13
0
var App = require('app');
var TrayMenu = require("./tray_menu");
var Shell = require("shelljs");
var BranchDB = require("./branch_db");
var PrefsDB = require("./prefs_db");
var BranchStatus = require("./branch_status");
var Promise = require("bluebird");
var notifier = require("node-notifier");
var cp = require("child_process");

// when clicking on the notification, we display the menubar
notifier.on("click", function() {
  cp.exec("osascript '" + __dirname + "/scripts/show-menu-bar.applescript'");
});

function failureNotification(failedBranches) {
  var message;
  if (failedBranches.length === 1) {
    message = failedBranches[0] + " is now failing!";
  } else {
    message = failedBranches.length + " branches are now failing!\n";
    message += failedBranches.join(", ");
  };

  notifier.notify({
    title : "Jenkinator",
    message: message,
    sound: "Ping",
    wait : true
  });
}
Example #14
0
mb.on('ready', function ready () {

  var closeWindow = ()=> {
    mb.hideWindow();
  }
  var openWindow = ()=> {
    mb.showWindow(mb.tray.getBounds());
  }

  ipcMain.on('renderer_init', function(event, arg) {

    var sender = event.sender

    //
    // Toggle window show and hide
    globalShortcut.register('ctrl+shift+p', ()=> {
      if(mb.window.isVisible()) {
        closeWindow();
      } else {
        openWindow();
      }
    });

    //
    // Start pomodoro recently track
    globalShortcut.register('ctrl+shift+m', ()=> {
      sender.send('pomo_start')
    });
  });

  //
  // Setting ipc event
  ipcMain.on('notify', (event, title, message)=> {
    notifier.notify({
      title: title,
      icon: NOTIFY_ICON,
      message: message
    })
  });
  ipcMain.on('show_window', (event, arg)=> {
    openWindow();
  });
  ipcMain.on('set_title', (event, text)=> {
    setTrayTitle(text.trim())
  });
  ipcMain.on('mark_unread', (event, arg)=> {
    switchIconUnread();
  });
  ipcMain.on('quit', (event, arg)=> {
    app.quit();
  });
  ipcMain.on('reload', (event, arg)=> {
    let browserWindow = event.sender;
    browserWindow.reload()
  });
  notifier.on('click', (event, arg)=> {
    mb.showWindow();
  });
  mb.on('show', ()=> {
    setTimeout(()=> {
      switchIconRead();
    }, 1000);
  })
  mb.on('hide', ()=> {
    switchIconRead();
  })

  mb.showWindow();
  mb.hideWindow();
  // NOTE: Comment out for display Dev tool
  initMenu();
  switchIconUnread();
})