executable .desktop files

Egon Kocjan egon at krul.ath.cx
Thu Aug 21 10:45:09 PDT 2008


Hopefully some time in the future, oss desktops will support application 
bundles. There is a somewhat working equivalent in the mean time, using 
.desktop files, perl and base64 encoding (Exec line should not be split):

[Desktop Entry]
Exec=perl -e 'use MIME::Base64 
Name=My App
# ...
# base64 encoded executable (or self extracting bundle) goes here
# ...

The perl block effectively expands to:

use MIME::Base64;
use File::Temp;
use IO::File;
sub run {
$file = pop;
$file =~ s,^file://,,;
$buf = '';
$in = IO::File->new($file);
while(<$in>) {
if(/^\#(.*)$/) { $buf .= $1; }
$tmp = File::Temp->new(UNLINK=>0);
chmod 0700, $tmp;
print $tmp decode_base64($buf);
exec { $tmp->filename } ($tmp->filename);

- users can simply download packed applications with the web browser to 
the desktop and start them with double-click
- it works with standard releases of gnome, kde and xfce, no need to 
install any extra software on the client side

- some users may ignore the instructions to download the .desktop file 
and open it in text editor instead (default action in most distros)
- download size is larger because of base64 encoding
- not possible to set a custom application icon
- large executables (5mb and up) "hang" nautilus (I haven't tested much 
with others)

Maybe this will serve as an inspiration for the next iteration of fd.org 
standards ;)


More information about the xdg mailing list