Open artisharma24 opened 2 months ago
Unfortunately, this is a known issue with node-nodifier.
I'm actually in the middle of resolving a few of these issues. I need node-notifier and SnoreToast for my application, and since they haven't been touched in awhile by the developers; I forked my own version.
Thus far I've fixed the issue with notifications not staying on-screen, and I've got about 20 other bugs I'm working through.
If I find a quick solution once I finish it, I'll post it here.
An update, this issue is with SnoreToast, not with node-notifier. The code in this library is just passing the actions
and appID
on to snoretoast.
I'm going through the code to fix it in mine.
Edit 2:
I reviewed the code, and I need to see exactly why these steps are needed, but without editing the code, I found the solution.
In the SnoreToast readme, they mention that you must run the following command:
X:\YourNodeProject\node_modules\node-notifier\vendor\snoreToast\snoretoast-x64.exe -install "YourProject\YourProject.lnk" "X:\Path\To\Your.exe" "com.yourapp.id"
Basically what you need to do with the above command is:
snoretoast.exe
, which is in the node_modules
folder of whatever project you're working on.YourProject\YourProject.lnk
, it's creating a shortcut link, you can name it whatever your program is
MyAppName\MyAppName.lnk
X:\Path\To\Your.exe
with the path to your exe.com.yourapp.id
, you can name it whatever you want, such as my-proggy
Then back in your notifier code, you'll want to use:
notifier.notify({
title: messageJson.Title,
message: messageJson.Message,
icon: iconPath,
contentImage: contentImage,
wait: true,
actions: buttons,
appID:"my-proggy" <-----------
});
Here is my code .
const notifier = require('node-notifier'); const path = require('path'); const { shell, ipcMain } = require('electron'); const socket = require('socket.io-client')('http://192.168.50.25:5050/'); const { insertRecordsIntoNotification, createNotificationTable } = require('../repos/notificationRepo.js');
async function showNotification(message, isResponse) { try { console.log("showNotification triggered");
}
module.exports = { showNotification };