Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting notification list from OS X Notification Center

It's possible to send notifications to the Notification Center on Mac using NSUserNotification and NSUserNotificationCenter API classes.


But is there any way of reading the notifications from the Notification Center?

like image 355
Stéphane Bruckert Avatar asked Sep 15 '25 08:09

Stéphane Bruckert


1 Answers

There is no public API for that. So nothing App Store conform.

BUT

As part of my little tech-demo-app DiscoNotifier (where I flash the keyboard LEDs in response to a notification) I wrote a DDUserNotificationCenterMonitor class

see: https://github.com/Daij-Djan/DiscoNotifier/tree/master/DiscoNotifier

it works using FileSystemEvents and SQLite and checks the notification center's database

It works and the database has all info (table: presented_notifications) but.. this is fragile AND private

like image 184
Daij-Djan Avatar answered Sep 18 '25 12:09

Daij-Djan