xdg-open and file:// URI handling

Alexander Larsson alexl at redhat.com
Thu Apr 7 07:34:48 UTC 2016


On ons, 2016-04-06 at 19:30 +0100, Robert McQueen wrote:
> Hi list,
> 
> We touched on this in the GNOME Software hackfest, and there was an 
> internal discussion at Endless about a similar topic so I thought
> I'd 
> start a thread here and join the discussions.
> 
> I noticed with a GEdit xdg-app installed that when other stuff (eg 
> Firefox, File-Roller, etc) launches gedit to view eg a 
> downloaded/extracted file which is somewhere in /tmp or /run, gedit 
> opens with an empty window because it can't actually open the file
> it 
> was given on the command line.
> 
> (This isn't the case with Builder but it has full filesystem access 
> which is craaazy, have you folks _met_ Christian?! ;)

Even with full fs access you get a custom /tmp (as well as /usr, /run
and /var).

> Anyway - this class of problem applies to any app with a mime type 
> binding, so it is used by xdg-open or GIO file:// URI handling etc.
>> think we would need something like an xdg-app-open which 
> understands/recognises file paths in the command line argument, and
> maps 
> them in to the sandbox using the document portal in some kind of 
> transient / one-shot kind of way, before handing the transformed 
> path/URI into the app.
> 
> Then I guess we need to put that in the .desktop files for those
> apps 
> which use the document portal and care to access local files handed
> in 
> at launch time in this way.

During install of an app we "export" the desktop files, which involves
rewriting the Exec= field of the desktop file, to prepend "xdg-app run
..." to it. We could easily (optionally) add some flag that
(effectively) calls "xdg-app export-file --transient" on any filenames
that start with /tmp. Of course, the tricky part is to figure out what
part of the commandline is the argument, because by the time it reaches
xdg-app run the exec line is fully expanded, and you don't know what
part is from the launching app and what is from the Exec pattern.


-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl at redhat.com            alexander.larsson at gmail.com 
He's a deeply religious chivalrous assassin living undercover at Ringling 
Bros. Circus. She's a ditzy kleptomaniac Hell's Angel in the witness 
protection program. They fight crime! 





More information about the xdg-app mailing list