Giter Club home page Giter Club logo

node-notifier's Introduction

node-notifier NPM version Install size Build Status

Send cross platform native notifications using Node.js. Notification Center for macOS, notify-osd/libnotify-bin for Linux, Toasters for Windows 8/10, or taskbar balloons for earlier Windows versions. Growl is used if none of these requirements are met. Works well with Electron.

macOS Screenshot Native Windows Screenshot

Input Example macOS Notification Center

Input Example

Actions Example Windows SnoreToast

Actions Example

Quick Usage

Show a native notification on macOS, Windows, Linux:

const notifier = require('node-notifier');
// String
notifier.notify('Message');

// Object
notifier.notify({
  title: 'My notification',
  message: 'Hello, there!'
});

Requirements

  • macOS: >= 10.8 for native notifications, or Growl if earlier.
  • Linux: notify-osd or libnotify-bin installed (Ubuntu should have this by default)
  • Windows: >= 8, or task bar balloons for Windows < 8. Growl as fallback. Growl takes precedence over Windows balloons.
  • General Fallback: Growl

See documentation and flow chart for reporter choice.

Install

npm install --save node-notifier

CLI

CLI has moved to separate project: https://github.com/mikaelbr/node-notifier-cli

Cross-Platform Advanced Usage

Standard usage, with cross-platform fallbacks as defined in the reporter flow chart. All of the options below will work in some way or another on most platforms.

const notifier = require('node-notifier');
const path = require('path');

notifier.notify(
  {
    title: 'My awesome title',
    message: 'Hello from node, Mr. User!',
    icon: path.join(__dirname, 'coulson.jpg'), // Absolute path (doesn't work on balloons)
    sound: true, // Only Notification Center or Windows Toasters
    wait: true // Wait with callback, until user action is taken against notification, does not apply to Windows Toasters as they always wait or notify-send as it does not support the wait option
  },
  function (err, response, metadata) {
    // Response is response from notification
    // Metadata contains activationType, activationAt, deliveredAt
  }
);

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

notifier.on('timeout', function (notifierObject, options) {
  // Triggers if `wait: true` and notification closes
});

If you want super fine-grained control, you can customize each reporter individually, allowing you to tune specific options for different systems.

See below for documentation on each reporter.

Example:

const NotificationCenter = require('node-notifier/notifiers/notificationcenter');
new NotificationCenter(options).notify();

const NotifySend = require('node-notifier/notifiers/notifysend');
new NotifySend(options).notify();

const WindowsToaster = require('node-notifier/notifiers/toaster');
new WindowsToaster(options).notify();

const Growl = require('node-notifier/notifiers/growl');
new Growl(options).notify();

const WindowsBalloon = require('node-notifier/notifiers/balloon');
new WindowsBalloon(options).notify();

