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

From: Björn Bidar <[email-masked]>
Date: Mon, 10 Feb 2025 22:23:51 +0200

First of all Alvaro's explanation explains it quite well but I want to
add to it.

Eli Zaretskii <[email-masked]> writes:

>> Cc: [email-masked], Alvaro Ramirez <[email-masked]>
>> Date: Mon, 10 Feb 2025 02:17:42 +0200
>> From:  Björn Bidar via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <[email-masked]>
>> 
>> Stefan Kangas <[email-masked]> writes:
>> 
>> >>> Would you or anyone else be interested in implementing this for
>> >>> GNU/Linux as well?  I don't think we need perfect coverage of
>> >>> all
>> >>> desktop environments, but it would be useful to support it on
>> >>> one or more
>> >>> popular ones (for example Gnome or KDE).
>> >>
>> >> Skills-wise, I wouldn't be the best candidate to make the
>> >> Linux-related changes. I could try reaching out to Carl Lieberman,
>> >> author of https://github.com/carldotac/kdeconnect.el, to see if
>> >> they'd be inclined to contribute their package upstream.
>> >>
>> >>> This would also be a good opportunity to generalize the feature,
>> >>> so that
>> >>> instead of having `ns-share`, we would have a command named
>> >>> `share-file`
>> >>> or something like that.
>> >>
>> >> Without a Linux partner to help with the counter changes, I'm less
>> >> likely to take on the additional scope.
>> >>
>> >> I could also reach out to emacs-devel if you reckon it's
>> >> appropriate to scout Linux support.
>> >
>> > Asking Carl Lieberman might be a useful step.  Asking on emacs-devel
>> > would also be useful, to see if other people have any comments.
>> 
>> kdeconnect.el doesn't implement any dialog to "share" a file but only
>> invokes KDEconnect CLI to share a file.
>> 
>> >From what I know there's no direct share "Linux" (Linux in quotes
>> because the definition what Linux is isn't exact) or XDG API for sharing.
>> 
>> KDE has the Purpose API[1] as a generic API for interacting with
>> applications to e.g. provide a share API or open something in an
>> application. For example KDE Connect has a provider for this API which
>> allows to share with it similarly to it's CLI application.
>> 
>> How sharing is done in KDE can been here.[2]
>> 
>> GNOME doesn't have a Sharing API but there's an issue open about this
>> topic.[3]
>
> I think we should get our terminology right, because the "share"
> business is replete with hype which muddies the waters.  In
> particular, quite a few "sharing" options are another word with "open
> with", and we already have that (see my other message up-thread).
> Examples:
>
>   . "sharing" with a printer means printing, which is the same as
>     "opening" by a printer
>   . "sharing" with an email program means sending as an email message,
>     which is the same as "opening" by a MUA

In this context the MUA would be opened with the to be shared file
in a new message window, removing the step in between opening and
attaching the file.
More like a mailto: link rather than manually "opening".

>   . "sharing" a selection of text is the same a drag-n-drop the text
>     onto an application

It's the same but the program which is the direction would receive the
input prepared by the sending program e.g. any kind of content not just
text.

> etc., etc.  So what exactly is the "sharing" we are talking about
> here?  I very much hope that it doesn't just mean show a menu whose
> caption says "Share with" (which would mean it's another hype)...

Well it's certainly not another hype since a feature like it or similar
has been implemented across all major operating systems.

The point is that there's a direct interaction from the user in the
current program they use to programs offering methods of interaction so
kinda like open with but with a specific action in mind.

E.g. instead of print menu there's a menu to show various actions
such as printing or forwarding the file. The purpose is that such action
are in central location instead of a button for every specific action
specific to each program.

Kinda like you can invoke org-capture anywhere in Emacs and go from
there but explicitly support by a program.

Since program is in control about what is shared to the action it can
also assemble the file in any preferred the user wants.
For example if the user wants to share an image it could cut and
downscale the image.