-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-line notifications on windows 10 show \n instead of a line break #123
Comments
I had the exact same issue right now
|
Same issue here |
Is this also an issue using this branch? #134 |
The problem is here: Avoiding this string replace will enable line breaks on Windows 10 with toast.exe. |
This should hopefully be fixed in the latest version in the master branch. Would love it if you could test it out:
|
It seems to use SnoreToast.exe instead of toast.exe and basically it works now 👍 Unfortunately I am using this through gulp-notify and when it is about to toast an error this happens:
In that case it will also send "open" and "subtitle" options which SnoreToast cannot process and fails. I tried a quick hack in toaster.js which fixed it: delete options.open;
delete options.subtitle; Hope it helps. Edit: The default sound behavior has also changed. In the previous version, only the "error" toast produced this default sound while the "success" toasts were quiet. Edit2: Wait, it did not work. I forgot that I temporary removed the |
Thanks! It seems SnoreToast doesn't allow surplus arguments, so need to filter out things and not let notifier be transient with options as with notification center on Mac. Thanks for the code & comments! I've got access to windows versions at work now, so I can test and fix it within the day. |
@ew72ew How is the master branch now? I've added several tests, implemented better support for all-things snoretoasts. |
The linebreaks work now. Definitely! Now there is only the problem with the default sound left. Since it is gulp-notify related, I am not sure if it should be fixed here or there. gulp-notify sets this defaults: var defaults = {
error: {
icon: path.join(__dirname, '..', 'assets', 'gulp-error.png'),
sound: 'Frog'
},
regular: {
icon: path.join(__dirname, '..', 'assets', 'gulp.png')
}
}; Error messageSo if an error happens it will execute the following command:
However SnoreToast.exe fails if "Frog" is supplied as the sound. It still displays the toast, plays the default Windows sound but it ignores the custom image, always has the title "SnoreToast" and no message. To make it work, one of these must be used instead: # If no sound is supplied, it will always use the default Windows sound
xyz\SnoreToast.exe -p xyz\gulp-error.png -m Error message -t Title
# Alternatively a valid sound must be used
xyz\SnoreToast.exe -p xyz\gulp-error.png -m Error message -t Title -s Notification.Default A quick hack could be: if (options.sound) {
options.s = options.sound;
delete options.sound;
// "Frog" is set by gulp-notify for errors but is not a valid Windows sound
if (options.s === 'Frog') {
options.s = 'Notification.Default';
}
} Success messageThe success message on the other hand uses the following command:
And this also generates the default Windows sound. It should be really using this command:
This is how toast.exe worked. Success messages were silent, so we need the Possible solution
Hope it helps and thank you for working on it! |
Thanks for the detailed feedback. The problem is managing sound in a cross platform manner, where if you use |
It should work better now with sound. Still not cross platform in the sense that it is the same sound, but at least it won't crash. |
Closing this as fix is verified. Will be released in v5 soon. |
Multi-line notifications on windows 10 show "\n" instead of a line break.
Show notification with message
line1\nline2
Expected result:
Actual result:
line1\nline2
v4.6.0
Previous version 4.5 showed multi-line notifications on some windows 10 computers, and showed "\n" on others.
The text was updated successfully, but these errors were encountered: