node-notifier
node-notifier copied to clipboard
Timeout not working on macOS
I'm trying to get a sticky notification by setting a really high timeout, see below, not matter if I set the wait prop or any number in the timeout the notification disappears after the same ~5s timeout.
new NotificationCenter({withFallback: false}).notify({
title: 'Hello',
subtitle: 'world!',
message: `FooBar message`,
sound: 'Ping',
timeout: 60,
wait: true,
}, (err, response) => {
console.log('ERR', err);
console.log('RESPONSE', response);
});
Any help with this would be appreciated Thanks!
@Alxmerino
I have the same problem when I use timeout.
Maybe we could loop the notify and use a setTimeout function
notifier.notify({
'title': 'My notification',
'message': 'Hello, there!',
'wait': true,
});
notifier.on('timeout', function (notifierObject, options) {
notifier.notify({
'title': 'My notification',
'message': 'Hello, there!',
'wait': true,
});
});
To everyone looking for help with this, it appears that banner messages do not allow persistence. If you enter the System Preferences -> Notifications and change Terminal Notifier Notifications from Banners to Alerts, they will persist. This only works with timeout though, not with wait: true, but it's a start. It's noteworthy that this still throws an error after some time, so if you have an action on a button that should be processed after clicking the button 2 minutes after the message was shown, this is likely not going to work. This issue is most likely to be solved in the terminal-notifier project
@janolivermr Looks like terminal-notifier was last updated in Nov 1, 2017 and removed the timeout functionality (amongst other things). I don't expect we'll see a fix.
Any other solution for us?
I'm still having these issues on macos Monterey
timeout is now available as time, the following notification closes within 10 seconds when Terminal notifier is set to Alerts in MacOS.
nodeNotifier.notify({
title: "Hey",
message: "Wake up!",
sound: true,
time: 10000
}, (error, response, metadata) => {
console.log('notifier error: ', error)
console.log('notifier response: ', response)
console.log('notifier metadata: ', metadata)
})