vjeantet / alerter

Send User Alert Notification on Mac OS X from the command-line.
MIT License
936 stars 62 forks source link

Some -sender notifications hang #36

Open Steffan-Ravn opened 3 years ago

Steffan-Ravn commented 3 years ago

I have a problem similar to #27 On Mojave everything is working as expected, but on Big Sur some notifications just hang when I'm using the -sender parameter. If I send as com.apple.TextEdit, it just works, but when I'm trying with com.microsoft.Outlook it just hangs and never gets anywhere.

Example: alerter -message "Hi there" -title "This is awesome" -sender "com.microsoft.outlook"

This is on Big Sur 11.2.1, with Outlook 16.46 and I've tried both the precompiled version of alerter, an earlier version of alerter and I even downloaded the project and compiled it myself. Still no luck.

I can see in the Console.app that when it hangs, the NotificationCenter never gets the call, instead I see messages of this nature:

error 13:43:48.541532+0100 usernoted Legacy client com.microsoft.Outlook connecting to modern client. You can't mix modern clients with legacy clients. <ClientConnect: 0x000000014b133200 identifier: com.microsoft.Outlook pid: 37218 type: Application> error 13:43:48.541897+0100 usernoted Denying message 3 from connection error 13:44:07.695655+0100 usernoted Denying message 7 from connection

Let me know if you need more information or if I should try something else.

rdp commented 3 years ago

For me it "hangs" (no dialog or notification appears), even without -sender, and nothing shows up in Console...hmm... update: appears my issue was https://github.com/vjeantet/alerter/issues/26#issuecomment-910565162

rundong08 commented 3 years ago

Since macos 10.14, Apple has introduced the "User Notifications" framework to deprecate the NSUserNotificationCenter class and the NSUserNotification class from Foundation framework. It appears that Outlook and Dropbox have already transitioned to the new framework, thus have registered themselves as "modern client" in the notification center. However, alerter is still using the old framework, which is considered a "legacy client", and will be denied when the -sender is already registered as a "modern client". The reason it still works for TextEdit is that normally TextEdit does not register itself in the Notification center.