Skip to content
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

snoretoast with custom appid: result ist not passed to callback (electron) #332

Open
NaridaL opened this issue May 23, 2020 · 17 comments · May be fixed by #375
Open

snoretoast with custom appid: result ist not passed to callback (electron) #332

NaridaL opened this issue May 23, 2020 · 17 comments · May be fixed by #375

Comments

@NaridaL
Copy link

NaridaL commented May 23, 2020

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

image

image

@joydeep33
Copy link

@NaridaL I am also facing the same issue

@mikaelbr
Copy link
Owner

I no longer have easy access to Windows. Any help with debugging, implementation, and QA would be greatly appreciated.

@KaiSheng714
Copy link

KaiSheng714 commented Nov 17, 2020

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 :

stream.on('data', (c) => {

But i don't know why.

Hope it helps.

@tomboolean
Copy link

Facing the same issue.

@tomboolean
Copy link

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

@Araxeus
Copy link
Contributor

Araxeus commented Apr 8, 2021

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

@NunoCuradoFuze
Copy link

Use the shell.writeShortcutLink to create or update your application shortcut with the required properties, which are the correct appID and the toastActivatorCLsid.

@Araxeus
Copy link
Contributor

Araxeus commented May 6, 2021

@NunoCuradoFuze
how do you find and set toastActivatorClsid?
could you give some more details please?

@tomboolean
Copy link

tomboolean commented May 6, 2021 via email

@NunoCuradoFuze
Copy link

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'); }

@Araxeus
Copy link
Contributor

Araxeus commented May 6, 2021

@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

@Araxeus
Copy link
Contributor

Araxeus commented May 8, 2021

For @tomboolean and anyone else facing the same issue:

check out #347 (comment)

@DuBistKomisch has completely fixed the problem in his branch ! 😁

@tomboolean
Copy link

@Araxeus amazing! I will have to go thank him!

@NunoCuradoFuze
Copy link

NunoCuradoFuze commented May 13, 2021

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.

@abdulghanitech
Copy link

any update guys?

@Araxeus
Copy link
Contributor

Araxeus commented Oct 27, 2021

sadly still waiting for KDE/snoretoast#15 to get merged and published..
Maybe ask that question there

@Araxeus
Copy link
Contributor

Araxeus commented Jan 7, 2023

There's actually a pretty easy way to fix this, we just didn't implement SnoreToast well enough:

Here's a guide: #424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants