Toast messages on Windows 8.1 not working
Closed this issue · 12 comments
Hi there!
I've enabled notifications in the Windows settings, but messages just don't show up. Unfortunately I've no idea why and hope someone can help me.
In the notification settings it's possible to enable/disable notifications for applications separately. There's no option for node or gulp or npm etc. to enable/disable notifications. Could that be the reason? I was searching for a way to test toast notifications with another app/software, but I was not finding anything useful.
There's also no error so displaying/showing the toast notifications just fails silently (or they just don't show up for any reason).
Any idea how I can test if toast notifications work at all?
For the Windows 8 implementation, gulp-notify uses toaster. This is probably what you should look for when enable/disable the notifications. Also, there is a "rule" with Windows that you need to have a shortcut to the app in your start screen. This should happen automatically, though.
Are there any specific steps that are necessary to get this set up and working on 8.1? From the documentation, it seems it should work out of the box. I get this error and no toast when using gulp-notify on Windows 8.1: [14:57:16] gulp-notify: [Error in notifier] Error in plugin 'gulp-notify' spawn OK
I even don't get the error, it just fails silently. :l
Ah, I got it running. Problem was that I didn't realize it only works when passed to a pipe function - I wanted to use notify()
directly in a custom function, not wrapped within a pipe function.
Is there a way to use gulp-notify
directly, without using pipe? My use case is the following, and using src('.')
is kind of a hack I want to avoid:
gulp.task('scripts', ['scripts:common', 'scripts:vendor'], function() {
gulp.src('.').pipe(notify('done'));
});
gulp.task('scripts:common', function() {
// ...
});
gulp.task('scripts:vendor', function() {
// ...
});
You should look into running node-notifier directly, as node-notifier is what gulp-notify uses internally. Here is an example of a person doing the switch: johnpapa/generator-hottowel@6dcedd3
I'm closing this as it looks like it works now, @thasmo ? Just let me know if this isn't correct.
I use a wrapper function
function n(message){
return gulp.src('.').pipe(notify(message));
}
then just write n('message test');
I'd say that's doing a lot of unnecessary work. Running node-notifier
directly is the encouraged solution for this.
It's true but as I see the node-notifier
requires two parameters (title
and message
).
So it depends on what and how you use it for.
gulp-notify
is "higer level" than node-notifier
and chooses a default title. You could do something like this:
var notify = require('node-notifier');
var manualNotify(message) {
return notify({
title: 'My notification',
message: message
});
}
You wouldn't have the default icon and such, but you could also create your own set of defaults as it's done here: johnpapa/generator-hottowel@6dcedd3#diff-2e6ad34bed54ee43674888cab984c475R433
Setting defaults does make more sence.
Thanks!