executable .desktop files

Egon Kocjan egon at krul.ath.cx
Thu Aug 21 13:18:57 PDT 2008


Sure. If I'm not mistaken, there's no other solution, that gives you 
instant double-clickable executables on standard gnome/kde/xfce 
desktops. Let me give an example from klik:

"To quickly prepare your system for klik, install the klik client (NOT 
as root): wget klik.atekon.de/client/install -O -|sh  and follow 
instructions on screen."

Klik developers could simply pack the script as a self-executable 
.desktop file as described. So, the end user would have to follow these 
two steps to install klik:
1. download http://klik.atekon.de/client_install.desktop to the desktop
2. double-click the "Klik installer" icon on your desktop

No more tricky shell commands.

Adrien BUSTANY wrote:
> Hi,
> I don't really understand what is the problem addressed here, could you 
> explain it further please ?
> 
> Best regards
> Adrien Bustany
> 
> Egon Kocjan a écrit :
>> Hi,
>>
>> 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]
>> Encoding=UTF-8
>> Exec=perl -e 'use MIME::Base64 
>> qw(decode_base64);eval(decode_base64(q(dXNlIEZpbGU6OlRlbXA7dXNlIElPOjpGaWxlO3N1YiBydW4geyRmaWxlID0gcG9wOyRmaWxlID1+IHMsXmZpbGU6Ly8sLDskYnVmID0gJyc7JGluID0gSU86OkZpbGUtPm5ldygkZmlsZSk7d2hpbGUoPCRpbj4pIHtpZigvXlwjKC4qKSQvKSB7ICRidWYgLj0gJDE7IH19JGluLT5jbG9zZSgpOyR0bXAgPSBGaWxlOjpUZW1wLT5uZXcoVU5MSU5LPT4wKTtjaG1vZCAwNzAwLCAkdG1wO3ByaW50ICR0bXAgZGVjb2RlX2Jhc2U2NCgkYnVmKTskdG1wLT5jbG9zZSgpO2V4ZWMgeyAkdG1wLT5maWxlbmFtZSB9ICgkdG1wLT5maWxlbmFtZSk7ZGllO30g)));run(q(%k));'
>> Name=My App
>> Type=Application
>> # ...
>> # 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; }
>> }
>> $in->close();
>> $tmp = File::Temp->new(UNLINK=>0);
>> chmod 0700, $tmp;
>> print $tmp decode_base64($buf);
>> $tmp->close();
>> exec { $tmp->filename } ($tmp->filename);
>> die;
>> }
>> run(q(/path/to/itself));
>>
>>
>> Pros:
>> - 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
>>
>> Cons:
>> - 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 ;)
>>
>> egon
>>
>> _______________________________________________
>> xdg mailing list
>> xdg at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/xdg
>>   
>    
> _______________________________________________
> xdg mailing list
> xdg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xdg



More information about the xdg mailing list