Share data with other people and apps via macOS sharing services (Mail, Messages,
AirDrop, and more).
hs.sharing wraps NSSharingService. Some services from older macOS/Hammerspoon
Aperture (discontinued in 2015) and the built-in Facebook/Twitter/Sina Weibo/Tencent
Weibo/LinkedIn posting and profile-image services (removed in macOS 10.14).
Items to share can be plain strings — treated as a web/mailto URL if they parse as
one, a file path if they start with / or ~ and the file exists, otherwise plain
text — or HSImage objects.
Quick start
hs.sharing.createShare(hs.sharing.builtinServices.mail) .setCallback((event) => { if (event === 'didShare') console.log('Sent!') }) .shareItems(['Check this out', 'https://www.hammerspoon.org'])
Share data with other people and apps via macOS sharing services (Mail, Messages, AirDrop, and more).
hs.sharingwrapsNSSharingService. Some services from older macOS/Hammerspoon Aperture (discontinued in 2015) and the built-in Facebook/Twitter/Sina Weibo/Tencent Weibo/LinkedIn posting and profile-image services (removed in macOS 10.14). Items to share can be plain strings — treated as a web/mailto URL if they parse as one, a file path if they start with/or~and the file exists, otherwise plain text — orHSImageobjects.Quick start
Sharing a file via AirDrop
Discovering what can handle an item