Inhaltsverzeichnis

, , ,

Hinweise zur Mimetype Unterstützung

Problem

Manchmal wissen die Desktop-Umgebungen (Gnome,KDE, etc) nicht, wie sie bei Nicht-Standard-Programmen für Linux die Anwendung starten sollen oder dass Dateien, die mit diesen Programmen erzeugt wurden wiederum mit den Programmen zu öffnen sind.

Beispiel ist „Maple“. An diesem Beispiel wird gezeigt, wie man für die Endbenutzer entsprechenden Support einrichten kann.

Lösung

Stand: — Tobias 2013/10/06 02:05

Mime support

usr_share_mime_packages_maple15.xml
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/x-maple-mws">
         <comment>Maple 15 Classic Worksheet</comment>
         <comment xml:lang="de">Maple 15 Classic Worksheet</comment>
         <glob pattern="*.mws"/>
  </mime-type>
  <mime-type type="application/x-maple">
         <comment>Maple 15 Worksheet</comment>
         <comment xml:lang="de">Maple 15 Worksheet</comment>
         <glob pattern="*.mw"/>
  </mime-type>
</mime-info>
sudo cp usr_share_mime_packages_maple15.xml /usr/share/mime/packages/maple15.xml
sudo update-mime-database /usr/share/mime
sudo cp Maple15.png /usr/share/icons/hicolor/48x48/mimetypes/application-x-maple.png
sudo cp Maple15Classic.png /usr/share/icons/hicolor/48x48/mimetypes/application-x-maple-mws.png
sudo update-icons-caches /usr/share/icons/hicolor
Alternativ: Statt des Kopierens nach hicolor/48×48/mimetypes/, kann man auch in der XML-Datei den Eintrag „generic-icon name“ definieren und dann die entsprechenden Dateipfade anpassen. Editiere die Datei usr_share_mime_packages_maple15.xml und passe generic-icon name an den zugehörigen Dateinamen an, z.B. „x-maple15.png“ → „x-maple15“
usr_share_mime_packages_maple15.xml
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/x-maple-mws">
         <comment>Maple 15 Classic Worksheet</comment>
         <comment xml:lang="de">Maple 15 Classic Worksheet</comment>
         <glob pattern="*.mws"/>
         <generic-icon name="x-maple15-mws"/>
  </mime-type>
  <mime-type type="application/x-maple">
         <comment>Maple 15 Worksheet</comment>
         <comment xml:lang="de">Maple 15 Worksheet</comment>
         <glob pattern="*.mw"/>
         <generic-icon name="x-maple15"/>
  </mime-type>
</mime-info>
sudo cp Maple15.png /usr/share/icons/x-maple15.png
sudo cp Maple15Classic.png /usr/share/icons/x-maple15-mws.png
sudo update-icon-caches /usr/share/icons 

Desktop Beschreibung

usr_share_applications_maple15.desktop
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Maple 15
GenericName=Computer Algebra System
Comment=Ein proprietäres Mathematiksystem von MapleSoft
Type=Application
Exec=/opt/maple15/bin/maple -x %f
Icon=/opt/maple15/bin/Maple15.png
Terminal=false
Categories=Education;Math;
MimeType=application/x-maple;application/x-maple-mws;
sudo unlink /usr/share/applications/maple15.desktop
sudo ln -s /opt/maple15/bin/usr_share_applications_maple15.desktop  /usr/share/applications/maple15.desktop
sudo update-desktop-database

Ergebnis

MimeType=application/x-maple-mws;
usr_share_applications_maple15mws.desktop
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Maple 15 Classic
GenericName=Computer Algebra System
Comment=Ein proprietäres Mathematiksystem von MapleSoft
Type=Application
Exec=/opt/maple15/bin/maple %f
Icon=/opt/maple15/bin/Maple15Classic.png
Terminal=false
Categories=Education;Math;
MimeType=application/x-maple-mws;