Is "notify" broken?

Trying to send a notification via notify, but it doesn’t work over here.

notify("Hello world");

As a workaround it’s possible use runCommand with AppleScript’s display notification:

var theAppleScript='display notification "Hello world" with title "Test"';
runCommand("osascript -e '"+theAppleScript+"'");

Not sure whether notify just stopped working after the 9.5 update, didn’t use it in a long time.

I can get this to work but only after I noticed a notification (how ironic) from Tinderbox asking to be allowed to sent notifications.

If you miss that prompt go to System Preferences / Notifications & Focus and enable notifications from Tinderbox. In macOS 13 the location may be different in the iOS-ified preferences. It’s annoying the the OS is so poor about surfacing requests form apps that my not know the ever changing Apple security protocols that keep turning things off that used to work. I understand the security impetus, but it would be hlep to know something that should work now doesn’t, because of OS changes.

1 Like

Already checked that before posting. Tried to zip Tinderbox.app, restarted mac, unzipped. When asked allowed Tinderbox to send notifications. Still didn’t work.

Now the really strange thing:

I can see notifications on the desktop after switching from “Banner” (the temporary ones) to “Hinweise” (the sticky ones):

But if I switch back to “Banner” then no notifications are shown. Well that’s not exactly true. They are shown, but not on the desktop. They only appear in the notification center:

No idea how to solve that.

Tinderbox 9.5 uses an entirely new notification API, one enforced by Apple. I think we’re currently requesting for the notification to appear in the Notification Center; I’ll need to check.

1 Like

Just found that:

If the application defined by the package name (in this case com.microsoft.VSCode) is focused, the notification is not “pushed” to the user under default settings [1]. Instead it is hidden in the notification center. When the application in question is not focused, though, the notification is pushed properly.

(MacOS notifications hidden in notification center when app is focused)

Using this stamp

runCommand("sleep 3");
notify(date("today"));

and then activating Finder (to make it frontmost) makes the notification appear.

2 Likes

With hindsight, as ever, this makes sense. The notification is OS wide. If you are already in the app making the system wide notification, why would you need to know? Another assumption tested and found to be less clear than imagined. :slight_smile:

I think (from some googling) that an alert looks the same as a notificationbut shows ‘on top’ regardless. My hunch is that would require a different call out from the app, IOW a new/different operator.

After adding something from Safari I often split the note “manually” via Note > Split (as Note > Explode often can’t be used due to missing structure). I then copy the “original” note’s URL to use a stamp that sets it for the resulting notes. The stamp’s first step is to check whether there’s a URL in the clipboard, if not I’d like to see a notification. Using runCommand to show the notification via AppleScript will be fine.

Just wondered as in the past notify showed notifications when Tinderbox was frontmost.

What I don’t understand: why does it still work on your mac but not on mine (macOS 12.6.1)?