Creare Lanciatore per applicazione
Per Creare un lanciatore per un'applicazione e' necessario creare un file con estensione .desktop
al cui interno dovremmo specificare i dati dell'applicazione es.
[Desktop Entry] Type=Application Encoding=UTF-8 Name=Sample Application Name Comment=A sample application Exec=application Icon=application.png Terminal=false Categories=Applications;Network; Comment[sv]=Exempelprogramnamn Comment[it]=Programma di Esempio Comment[en]=ExampleProgram
Per rendere accessibile a tutti il file, posizionarlo in:
/usr/share/applications
Alternativamente si puo' creare in /etc/skel/.local/share/applications
in questo modo verra' reso disponibile a tutti i nuovi utenti creati nel sistema (viene creata la entry al
momento della creazione dell'utente)
Per rendere il file accessibile al solo utente, posizionarlo in:
~/.local/share/applications
Note ICONE
L'icona deve essere disponibile almeno alla risoluzione di 48x48, quindi metterla in:
Per rendere l'icona accessibile a tutti posizionare il file in:
/usr/share/icons/hicolor/48x48/apps/
Alternativamente si puo' creare in /etc/skel/.local/share/icons/hicolor/48x48/apps
in questo modo verra' resa disponibile a tutti i nuovi utenti creati nel sistema (viene creata la entry al
momento della creazione dell'utente)
Per rendere l'icona accessibile al solo utente, posizionarla in:
~/.local/share/icons/hicolor/48x48/apps
Note MIME Type
Adding MIME types
If your application can open specific MIME types, you need to let the desktop know in the desktop file. For example, if your application can accept PNG files, add the following line into your desktop file:
MimeType=image/png
Additional Mime types can be added by separating the different types with semicolons.
The system already knows of a large number of MIME types. However, if you are creating one of your own, you need to register your MIME type into the MIME database. In the /usr/share/mime/packages/ directory, create an XML file with the format as shown in Example 1-2. Example 1-2 Sample file for registering a new MIME type
<?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-type type="application/x-example"> <comment>Example file type </comment> <magic priority="50"> <match value="search-string" type="string" offset="10:140"/> </magic> <glob pattern="*.newextension"/> </mime-type> </mime-info>
In this example, replace the example MIME type with the name of your MIME type. The magic section searches files for the search string for identification. The glob line uses the suffix of file names for identification.
Because the magic command forces the computer to open the files to search for the string, the glob command is preferable.
Once your new MIME type is adequately described in the file, run the following in a shell:
update-mime-database /usr/share/mime
For more information on choosing a good MIME extension and to register your MIME type, go to the IANA [1] website.