portals
portals copied to clipboard
Implement a Sharing Portal
Problem
This was discussed over email with @marbetschar.
I'm explaining this using an example. Lets say someone is reading an article on some app, say Communique and wants to save that article as a reminder in elementary Tasks. Currently, there is no way for Communique to save a reminder to Tasks. The user will have to manually open Tasks and create the task themselves and save it to a project.
Other apps can also benefit from this functionality.
Proposal
Implement some sort of Sharing Portal which is capable of receiving different types of information and forwarding that to the respective responsible apps.
Prior Art (Optional)
macOS
iOS

Just writing my thought: I think that it might be desirable to have an API similar to copy/paste support and not have everything file-based
I believe the best place to discuss this is in flatpak/xdg-desktop-portal#12, an cross-desktop portal means that applications won't need to check if it's running inside elementary to use it.
I think that it might be desirable to have an API similar to copy/paste support and not have everything file-based
@tintou, you say the Vala/C API or D-Bus API? For the DBus API, what i had in mind was something like the OpenURI Portal:
o org.freedesktop.portal.elementary.Share.ShareURI (s parent_window,
s uri,
a{sv} options)
o org.freedesktop.portal.elementary.Share.ShareFile (s parent_window,
h fd,
a{sv} options)
and a new method in the AppChooser portal:
(ua{sv}) org.freedesktop.impl.portal.AppChooser.ChooseAction (o handle,
s app_id,
s parent_window,
aa{sv} choices,
a{sv} options)
then applications would implement an io.elementary.Share D-Bus interface that would have only one method:
aa{sv} io.elementary.Share.ListActions (s mime_type)`
the actions would be activated via the org.freedesktop.Application.ActivateAction method, applications would declare support using the Implements key and supported mimes in the io.elementary.Share group in they .desktop file, Like the upstream proposal. In case of upstreaming, instead of a new portal, it can be new methods to the OpenURI portal itself.
For the Vala/C API, we cloud implement it in an helper object:
[DBus (name = "io.elementary.Share")]
public sealed class Granite.Share : Object {
public uint register_action (string action_name, string mime, string title, Icon? icon);
public void unregister_action (uint id);
}
and/or undeprecate the Granite.Application class, and add helpers:
[DBus (name = "io.elementary.Share")]
public class Granite.Application : Gtk.Application {
public void export_action (string action_name, string mime, string title, Icon? icon);
public void unexport_action (string action_name);
}
batch register/export and unregister/unexport methods could be provided if needed.
Just wanted to note in addition to the design discussion on the Granite ActionSheet issue that this is a pretty convenient and smart feature that would be nice. Generating a QR code for any URL passed into the sharing portal: https://mastodon.social/@sil/111353440431438250