hammerspoon2-docs
    Preparing search index...

    Namespace sharing

    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.

    hs.sharing.createShare(hs.sharing.builtinServices.mail)
    .setCallback((event) => {
    if (event === 'didShare') console.log('Sent!')
    })
    .shareItems(['Check this out', 'https://www.hammerspoon.org'])
    hs.sharing.createShare(hs.sharing.builtinServices.airdrop)
    .shareItems(['~/Desktop/photo.jpg'])
    const services = hs.sharing.servicesFor(['https://www.hammerspoon.org'])
    services.forEach(s => console.log(s.title))

    Variables

    builtinServices

    Functions

    createShare
    servicesFor