node-notifier icon indicating copy to clipboard operation
node-notifier copied to clipboard

Timeout not working on macOS

Open Alxmerino opened this issue 7 years ago • 5 comments

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 avatar May 14 '17 18:05 Alxmerino

@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,
  });
});

qiangzi7723 avatar Aug 21 '17 16:08 qiangzi7723

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 avatar Sep 13 '17 12:09 janolivermr

@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?

kevinelliott avatar Mar 05 '19 22:03 kevinelliott

I'm still having these issues on macos Monterey

comatory avatar Jun 15 '22 12:06 comatory

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

lnfel avatar Mar 18 '23 05:03 lnfel