Subject: bug#76120: [PATCH] Expose the native sharing dialog (macOS)

From: Stefan Kangas <[email-masked]>
Date: Sat, 15 Feb 2025 01:16:25 +0000

Richard Stallman <[email-masked]> writes:

> Could someone please explain briefly what the "native sharing dialog"
> of MacOS does?  What does it try to share, and when?
>
> When this discussion started, I did not know what sort of feature it
> was asking to enable on MacOS.  I am trying to guess but I am still
> not sure.
>
> Is it a facility to copy files between one MacOS machine and another,
> that does not communicate with any other system?  I am starting to
> guess so, because a facility that is "native" to MacOS would work only
> on MacOS.
>
> Or is it a facility to invoke "the right applcation" to oerate
> on a file?

The "Share" function in macOS, usually shown as a button or menu option,
allows you to share content using applications (e.g., Mail) and system
services (e.g., AirDrop).  Invoking it opens a menu with options like
AirDrop, Mail, Messages, and other installed programs.

This feature works through a macOS/iOS-specific API called "Share
Extensions", which lets programs specify what types of content they can
handle, such as files, text, links, images, or videos.  The receiving
process is informed of the content type through the API, and the
recommendation is that the program should then treat it as something
intended for sharing or posting.

Examples:

1. Files.  The file name and relevant metadata (such as type, size, and
   preview data) are sent to the chosen program or service, which
   handles it in context-specific ways.  For example, AirDrop sends the
   file to nearby Apple devices, Mail attaches it to a new email, and
   Notes saves an image file as a note.  The receiving program can also
   provide additional options based on the file type, e.g. sharing a
   photo to a social media program may offer editing or captioning
   options before posting, but again, that would be up to that program.

2. Text.  The selected text is handed off to the chosen program, where
   it is embedded accordingly.  For example, sharing text through Notes
   creates a new note, preserving formatting when possible, while with
   something like Messages, you can select a recipient to send the
   shared text as a message to that person.

3. Links.  The context menu shows options like "Add to Reading List",
   which saves the link for offline reading, or "Add Bookmark", which
   adds it to some list of bookmarks.  There is also "Add Website to
   Shared Links", but I don't know the specific behavior of that option.

I hope this clarifies some of the key aspects of the "Share" feature.
If anyone has anything to add or correct, please do.

Footnotes:
[1]  This is the one I was able to find.
     https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/Share.html