Or, if you are using several reporters (or you're lazy):

// NOTE: Technically, this takes longer to require
const nn = require('node-notifier');

new nn.NotificationCenter(options).notify();
new nn.NotifySend(options).notify();
new nn.WindowsToaster(options).notify(options);
new nn.WindowsBalloon(options).notify(options);
new nn.Growl(options).notify(options);

Contents

Usage: NotificationCenter

Same usage and parameter setup as terminal-notifier.

Native Notification Center requires macOS version 10.8 or higher. If you have an earlier version, Growl will be the fallback. If Growl isn't installed, an error will be returned in the callback.

Example

Because node-notifier wraps around terminal-notifier, you can do anything terminal-notifier can, just by passing properties to the notify method.

For example:

  • if terminal-notifier says -message, you can do {message: 'Foo'}
  • if terminal-notifier says -list ALL, you can do {list: 'ALL'}.

Notification is the primary focus of this module, so listing and activating do work, but they aren't documented.

All notification options with their defaults:

const NotificationCenter = require('node-notifier').NotificationCenter;

var notifier = new NotificationCenter({
  withFallback: false, // Use Growl Fallback if <= 10.8
  customPath: undefined // Relative/Absolute path to binary if you want to use your own fork of terminal-notifier
});

notifier.notify(
  {
    title: undefined,
    subtitle: undefined,
    message: undefined,
    sound: false, // Case Sensitive string for location of sound file, or use one of macOS' native sounds (see below)
    icon: 'Terminal Icon', // Absolute Path to Triggering Icon
    contentImage: undefined, // Absolute Path to Attached Image (Content Image)
    open: undefined, // URL to open on Click
    wait: false, // Wait for User Action against Notification or times out. Same as timeout = 5 seconds

    // New in latest version. See `example/macInput.js` for usage
    timeout: 5, // Takes precedence over wait if both are defined.
    closeLabel: undefined, // String. Label for cancel button
    actions: undefined, // String | Array<String>. Action label or list of labels in case of dropdown
    dropdownLabel: undefined, // String. Label to be used if multiple actions
    reply: false // Boolean. If notification should take input. Value passed as third argument in callback and event emitter.
  },
  function (error, response, metadata) {
    console.log(response, metadata);
  }
);

Note: The wait option is shorthand for timeout: 5. This just sets a timeout for 5 seconds. It does not make the notification sticky!

As of Version 6.0 there is a default timeout set of 10 to ensure that the application closes properly. In order to remove the timeout and have an instantly closing notification (does not support actions), set timeout to false. If you are using action it is recommended to set timeout to a high value to ensure the user has time to respond.

Exception: If reply is defined, it's recommended to set timeout to a either high value, or to nothing at all.


For macOS notifications: icon, contentImage, and all forms of reply/actions require macOS 10.9.

Sound can be one of these: Basso, Blow, Bottle, Frog, Funk, Glass, Hero, Morse, Ping, Pop, Purr, Sosumi, Submarine, Tink.

If sound is simply true, Bottle is used.


See Also:


Custom Path clarification

customPath takes a value of a relative or absolute path to the binary of your fork/custom version of terminal-notifier.

Example: ./vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier

Spotlight clarification

terminal-notifier.app resides in a mac.noindex folder to prevent Spotlight from indexing the app.

Usage: WindowsToaster

Note: There are some limitations for images in native Windows 8 notifications:

  • The image must be a PNG image
  • The image must be smaller than 1024×1024 px
  • The image must be less than 200kb
  • The image must be specified using an absolute path

These limitations are due to the Toast notification system. A good tip is to use something like path.join or path.delimiter to keep your paths cross-platform.

From mikaelbr/gulp-notify#90 (comment)

You can make it work by going to System > Notifications & Actions. The 'toast' app needs to have Banners enabled. (You can activate banners by clicking on the 'toast' app and setting the 'Show notification banners' to On)


Windows 10 Fall Creators Update (Version 1709) Note:

Snoretoast is used to get native Windows Toasts!

The default behaviour is to have the underlying toaster applicaton as appID. This works as expected, but shows SnoreToast as text in the notification.

With the Fall Creators Update, Notifications on Windows 10 will only work as expected if a valid appID is specified. Your appID must be exactly the same value that was registered during the installation of your app.

You can find the ID of your App by searching the registry for the appID you specified at installation of your app. For example: If you use the squirrel framework, your appID will be something like com.squirrel.your.app.

const WindowsToaster = require('node-notifier').WindowsToaster;

var notifier = new WindowsToaster({
  withFallback: false, // Fallback to Growl or Balloons?
  customPath: undefined // Relative/Absolute path if you want to use your fork of SnoreToast.exe
});

notifier.notify(
  {
    title: undefined, // String. Required
    message: undefined, // String. Required if remove is not defined
    icon: undefined, // String. Absolute path to Icon
    sound: false, // Bool | String (as defined by http://msdn.microsoft.com/en-us/library/windows/apps/hh761492.aspx)
    id: undefined, // Number. ID to use for closing notification.
    appID: undefined, // String. App.ID and app Name. Defaults to no value, causing SnoreToast text to be visible.
    remove: undefined, // Number. Refer to previously created notification to close.
    install: undefined // String (path, application, app id).  Creates a shortcut <path> in the start menu which point to the executable <application>, appID used for the notifications.
  },
  function (error, response) {
    console.log(response);
  }
);

Usage: Growl

const Growl = require('node-notifier').Growl;

var notifier = new Growl({
  name: 'Growl Name Used', // Defaults as 'Node'
  host: 'localhost',
  port: 23053
});

notifier.notify({
  title: 'Foo',
  message: 'Hello World',
  icon: fs.readFileSync(__dirname + '/coulson.jpg'),
  wait: false, // Wait for User Action against Notification

  // and other growl options like sticky etc.
  sticky: false,
  label: undefined,
  priority: undefined
});

See more information about using growly.

Usage: WindowsBalloon

For earlier versions of Windows, taskbar balloons are used (unless fallback is activated and Growl is running). The balloons notifier uses a great project called notifu.

const WindowsBalloon = require('node-notifier').WindowsBalloon;

var notifier = new WindowsBalloon({
  withFallback: false, // Try Windows Toast and Growl first?
  customPath: undefined // Relative/Absolute path if you want to use your fork of notifu
});

notifier.notify(
  {
    title: undefined,
    message: undefined,
    sound: false, // true | false.
    time: 5000, // How long to show balloon in ms
    wait: false, // Wait for User Action against Notification
    type: 'info' // The notification type : info | warn | error
  },
  function (error, response) {
    console.log(response);
  }
);

See full usage on the project homepage: notifu.

Usage: NotifySend

Note: notify-send doesn't support the wait flag.

const NotifySend = require('node-notifier').NotifySend;

var notifier = new NotifySend();

notifier.notify({
  title: 'Foo',
  message: 'Hello World',
  icon: __dirname + '/coulson.jpg',

  wait: false, // Defaults no expire time set. If true expire time of 5 seconds is used
  timeout: 10, // Alias for expire-time, time etc. Time before notify-send expires. Defaults to 10 seconds.

  // .. and other notify-send flags:
  'app-name': 'node-notifier',
  urgency: undefined,
  category: undefined,
  hint: undefined
});

See flags and options on the man page notify-send(1)

Thanks to OSS

node-notifier is made possible through Open Source Software. A very special thanks to all the modules node-notifier uses.

NPM downloads

Common Issues

How to use SnoreToast with both appID and actions

See this issue by Araxeus.

Windows: SnoreToast text

See note on "Windows 10 Fall Creators Update" in Windows section. Short answer: update your appID.

Windows and WSL2

If you don't see notifications within WSL2, you might have to change permission of exe vendor files (snoreToast). See issue for more info

Use inside tmux session

When using node-notifier within a tmux session, it can cause a hang in the system. This can be solved by following the steps described in this comment

There’s even more info here #61 (comment).

macOS: Custom icon without Terminal icon

Even if you define an icon in the configuration object for node-notifier, you will see a small Terminal icon in the notification (see the example at the top of this document).

This is the way notifications on macOS work. They always show the icon of the parent application initiating the notification. For node-notifier, terminal-notifier is the initiator, and it has the Terminal icon defined as its icon.

To define your custom icon, you need to fork terminal-notifier and build your custom version with your icon.

See Issue #71 for more info #71.

Within Electron Packaging

If packaging your Electron app as an asar, you will find node-notifier will fail to load.

Due to the way asar works, you cannot execute a binary from within an asar. As a simple solution, when packaging the app into an asar please make sure you --unpack the vendor/ folder of node-notifier, so the module still has access to the notification binaries.

You can do so with the following command:

asar pack . app.asar --unpack "./node_modules/node-notifier/vendor/**"

Or if you use electron-builder without using asar directly, append build object to your package.json as below:

...
build: {
  asarUnpack: [
    './node_modules/node-notifier/**/*',
  ]
},
...

Using with pkg

For issues using with the pkg module. Check this issue out: #220 (comment)

Using Webpack

When using node-notifier inside of webpack, you must add the snippet below to your webpack.config.js.

This is necessary because node-notifier loads the notifiers from a binary, so it needs a relative file path. When webpack compiles the modules, it suppresses file directories, causing node-notifier to error on certain platforms.

To fix this, you can configure webpack to keep the relative file directories. Do so by append the following code to your webpack.config.js:

node: {
  __filename: true,
  __dirname: true
}

License

This package is licensed using the MIT License.

SnoreToast and Notifu have licenses in their vendored versions which do not match the MIT license, LGPL-3 and BSD 3-Clause to be specific. We are not lawyers, but have made our best efforts to conform to the terms in those licenses while releasing this package using the license we chose.

node-notifier's People

Contributors

a7ul avatar altjake avatar amilajack avatar californian avatar danii avatar denis-sokolov avatar dependabot[bot] avatar electronicwar avatar jasongore avatar jnielson94 avatar kolgotko avatar kurisubrooks avatar kyriesent avatar madlittlemods avatar mikaelbr avatar multiplybyzer01 avatar ngotchac avatar nrwiersma avatar okuryu avatar oresoftware avatar pepkin88 avatar prayagverma avatar rlaace423 avatar rmobis avatar shadiakiki1986 avatar sonicdoe avatar stevemao avatar styfle avatar vkbansal avatar yoavain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-notifier's Issues

Error on displaying notification on Linux

This library is a great idea and works perfectly on the Mac but when I try it on my Linux installation it falls over with this:

/workspace/temp/node_modules/node-notifier/lib/utils.js:45
    cb(stderr, stdout);
    ^
TypeError: undefined is not a function
    at /workspace/temp/node_modules/node-notifier/lib/utils.js:45:5
    at ChildProcess.exithandler (child_process.js:646:7)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

Here's my very simple test harness that threw the above error:

var nn = require('node-notifier');
nn.notify({ title: "hello", message: "there" });

Any ideas? Am happy to try out a few things here if you don't have easy access to a Linux install.

The notification daemon I'm using is dunst over libnotify. (notify-osd is just another daemon that runs over libnotify from my understanding.)

hangs within tmux session

node-notifier doesn't seem to work within a tmux session, while it works just fine outside of tmux.

node-notifier simply never responds, have to kill the process.

Works outside tmux

840784fd6d57cc9247f247e757d76f01

Locked up inside tmux

77791d904a94089b55043dead7c4f676

Any clues as to why?

  • OSX Yosemite 10.10.4 (14E46)
  • iojs 2.3.1
  • tmux 2.0

Possibly related #47

Closing notifications

It would be nice if the API supported a way of triggering the closing/hiding of a notification.

I'd be using just the Windows 8 ones and being able to close them all when one is clicked would be nice. With other libraries, I keep track of the open notifications, loop over them and close them one by one.

Windows 10 shows console window

In windows 10 toaster.exe shortly shows a window when executed. Can this in some way be disabled? Or make the window hidden?

click on notify

I have ubuntu x64 14.04
use
wait: true
subscribe on 'click'

but can't click because window becomes translucent

Update terminal-notifier.app

Hi,

Thanks for this very useful module !

I noticed that the "sender" option doesn't work on OSX. I made few test and I think this is only due to the terminal-notifier.app not up to date.

how to get message from server?

I spent almost one day. please help me.

I have ubuntu server (192.168.0.104)
I use win 7 laptop (192.168.0.100), and install growl for window.

test code on laptop. growl display message.

var Growl = require('node-notifier').Growl;

var notifier = new Growl({
  host: 'localhost', // '192.168.0.100',
  port: 23053
});

notifier.notify({
  title: 'Foo',
  message: 'Hello World'
}, function(error, response) {
  console.log(error);
  console.log(response);
});

but this code does not work in ubuntu.

[Error: Couldn't connect to growl (might be used as a fallback). Make sure it is running]

How do I get message form ubuntu?

var Growl = require('node-notifier').Growl;

var notifier = new Growl({
  host: '192.168.0.100',
  port: 23053
});

notifier.notify({
  title: 'Foo',
  message: 'Hello World'
}, function(error, response) {
  console.log(error);
  console.log(response);
});

Windows 8+: on click callback

This is massively important and missing. Is it possible this feature could be added?

Use case: I need to bring my app to the front, display content relative to the notification, etc.

Permission Error

I am using node-notifier to display notifications on OSX. Running in development, the notifications work beautifully. When I package the application and deploy it however, the app receives the following error in the notify callback every time it tries to display a notification.

killed=false, code=126, signal=null

Has anyone else ran into this issue? Or is there a simple solution that I'm missing?

Why do I see the default terminal icon when I'm setting my own? (OS X)

This happens on OS X (didn't test other platforms) when I'm not have the icon option:
screen shot 2015-10-07 at 11 31 41

and when I have it:
screen shot 2015-10-07 at 11 32 05

Am I missing something? How could I get rid of the terminal icon next to the title?

  notifier.notify({
    title: 'Title',
    message: 'Hello, world!',
    icon: 'path/to/image.png,
  }, function(error, response) {
    console.log('error', response);
  });

node-notifier within node-webkit

Hi I am trying to use node-notifier within node-webkit and it doesn't work.
When I test the app with nodewebkit module it works perfecty, therefore when I pack my app it doesn't work anymore and I get this from my WebKit Console:
Command failed: /bin/sh: /Users/jacopodaeli/Desktop/PublipingTrainer.app/Contents/Resources/app.nw/node_modules/node-notifier/vendor/terminal-notifier.app/Contents/MacOS/terminal-notifier: Permission denied

My App is based on Node-WebKit 0.8.6 and it runs over Mac OS X 10.9.

Anyone can help me with this problem?

contentImage not working on Mac OS X

I cloned the repo and ran the advanceMac.js file in the example directory and while the notification is showing up, it's displaying the terminal icon as opposed to the coulson.jpg. I'm on Mac OS 10.8.5, and using Node version 0.10.11.

If I use the sender flag and specify for example 'com.apple.Safari' it shows the Safari logo, but I can't seem to get a custom image to show up.

Thanks for a great library!

Windows 7 balloon systray oddities

Hi there, me again!

Couple of questions about Windows 7 behaviour

  1. I've noticed when a notification appears in the system tray, there's a little chat-shaped icon that appears in the systray. My app already has a systray icon and indeed the balloon rightfully points to my app's icon. Is there a way to disable to chat icon thing?
  2. Clicking on the balloon only appears to dismiss it rather than perform the function in my click event handler, is this correct?

Thanks
Mike

How to remove notification?

Sometimes I want to remove user's notification programatically because of some user's action. Is this possible? If that's os specific, I'm mostly interested in linux for now.

Windows 8+: allow ignoring os.release check if specified

When using browserify to require node-notifier and utils.isWin8 calls os.release(), it returns 5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.157 Safari/537.36 for me.

Would you be open to adding the option to never fallback to balloons/growler? So instead of:

if (!utils.isWin8()) {
    fallback = new Balloon(this.options);
    return fallback.notify(options, callback);
}

It would be something like:

if (!options.noFallback && !utils.isWin8()) {
    fallback = new Balloon(this.options);
    return fallback.notify(options, callback);
}

how to show 2 or more notifications

I'm trying to display 2 or more notifications, but this code displays only one after replacing the previous one.

var notifier = require('node-notifier');
var notifier2 = require('node-notifier');

notifier.notify({
  'title': 'My notification',
  'message': 'Hello, there!',
  'wait': true
});

notifier2.notify({
  'title': 'hola!!!',
  'message': 'Hello, there!',
  'wait': true
});

image

Mac Notification Center w/ wait and group

We are running node-notifier 4.2.3 on Yosemite 10.10.4 and not having any luck with the group or wait parameters, everything else works as expected. Here is the configuration object being passed into notifier.notify().

{
  title: 'JSCS Validation Error',
  message: 'Check console for error details',
  icon: 'node_modules/wee-core/build/img/error.png',
  group: 2,
  sound: true,
  wait: true
}

This immediately replaces a notification with group 1 and auto-hides after a couple seconds instead of waiting for interaction. Is there a known issue or does anything seem off? Thanks.

Notifier icon and name

Hi there,

Couple of questions more than anything else as I couldn't find it in the documentation, unless I've missed it somewhere...

As per your example image on the Mac:
!Example

  1. Why does the terminal icon persist even if you specify appIcon and, more importantly, how can you get rid of it?
  2. In notification center, it still shows up with the terminal icon as well as being titled as "terminal-notifier". How can this be changed?

Thanks
Mike

Command line

Any thoughts about a command line command ? That would replace having to use notify-send in linux vs terminal-notifier on mac vs ...

Syntax sugar for notifier.notify

Instead of:
notifier.notify({message: 'Hi'})
I think we should be able to use:
notifier.notify('Hi').
The title should be the default - 'Node Notification' or whatever it is on each system.

It's cleaner and gets the point across better. Just my thoughts.

Windows 8+: icon doesn't work

No matter what I try.

I'm using this in node-webkit. It should be as easy as passing images/a.png. Running window.location = 'images/a.png' in the node-webkit console (same as Chrome's console) shows the image fine so it does exist there.

The JavaScript file calling node-notifier is one level deep in a js directory (which shouldn't matter?) but passing ../images/a.png to node-notifier doesn't work either.

Related: #20. Also, @vkbansal you might be able to help?

Notifications don't spawn under certain macOS environments

Well, it doesn't seem to work. I'd like to use your notification plugin for my nodeJS tool for OS X. There seem to be no errors or any indications that something went wrong, the notifications just do not show up. When I launch the terminal-notifier.app in the vendor folder it caughs up a nice notification. So that isn't the problem.
I've tried the following things:

var notifier = require('node-notifier');

notifier.notify({
        title: 'Now playing',
        subtitle: track.name,
        message: track.artist
    });

And I've tried this:

var notifier = require('node-notifier');

notifier.notify({
        title: 'Now playing',
        message: track.name + ' - ' + track.artist
    });

And this, even though I don't want the notifications to show up in the notification center:

var nn = require('node-notifier');
var notifier = new nn.NotificationCenter();

notifier.notify({
        title: 'Now playing',
        subtitle: track.name,
        message: track.artist
    });

I've installed it from the npm and are trying to use it in combination with NW.js or previously known as node-webkit.

node-notifier onclick event not accessible in gulp-notify

Hey there,

i wanted to use the onclick event mentioned in the node-notifier module to get a callback when a notification is clicked.

node-notifier api says:
notifier.on('click', function (notifierObject, options) {
// Happens if wait: true and user clicks notification
});

i went through the gulp-notify source code and couldn't find a way to get a callback for the click event on a notification.
I am also not able to get a reference to the reporter.
Is there anything i am missing or is it just not possible?

Edit:
What i forgot to mention is, that i know about the open, activate and execute properties, but what i want to do is, depending on what happened, open the source file at a specific line/column, e.g. subl /path/to/file.ts:9:10

Mac store

From alloy/terminal-notifier:

If you intend to package terminal-notifier with your app to distribute it on the MAS, please use 1.5.2 since 1.6.0+ uses a private method override which is not allowed in the AppStore guidelines.

Is [email protected] compatible with [email protected]? You said previously that the terminal-notifier API had changed, is that before/after 1.5.2?

Suggestion: Fail quietly if no notifiers are installed

Getting "ECONNREFUSED" errors on my Windows 8.1 machine when growl for windows is not installed.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: connect ECONNREFUSED
    at errnoException (net.js:904:11)
    at Object.afterConnect [as oncomplete] (net.js:895:19)

It'd be nice to preserve gulp-notify's console output functionality while making external notification programs optional. (E.g. I'm a fan of the notification systems available on OS X, but am not a fan of Growl for Windows.)

So far I've hacked around it by adding:

.on('error', function(e){
  console.log("No notification center found");
})

How can I send custom options, so I could read them on click?

So lets say I want to have a custom_id (or some data object) with a particular notification that later I would like to retrieve it when the user is going to click on it. Is it possible somehow?

var data  = {
  'foo': 'bar',
  'hello: 'world
}

notifier.notify({
  title: 'My awesome title',
  message: 'Hello from node, Mr. User!',
  custom_id: 1234567, // Some custom ID
  data: data, //Some more data
}, function (err, response) {
  // response is response from notification
});

notifier.on('click', function (notifierObject, options) {
  console.log('Custom ID', options.custom_id);
});

Be more lenient on assigning notifiers

Right now the module is restricted on choosing notifier based on the OS. I think it would be nice to be able to choose a notifier or make it "extendable" to be able to add your own notifier (eg. snarl, some command line tool). Just a thought!

Notification icon has black border

On OS X (10.9.4) I'm seeing a black border around any appIcon or contentImage I pass into the notification. Additionally, the original Terminal icon still shows up (smaller) next to the title. Is there any way to only show my app's icon, without a border?

Feature request: Custom sounds

It would be great to specify the path to a custom sound. Would this be possible or are there certain platform limitations?

Extremely weird behavior

I'd like to inform about extremely strange behavior of "sass-notify":

  1. Some mistakes play exactly as expected and written in RED. (For example: missed semicolon after "text-indent: 100%;" )
  2. Some mistakes went completely unnoticed. (For example: missed semicolon after "overflow: hidden; " )
  3. Some mistakes play without notification and written in WHITE. (For example unbound variable)
    sass error

I run Win7 and had installed Growl, as recommended.
The behavior pattern is exactly the same, in this case, but notifications come from Growl...

Process terminates dispite wait: true on ubuntu14/xfce4-notifyd

Here is code I run:

import notifier from 'node-notifier';
notifier.notify({
  title: 'Test',
  message: 'Test mess',
  wait: true
}, (err, response) => {
  console.log(err);
  console.log(response);
});

notifier.on('click', (obj, options) => {
   console.log(options);
});

notifier.on('timeout', (obj, options) => {
   console.log(options);
});

The problem is that the node process terminates immediately while notification is displayed on the screen, so I can't trigger click event.

I don't know if it's a node-notifier problem itself but I tried out a lot of solutions (even growl-for-linux and it still doesn't work.)

Just a typo

in the code example on the main page:

var notifier = require('node-notifier');
notifier.notify({
'title': 'My notification', <--------------------------- comma here
'message': 'Hello, there!'
});

Missing path module

In the "Cross-Platform Advanced Usage" section snippet, the var path = require('path'); is missing. There's no Contributing.md document, so I thouhgt I'd contact you here.

Notifu non found on system (Windows 7)

Hello! I updated lately to version 4.x and I got this error in console, while it was working good on 3.x:

Notifier (D:\projects\app\node_modules\node-notifier\vendor\notifu\notifu) not found on system.

I was using the cross-platform version so I tried to switch to WindowsToaster and WindowsBalloon (with and without the options withFallback set to true), but no luck :(

Strange thing is that if I search for the file in the specified path it's right there...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.