|
|
(19 intermediate revisions by 5 users not shown) |
Line 1: |
Line 1: |
| {{Template:I18n/Language Navigation Bar|Development/Tutorials/Desktop File}}
| | This tutorial was updated and moved to https://develop.kde.org/docs/features/desktop-file/ |
|
| |
|
| {{TutorialBrowser|
| | [[Category:MovedDevelop]] |
| | |
| series=Basics|
| |
| | |
| name=Desktop File|
| |
| | |
| pre=[[Development/Tutorials/Session_Management|Session Management]]|
| |
| | |
| next=|
| |
| | |
| reading=[http://standards.freedesktop.org/desktop-entry-spec/latest/ the .desktop Free Desktop Spec];
| |
| }}
| |
| | |
| == Desktop File ==
| |
| | |
| In order for your application to show up in menus and/or to be automatically associated with mime types in file browsers, you need to provide a .desktop file like follows:
| |
| | |
| <syntaxhighlight lang="ini">
| |
| [Desktop Entry]
| |
| Type=Application
| |
| Exec=your-app %u
| |
| MimeType=application/x-your-mime-type;
| |
| Icon=some-icon
| |
| X-DocPath=yourapp/index.html
| |
| Terminal=false
| |
| Name=Your App
| |
| GenericName=Some Generic Name
| |
| Comment=Short Description Of Your App
| |
| Categories=Qt;KDE;
| |
| </syntaxhighlight>
| |
| | |
| Take a look at [http://standards.freedesktop.org/desktop-entry-spec/latest/ the .desktop Free Desktop Spec] to find our more about the key/value pairs above. It's important to pick a good set of Categories, see the spec for a list of valid values.
| |
| | |
| == Your project ==
| |
| In your project you need to take care the .desktop file is distributed to the appropriate place.
| |
| In case you are working on a qmake based project, add the following to your .pro file:
| |
| '''target.path = /usr/local/bin'''
| |
| desktop.path = /usr/share/applications
| |
| desktop.files += your-app.desktop
| |
| | |
| '''INSTALLS += target''' desktop
| |
| | |
| Note that the bold strings above should be in your project anyway.
| |
| | |
| [[Category:Programming]]
| |
| [[Category:Tutorial]]
| |
| [[Category:FAQs]] | |