-
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
timeout option doesn't work #401
Comments
^ has anyone figured this out yet? Having the same issue with WindowsToaster running on Windows 10. No matter what values I place for 'wait' or 'timeout' nothing is working. Notifications are not waiting for user interaction / ALWAYS time out within 5 seconds. Notifications still appear in the notification/action center, but callback functions do not work (notification clicked/dismissed or buttons clicked on notification in action center do not send any response back). MacOS Notifications via NotificationCenter are working as expected with proper wait/timeout values, just Windows notifications are not working. |
Same issue here... any updates or alternatives to have a notification that has no timeout? Thx! |
Also getting the same. I've tried |
Information about Windows 10 / 11 notifications + Snoretoast + Timeout / WaitIf you are referring to Windows / SnoreToast: tl;dr: If you're trying to make Windows 10 / 11 notifications stick / wait, or change the time, you can't. Not unless you do what I posted below. And only then, you have two options, 7s short or 25s long. Edit: I found a way to make notifications stick, read at the bottom. It requires you to edit SnoreToast and re-build the exe. SnoreToast as it is; cannot do infinite notifications. I decided to go investigate this, and it's a two prong issue
In the latest version of SnoreToast (this library doesn't use), a new argument was added:
This option doesn't take an integer / number, it takes one of two values, To actually get this to work in Windows:
if (options.time) {
options.d = options.time;
delete options.time;
}
Add after:
Warning Do not change In your notification code, add:
You should now get a notification on Windows to stay up for 25 seconds. Unfortunately for Windows toast, there is no "infinite" notification duration. It's either 7 or 25 seconds. I haven't looked at the SnoreToast source code to see if that's a limitation of Toast, or if it's a Windows limitation. But 25 seconds is better than 7. I've messed with Windows notifications before, and I know there's a way to make notifications stick; so the only thing I can determine is that SnoreToast decided to limit how long a notification stays on screen to prevent abuse maybe, or a limitation of the Windows API. A quick glance at the SnoreToast code shows enum class Duration {
Short, // default 7s
Long // 25s
}; I'll have to look at it in more detail to determine the limitation. From what I understand in the code, the only program that allowed for setting the time comes from
Which is the balloon notification system from https://www.paralint.com/projects/notifu/, and that is for Windows XP / 8. Not 10 / 11. Edit: The 7s or 25s appears to be a limitation of Windows Toast Notifications, not node-notifier or SnoreToast
However, other apps have gotten around this by setting the notification as an "alarn". Edit 2: After reading through the SnoreToast source code, I was able to successfully get notifications to stick by switching the notification type to To give you an idea, SnoreToast creates a toast by building XML within the SnoreToast app itself. When you create a new notification in SnoreToast, it generates XML code like the following, which SnoreToast will use to create your notification: <toast duration="long">
<visual>
<binding template="ToastGeneric">
<text>Hello World</text>
<text>This is a simple toast message</text>
</binding>
</visual>
</toast> As you can see on the first line, there's In order to get notifications to stick, we must change the type of notification <toast scenario="incomingCall">
<visual>
<binding template="ToastGeneric">
<text>Hello World</text>
<text>This is a simple toast message</text>
</binding>
</visual>
</toast> In the above line, we replace duration with If we want to modify the SnoreToast source code to implement this feature, open download the SnoreToast source code from their Github repo, open it in Visual Studio, open the file Find the line ST_RETURN_ON_ERROR(addAttribute(L"launch", rootAttributes.Get(), data)); Add after: ST_RETURN_ON_ERROR(addAttribute(L"scenario", rootAttributes.Get(), L"incomingCall")); You will now have ALL notifications stick until they are dismissed. Go back into Visual Studio, at the top click Build -> Build All A new SnoreToast.exe file will be generated and placed in
Then run a test notification
You should get a test notification in the bottom right of Windows that appears forever. I have yet to implement a new flag so that I can call "forever" at will. I've been reading the Windows notification API for a few minutes, and I'm noticing that SnoreToast is missing a lot of features that are now available for notifications. Maybe I'll build my own version. Who knows. Edit: I decided to add my own new parameter
Works well
I decided that I need to fork my own branch and work on these two projects. There's a lot of features to notifications I need which aren't here, and development has slowed down. If anyone needs them, this is my version of node-notifier and snoretoasted.
|
The text was updated successfully, but these errors were encountered: