Can't use both - 'appID' and 'actions' parameters at the same time
Hi guys! I was trying to make notifications with buttons on windows 10 (v1909) using this code:
notifier.notify( { title: 'title', message: 'message', icon: paths.appIconPath, actions: ['Close', 'Settings'], });
It worked, but I noticed that there is always a 'SnoreToast' message at the bottom of the notification. After some googling, I found that to hide this message I need to also provide an 'appID' parameter to the notify function. But when I provide it, the buttons disseaper. This code should possibly work, but it doesnt't:
notifier.notify( { title: 'title', message: 'message', icon: paths.appIconPath, actions: ['Close', 'Settings'], appID: 'SomeAppId' });
Am I missing something?
@Denchijik I'm also having this issue.
same here
@mikaelbr Is there any workaround for both the options to work?
I no longer have easy access to Windows. Any help with debugging, implementation, and QA would be greatly appreciated. The source code is very straight (painfully so), so running it locally and debugging the issue should hopefully be very doable if you have this issue.
I performed a little bit of initial investigation into this issue and it appears that data is not being returned over the pipe. None of the pipe's events actually fire when an appID is specified and a button is clicked. SnoreToast does however know the a button has been clicked and the exit code is correct.
@mikaelbr facing the same issue. is there any workaround?
I tried running SnoreToast by itself (not through node-notifier) and it seems like using either textbox or buttons in conjunction with appID will cause the textbox or buttons to be missing. So it could be SnoreToast's issue, not node-notifier. :(
SnoreToast requires you to register an application to make this work. Here is a function you can try to use to register programs in Node.js, though it doesn't always work -- it will give you a command to use, though, that should. The process is described below.
cd node_modules\node-notifier\vendor\snoreToast
snoretoast-x86.exe -install "SnoreToast/<Program Name>.lnk" "" "AppName.UNIQUE_ID"
<Program Name> is the name you want to display in the notification instead of SnoreToast. Be sure to leave .lnk on the end.
The middle argument is for a program executable, but it can be left blank.
The last argument is the application id you will use later. The format is simply AppName.UNIQUE_ID.
This will create a program in your Start Menu -> SnoreToast folder, which will then allow you to use actions.
Remember to set the appID in the notifier to app id you used above instead of using the name of the app (example: { appID: "SomeApp.ID_HERE" })
For anyone facing the same issue: see https://github.com/mikaelbr/node-notifier/issues/332#issuecomment-835363411
When will this be fixed? Still seeing it in 10.0.1
There's an open PR with a fix (it's been more than a year since it was opened so I'm not hopeful that it will ever get merged) https://github.com/KDE/snoretoast/pull/15
We have fixed this issue in our app (youtube-music desktop) by applying a custom patch on top of the snoretoast binaries in node_modules
if you need some inspiration https://github.com/th-ch/youtube-music/pull/600
(or if you want you could use the pre-compiled fixed binaries from https://github.com/viviedu/node-notifier/commit/4d7e6ae3b8430f544245a7c366295193b264ba33)
There's actually a pretty easy way to fix this, we just didn't implement SnoreToast well enough:
Here's a guide: https://github.com/mikaelbr/node-notifier/issues/424