App as endpoint in Share API chain

Hi everyone!

The application works with .zip and .csv files, and in order to open them, I need to first launch the application, open a file dialog and find the file I need. I would like to transfer them directly from mail client or file browser or messenger etc. How can this be done? It smells like Share API) But there is not enough information.


  1. Your app should be able to do appname filepath and open/deal with a file given in filepath
  2. create a .desktop file which calls the app as ‘appname %U’, and register a mime handler for each file you can handle.

Best look for how other apps do that and copy them.

1 Like

For the share API afaik you have to register a dbus service, and launch your app with file path through that.

1 Like

Hi. It is relatively easy. But not such easy as on standard Linux, when you can add just one line to desktop file. Because Sailfish executes application in single instance, you have to register D-Bus service to listen for “open” actions when your application is running already. You can get inspiration in Jolla’s Mediaplayer app, that is registered for opening audio files.

In /usr/share/applications/jolla-mediaplayer.desktop file are important these lines:


To make open action working, there is important D-Bus registration in file /usr/share/dbus-1/services/com.jolla.mediaplayer.service:

[D-BUS Service]
Exec=/usr/bin/invoker -s --type=generic /usr/bin/sailjail -p jolla-mediaplayer.desktop /usr/bin/jolla-mediaplayer -prestart

Last missing piece is D-Bus service in app itself. In /usr/share/jolla-mediaplayer/mediaplayer.qml is:

    DBusAdaptor {
        service: "com.jolla.mediaplayer"
        path: "/com/jolla/mediaplayer/ui"
        iface: "com.jolla.mediaplayer.ui"

        function activateWindow(arg) {

        function openUrl(arg) {
            if (arg.length === 0) {

                return true

            if (!pageStack.currentPage || pageStack.currentPage.objectName !== "PlayQueuePage") {
                pageStack.push(playQueuePage, {}, PageStackAction.Immediate)
            dockedPanel().open = true

            return true

You can test it from command line:

xdg-open path/to/some/song.mp3

This mechanism is not allowed in Harbour unfortunately. But you can distribute additional files in extra package on OpenRepos :slight_smile: I am doing that in OSM Scout, url support | — Community Repository System


Thanks to @karry and @nephros for help!