I'm specifically looking to design a custom action for LaunchBar so that I can initiate a tweet from that utility. Since Notification Center has a "Click to tweet" button, I wondered if Notification Center has any hooks that would allow me to script this without waiting for the developer of the program add a function to perform this action.
MacOS – What hooks exist into Notification Center / twitter so that I can tweet programmatically
macosnotificationstwitter
Related Question
- MacOS – Twitter And Facebook Integration Missing In Notification center
- MacOS – How to disable the tweet sound when using Click to Tweet in Notification Center
- Why do Twitter notifications in Notification Center open in Safari
- IOS – Tap to tweet/tap to post is at the bottom of the notification center
- MacOS – Do any OS X twitter apps integrate well with Notification Center
- MacOS – OS X – build a bash function to send notifications via osascript / Applescript
- MacOS – Dismiss MacOS Big Sur notifications with keyboard
Best Answer
Apps can hook into the sharing options with the new NSSharingService API. It sounds like custom LaunchBar actions can be made with any UNIX executable file, so you could probably write a small command line tool (or you may need to build an actual app — you'll have to test it out) which activates this API (using
NSSharingServiceNamePostOnTwitter
), and that should display the tweet dialog.Update: to initiate a tweet from AppleScript, you can do the following:
Furthermore, you can toggle the "Show Alerts and Banners" / do not disturb mode:
(This is all very specific to the current window layout of Notification Center and is likely to break with future OS X updates — but there will probably be easy fixes.)