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

From: Björn Bidar <[email-masked]>
Date: Fri, 21 Feb 2025 02:55:40 +0200

Richard Stallman <[email-masked]> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > It allows to send a file or a region of text to another application or
>   > a service.
>
> The term "sharing" is very misleading for this; we use the word
> "share" for comething that people do with other people.  So we should
> not adopt Apple's terminology.

As Eli already explained the term "share" in that context is an industry
term now days. Redefining would be good UX.

> I think "system invocation dialog" is a better name for us to use.
> Is there any reason that would be misleading?
>
>                 It's an addition to a feature we already have in Dired and
>   > other places whereby a file can be "opened" by some external means,
>   > like a program (e.g., to show it or do other actions with it) or a
>   > printing service (e.g., to print the text).
>
> Does that mean it is comparable to the ! command in Dired?

No as the platform share dialog doesn't execute arbitrary programs but 
a list of programs or actions. The term action is vague but largely
describes invoking programs specific to the dialogue to e.g. send a file
over Bluetooth, a service such as KDE connect or upload it to
some like Nextcloud. Some programs offer dialogues to only send a file
to a user without opening the program this way.

It's like the print dialogue but with other programs be able to hook
themselves into that dialog.

Because of that nature most of these API's to access these require the
use of libraries instead of some kind of IPC mechanism.

If this stays this way one way to add this feature to Emacs would be to
adopt either the window-system's implementation in the form of GNOME for
GTK builds or use some glib based implementation if there's a way to do
this without involvement of the window system toolkit. The latter would
work like freedesktop.org XDG-Desktop portals if that's possible. I
didn't design any of this I just investigated what is out there. 

> Do shell commands exist on MacOS?  Can users do with ! on MacOS the
> same things they can do with the system invocation dialog?

There's the open(1) command on macOS which is akin to xdg-open, but that
is not the same as the "share" dialog. open largely exactly like
xdg-open, the program is opened in the default application nothing else
happens.

> Perhaps the system invocation dialog has some conveniences -- for
> instance, not needing to remember shell commands or their syntax.
> Is that the case?

Yes exactly. It's just a list of programs to share the file with like a
Matrix messenger, common actions such as share over Bluetooth etc.
The point the benefit for this dialog is that all programs on the OS can
use this dialog giving the user consistent UX when e.g. sending files.

> If so, would those conveniences be convenient on GNU/Linux if they
> existed?

There would but at this moment there's no shared standard definition for
a standard for this. KDE has a implement for this which is support by
most of their applications. GNOME doesn't have a working implementation
by there are plans.  It's largely a GNU/Freedesktop.org XDG/Linux thing. 

> Should we aim to implement that system invocation dialog on GNU/Linux?
> Then it would be a feature that isn't MacOS-specific.

I'm not sure who is we in this context. GNU wouldn't be the best driver
of such efforts as Linux desktop standardization largely happened
around Freedesktop.org XDG.