node-notifier
node-notifier copied to clipboard
snoretoast with custom appid: result ist not passed to callback (electron)
I don't know if this is specific to electron...
In any case, here's a minimal repro:
https://github.com/NaridaL/electron-node-notifier-bug
@NaridaL I am also facing the same issue
I no longer have easy access to Windows. Any help with debugging, implementation, and QA would be greatly appreciated.
I am facing the same issue, too.
I found if you assigned an 'appId' property on options, like this
notifier.notify(
{
...
appID: 'com.some.id'
....
},
When you clicking on notification popup, you won't received any response from net.createServer
: https://github.com/mikaelbr/node-notifier/blob/2d3927b200a0fd1721e8b8ad59f84f383d3f0e0a/lib/utils.js#L559
But i don't know why.
Hope it helps.
Facing the same issue.
Noticed this from https://github.com/KDE/snoretoast :
If you want to brand your notifications you need to create the application startmenu entry with snoretoast.exe --install "MyApp\MyApp.lnk" "C:\myApp.exe" "My.APP_ID". This appID then needs to be passed to snoretoast.exe with the `--appID`` parameter.
We may need to use this method to set the appid versus just the setappmodelid method
This actually completely break the interactive notification functionality of this library, which is the only reason to use it over native electron notifications..
Either we show notifications with SnoreToast image+text or we can't respond to any button click
Use the shell.writeShortcutLink to create or update your application shortcut with the required properties, which are the correct appID and the toastActivatorCLsid.
@NunoCuradoFuze how do you find and set toastActivatorClsid? could you give some more details please?
Yes this is my question too!
On Thu, May 6, 2021 at 8:13 AM Araxeus @.***> wrote:
@NunoCuradoFuze https://github.com/NunoCuradoFuze how do you find and set toastActivatorClsid? could you give some more details please?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mikaelbr/node-notifier/issues/332#issuecomment-833603070, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABU6Y2PA4B2EPEDQ6HCZTVLTMKWZPANCNFSM4NIRYARQ .
--
Ana Tomboulian
*CTO | *peerlogic
480 | 561.1554
@.*** | https://www.linkedin.com/in/anatomboulian/
Look for Shell API electron. Also for more information about Class ID and ToastActivator you should check microsoft documentation.
Example on how to use the writeShortcutLink to update your current shortcut:
let shortcut = path.join(process.env.APPDATA, 'Microsoft', 'Windows', 'Start Menu', 'Programs', '#appName.lnk'); let res = shell.writeShortcutLink(shortcut, 'update', { target: process.execPath, appUserModelId: "#appIDD", toastActivatorClsid: "#Use a valid CLSID" }); if (res) { console.log('Shortcut created successfully', 'success'); } else { console.log('Failed to create the shortcut', 'danger'); }
@NunoCuradoFuze thanks for that, but how do I specify to node-notifier whats the registered CLSID? how would node-notifier / snoreToast know which clsid to look for?
could you maybe share how you did it? I can't find any documentation about using it with electron :(
without CLSID it all seems to work well - except the response from actions on notifications is always
undefined
For @tomboolean and anyone else facing the same issue:
check out https://github.com/mikaelbr/node-notifier/pull/347#issuecomment-834960709
@DuBistKomisch has completely fixed the problem in his branch ! 😁
@Araxeus amazing! I will have to go thank him!
I believe SnoreToast internally register the callback with the toast activator clsid "eb1fdd5b-8f70-4b5a-b230-998a2dc19303"
.
So if you have created your own shortcut, all you have to do is to update shortcut properties with this CLSID and appID, using electron shell api.
If I understand correctly, #347 points to a scenario where you used SnoreToast to install the shortcut. When using the notifier without appID, it would prompt the notification with the SnoreToast text and image. With appID the action buttons wouldn't work if I am correct.
@NunoCuradoFuze
I believe SnoreToast internally register the callback with the toast activator clsid "eb1fdd5b-8f70-4b5a-b230-998a2dc19303". So if you have created your own shortcut, all you have to do is to update shortcut properties with this CLSID and appID, using electron shell api
I still don't think it possible that you use both your appID and have working buttons currently, snoretoast seems to just ignore buttons if you have a custom appID, without writing to any pipe.
The fix mentioned works without having the need to specify a CLSID or install shortcut from snoretoat (can specify appID, and your app text and image will show up and actions buttons will work)
this works with shortcuts installed from shell.writeShortcutLink
or other methods (Electron-Builder shortcuts)
You just need to have the right appID in the shortcut and you can forget about clsid
any update guys?
sadly still waiting for https://github.com/KDE/snoretoast/pull/15 to get merged and published.. Maybe ask that question there
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