|
|
(15 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) |
Zeile 1: |
Zeile 1: |
| '''topic''' - Kurzbeschreibung | | '''topic''' - Beschreibung |
| == Beschreibung == | | == Beschreibung == |
| | The [https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html XDG Desktop Entry specification] defines a standard for applications to integrate into application menus of [[desktop environment]]s implementing the [https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html XDG Desktop Menu] specification. |
| | |
| === Installation === | | === Installation === |
| == Syntax == | | |
| | == Aufruf == |
| === Optionen === | | === Optionen === |
| === Parameter === | | === Parameter === |
| === Umgebungsvariablen === | | === Umgebung === |
| === Exit-Status === | | === Rückgabewert === |
| == Anwendung == | | == Anwendung == |
| === Fehlerbehebung === | | === Problembehebung === |
| == Konfiguration == | | == Konfiguration == |
| === Dateien === | | === Dateien === |
| == Anhang == | | == Anhang == |
| === Siehe auch === | | === Siehe auch === |
| ==== Unterseiten ====
| | == |
| {{Special:PrefixIndex/{{BASEPAGENAME}}}} | | {{Special:PrefixIndex/{{BASEPAGENAME}}}} |
| ==== Sicherheit ==== | | ==== Sicherheit ==== |
| ==== Dokumentation ==== | | ==== Dokumentation ==== |
| ===== RFC ===== | | ===== RFC ===== |
| ===== Man-Pages ===== | | ===== Man-Page ===== |
| ===== Info-Pages ===== | | ===== Info-Pages ===== |
| ==== Links ==== | | ==== Links ==== |
| ===== Einzelnachweise =====
| |
| <references />
| |
| ===== Projekt ===== | | ===== Projekt ===== |
| ===== Weblinks ===== | | ===== Weblinks ===== |
| # https://wiki.archlinux.org/title/Desktop_entries | | # https://wiki.archlinux.org/title/Desktop_entries |
| | # [[Wikipedia:.desktop]] |
| | # [https://freedesktop.org/wiki/Howto_desktop_files/ Information for developers] |
| | |
| <noinclude> | | <noinclude> |
|
| |
|
| === Testfragen ===
| | [[Category:Freedesktop.org]] |
| <div class="toccolours mw-collapsible mw-collapsed">
| |
| ''Testfrage 1''
| |
| <div class="mw-collapsible-content">'''Antwort1'''</div>
| |
| </div>
| |
| <div class="toccolours mw-collapsible mw-collapsed">
| |
| ''Testfrage 2''
| |
| <div class="mw-collapsible-content">'''Antwort2'''</div>
| |
| </div>
| |
| <div class="toccolours mw-collapsible mw-collapsed">
| |
| ''Testfrage 3''
| |
| <div class="mw-collapsible-content">'''Antwort3'''</div>
| |
| </div>
| |
| <div class="toccolours mw-collapsible mw-collapsed">
| |
| ''Testfrage 4''
| |
| <div class="mw-collapsible-content">'''Antwort4'''</div>
| |
| </div>
| |
| <div class="toccolours mw-collapsible mw-collapsed">
| |
| ''Testfrage 5''
| |
| <div class="mw-collapsible-content">'''Antwort5'''</div>
| |
| </div>
| |
| </noinclude> | | </noinclude> |
|
| |
|
| |
| = TMP =
| |
| The [https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html XDG Desktop Entry specification] defines a standard for applications to integrate into application menus of [[desktop environment]]s implementing the [https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html XDG Desktop Menu] specification.
| |
|
| |
| == Basics ==
| |
| Each desktop entry must have a {{ic|Type}} and a {{ic|Name}} key and can optionally define its appearance in the application menu.
| |
|
| |
| The three available types are:
| |
|
| |
| ;Application
| |
| :Defines how to launch an application and what MIME types it supports (used by [[XDG MIME Applications]]). With [[XDG Autostart]] Application entries can be [[Autostarting|started automatically]] by placing them in specific directories. Application entries use the {{ic|.desktop}} file extension. See [[#Application entry]].
| |
|
| |
| ;Link
| |
| :Defines a shortcut to a {{ic|URL}}. Link entries use the {{ic|.desktop}} file extension.
| |
|
| |
| ;Directory
| |
| :Defines the appearance of a submenu in the application menu. Directory entries use the {{ic|.directory}} file extension.
| |
|
| |
| The following sections will roughly explain how these are created and validated.
| |
|
| |
| == Application entry ==
| |
|
| |
| Desktop entries for applications, or {{ic|.desktop}} files, are generally a combination of meta information resources and a shortcut of an application. These files usually reside in {{ic|/usr/share/applications/}} or {{ic|/usr/local/share/applications/}} for applications installed system-wide, or {{ic|~/.local/share/applications/}} for user-specific applications. User entries take precedence over system entries.
| |
|
| |
| === File example ===
| |
|
| |
| Following is an example of its structure with additional comments. The example is only meant to give a quick impression, and does not show how to utilize all possible entry keys. The complete list of keys can be found in the [https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys freedesktop specification].
| |
|
| |
| [Desktop Entry]
| |
|
| |
| # The type as listed above
| |
| Type=Application
| |
|
| |
| # The version of the desktop entry specification to which this file complies
| |
| Version=1.0
| |
|
| |
| # The name of the application
| |
| Name=jMemorize
| |
|
| |
| # A comment which can/will be used as a tooltip
| |
| Comment=Flash card based learning tool
| |
|
| |
| # The path to the folder in which the executable is run
| |
| Path=/opt/jmemorise
| |
|
| |
| # The executable of the application, possibly with arguments.
| |
| Exec=jmemorize
| |
|
| |
| # The name of the icon that will be used to display this entry
| |
| Icon=jmemorize
| |
|
| |
| # Describes whether this application needs to be run in a terminal or not
| |
| Terminal=false
| |
|
| |
| # Describes the categories in which this entry should be shown
| |
| Categories=Education;Languages;Java;
| |
|
| |
| {{Note|Only {{ic|Type}} and {{ic|Name}} are required.}}
| |
|
| |
| === Key definition ===
| |
|
| |
| All recognized entries can be found on the [https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys freedesktop] site.
| |
| For example, the {{Ic|Type}} key defines three types of desktop entries: Application (type 1), Link (type 2) and Directory (type 3).
| |
|
| |
| * {{Ic|Version}} key does not stand for the version of the application, but for the version of the desktop entry specification to which this file complies.
| |
|
| |
| * {{Ic|Name}}, {{Ic|GenericName}} and {{Ic|Comment}} often contain redundant values in the form of combinations of them, like:
| |
|
| |
| Name=Pidgin Internet Messenger
| |
| GenericName=Internet Messenger
| |
| or
| |
| Name=NoteCase notes manager
| |
| Comment=Notes Manager
| |
|
| |
| This should be avoided, as it will only be confusing to users. The {{Ic|Name}} key should only contain the name, or maybe an abbreviation/acronym if available.
| |
|
| |
| * {{Ic|GenericName}} should state what you would generally call an application that does what this specific application offers (i.e. Firefox is a "Web Browser").
| |
| * {{Ic|Comment}} is intended to contain any useful additional information.
| |
|
| |
| === Validation ===
| |
|
| |
| As some keys have become deprecated over time, you may want to validate your desktop entries using {{man|1|desktop-file-validate}} which is part of the {{Pkg|desktop-file-utils}} package. To validate, run:
| |
|
| |
| $ desktop-file-validate <''your desktop file''>
| |
|
| |
| This will give you very verbose and useful warnings and error messages.
| |
|
| |
| === Installation ===
| |
|
| |
| Use {{man|1|desktop-file-install}} to install desktop file into target directory. For example:
| |
| $ desktop-file-install --dir=$HOME/.local/share/applications ~/app.desktop
| |
|
| |
| === Update database of desktop entries ===
| |
|
| |
| To make desktop entries defined in {{ic|~/.local/share/applications}} work, run the following command:
| |
|
| |
| $ update-desktop-database ~/.local/share/applications
| |
|
| |
| {{Tip|Add the {{ic|-v}} (verbose) argument to show possible desktop entry errors.}}
| |
|
| |
| == Icons ==
| |
|
| |
| See also the [https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html Icon Theme Specification].
| |
|
| |
| === Common image formats ===
| |
|
| |
| Here is a short overview of image formats commonly used for icons.
| |
|
| |
| {| class="wikitable" align="center"
| |
| |+ Support for image formats for icons as specified by the freedesktop.org standard.
| |
| ! Extension
| |
| ! Full Name and/or Description
| |
| ! Graphics Type
| |
| ! Container Format
| |
| ! Supported
| |
| |-
| |
| !align="left" | .[[wikipedia:Portable Network Graphics|png]]
| |
| | Portable Network Graphics
| |
| | [[wikipedia:Raster graphics|Raster]]
| |
| | {{No}}
| |
| | {{Yes}}
| |
| |-
| |
| !align="left" | .[[wikipedia:Scalable Vector Graphics|svg(z)]]
| |
| | Scalable Vector Graphics
| |
| | [[wikipedia:Vector graphics|Vector]]
| |
| | {{No}}
| |
| | {{G|Yes (optional)}}
| |
| |-
| |
| !align="left" | .[[wikipedia:X PixMap|xpm]]
| |
| | X PixMap
| |
| | [[wikipedia:Raster graphics|Raster]]
| |
| | {{No}}
| |
| | {{Y|Yes (deprecated)}}
| |
| |-
| |
| !align="left" | .[[wikipedia:Graphics Interchange Format|gif]]
| |
| | Graphics Interchange Format
| |
| | [[wikipedia:Raster graphics|Raster]]
| |
| | {{No}}
| |
| | {{No}}
| |
| |-
| |
| !align="left" | .[[wikipedia:ICO (icon image file format)|ico]]
| |
| | MS Windows Icon Format
| |
| | [[wikipedia:Raster graphics|Raster]]
| |
| | {{Yes}}
| |
| | {{No}}
| |
| |-
| |
| !align="left" | .[[wikipedia:Apple Icon Image|icns]]
| |
| | Apple Icon Image
| |
| | [[wikipedia:Raster graphics|Raster]]
| |
| | {{Yes}}
| |
| | {{No}}
| |
| |-
| |
| |}
| |
|
| |
| === Converting icons ===
| |
|
| |
| {{Merge|ImageMagick#Usage|Belongs there.}}
| |
|
| |
| If you stumble across an icon which is in a format that is not supported by the freedesktop.org standard (like {{ic|gif}} or {{ic|ico}}), you can use the ''convert'' tool (which is part of the {{Pkg|imagemagick}} package) to convert it to a supported/recommended format, e.g.:
| |
|
| |
| $ convert <icon name>.gif <icon name>.png
| |
|
| |
| If you convert from a container format like {{ic|ico}}, you will get all images that were encapsulated in the {{ic|ico}} file in the form {{ic|<icon name>-<number>.png}}. If you want to know the size of the image, or the number of images in a container file like {{ic|ico}} you can use the ''identify'' tool (also part of the {{Pkg|imagemagick}} package):
| |
|
| |
| {{hc|$ identify /usr/share/vlc/vlc48x48.ico|
| |
| /usr/share/vlc/vlc48x48.ico[0] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb
| |
| /usr/share/vlc/vlc48x48.ico[1] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb
| |
| /usr/share/vlc/vlc48x48.ico[2] ICO 128x128 128x128+0+0 8-bit DirectClass 84.3kb
| |
| /usr/share/vlc/vlc48x48.ico[3] ICO 48x48 48x48+0+0 8-bit DirectClass 84.3kb
| |
| /usr/share/vlc/vlc48x48.ico[4] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb
| |
| /usr/share/vlc/vlc48x48.ico[5] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb
| |
| }}
| |
|
| |
| As you can see, the example ''ico'' file, although its name might suggest a single image of size 48x48, contains no less than 6 different sizes, of which one is even greater than 48x48, namely 128x128.
| |
|
| |
| Alternatively, you can use ''icotool'' (from {{Pkg|icoutils}}) to extract png images from ico container:
| |
| $ icotool -x <icon name>.ico
| |
|
| |
| For extracting images from .icns container, you can use ''icns2png'' (provided by {{Pkg|libicns}}):
| |
| $ icns2png -x <icon name>.icns
| |
|
| |
| === Obtaining icons ===
| |
|
| |
| Although packages that already ship with a ''.desktop'' file most certainly contain an icon or a set of icons, there is sometimes the case when a developer has not created a ''.desktop'' file, but may ship icons, nonetheless. So a good start is to look for icons in the source package.
| |
| You can i.e. first filter for the extension with '''find''' and then use '''grep''' to filter further for certain buzzwords like the package name, "icon", "logo", etc, if there are quite a lot of images in the source package.
| |
| $ find /path/to/source/package -regex ".*\.\(svg\|png\|xpm\|gif\|ico\)$"
| |
| If the developers of an application do not include icons in their source packages, the next step would be to search on their web sites.
| |
| Some projects, like i.e. {{AUR|tvbrowser}} have an [https://enwiki.tvbrowser.org/index.php/Banners,_Logos_and_other_Promotion_Material artwork/logo page] where additional icons may be found. If a project is multi-platform, there may be the case that even if the linux/unix package does not come with an icon, the Windows package might provide one. If the project uses a [[wikipedia:Version control system|Version control system]] like CVS/SVN/etc. and you have some experience with it, you also might consider browsing it for icons.
| |
| If everything fails, the project might simply have no icon/logo yet.
| |
|
| |
| === Icon path ===
| |
|
| |
| The [https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html freedesktop.org standard] specifies in which order and directories programs should look for icons:
| |
| # {{ic|$HOME/.icons}} (for backwards compatibility)
| |
| # {{ic|$XDG_DATA_DIRS/icons}}
| |
| # {{ic|/usr/share/pixmaps}}
| |
|
| |
| == Tools ==
| |
|
| |
| === Arronax ===
| |
|
| |
| {{AUR|arronax}} is a graphical program to create and modify desktop entries for applications and locations.
| |
|
| |
| === Alacarte ===
| |
|
| |
| {{Pkg|alacarte}} is a graphical menu editor for [[GNOME]] using the freedesktop.org menu specification. It also supports overriding desktop entries.
| |
|
| |
| === jdDesktopEntryEdit ===
| |
|
| |
| {{AUR|jddesktopentryedit}} is a graphical program using [[Qt]] to edit desktop entries.
| |
|
| |
| === gendesk ===
| |
|
| |
| {{Pkg|gendesk}} started as an Arch Linux-specific tool for generating .desktop files by fetching the needed information directly from PKGBUILD files. Now it is a general tool that takes command-line arguments.
| |
|
| |
| Icons can be automatically downloaded from [http://openiconlibrary.sourceforge.net/ openiconlibrary], if available. (The source for icons is configurable).
| |
|
| |
| ==== How to use ====
| |
|
| |
| * Add {{Ic|gendesk}} to makedepends
| |
|
| |
| * Start the {{Ic|prepare()}} function with:
| |
|
| |
| {{bc|gendesk --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}
| |
|
| |
| * Alternatively, if an icon is already provided ($pkgname.png, for instance). The {{Ic|-n}} flag is for not downloading an icon or using the default icon. Example:
| |
|
| |
| {{bc|gendesk -n --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}
| |
|
| |
| * {{Ic|$srcdir/$pkgname.desktop}} will be created and can be installed in the {{Ic|package()}} function with:
| |
|
| |
| {{bc|install -Dm644 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"}}
| |
|
| |
| * The icon can be installed with:
| |
|
| |
| {{bc|install -Dm644 "$pkgname.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"}}
| |
|
| |
| * Use {{Ic|1=--name='Program Name'}} for choosing a name for the menu entry.
| |
|
| |
| * Use {{Ic|1=--exec='/opt/some_app/elf --some-arg --other-arg'}} for setting the exec field.
| |
|
| |
| * See the [https://github.com/xyproto/gendesk gendesk project] for more information.
| |
|
| |
| === lsdesktopf ===
| |
|
| |
| {{AUR|lsdesktopf}} can list available ''.desktop'' files or search their contents.
| |
|
| |
| $ lsdesktopf
| |
| $ lsdesktopf --list
| |
| $ lsdesktopf --list gtk zh_TW,zh_CN,en_GB
| |
|
| |
| It can also perform MIME-type-related searches. See [[XDG MIME Applications#lsdesktopf]].
| |
|
| |
| === fbrokendesktop ===
| |
|
| |
| The {{AUR|fbrokendesktop}} Bash script detects broken {{ic|Exec}} values pointing to non-existent paths. Without any arguments it uses preset directories in the {{ic|DskPath}} array. It shows only broken ''.desktop'' with full path and filename that is missing.
| |
|
| |
| Examples
| |
|
| |
| $ fbrokendesktop
| |
| $ fbrokendesktop /usr
| |
| $ fbrokendesktop /usr/share/xsessions/icewm.desktop
| |
|
| |
| == Tips and tricks ==
| |
|
| |
| === Run a desktop file from a terminal ===
| |
|
| |
| If {{Pkg|gtk3}} is installed, run {{ic|gtk-launch ''application.desktop''}}.
| |
|
| |
| Or install the {{Pkg|dex}} package and run {{ic|dex ''/path/to/application.desktop''}}.
| |
|
| |
| === Modify desktop files ===
| |
|
| |
| For system-wide ''.desktop'' files (e.g. those installed from a package), first copy the relevant ''.desktop'' file (e.g. from {{ic|/usr/share/applications/}}) to {{ic|$XDG_DATA_HOME/applications/}} (e.g. {{ic|~/.local/share/applications/}}). This prevents your changes from being overwritten when the package gets updated during [[System maintenance#Upgrading the system|system upgrades]]. The local user-specific ''.desktop'' files should automatically take precedence over the system-wide files. Now you can modify the local user-specific ''.desktop'' file as needed.
| |
|
| |
| {{Note|If you have configured this application to autostart, there may already be a copy of the system desktop entry in {{ic|$XDG_CONFIG_HOME/autostart}}, as per [[XDG Autostart]]. If you want to modify the behavior only while autostarting, proceed to edit this file. Otherwise, if you want to modify the behavior in all circumstances, you should:
| |
| * Move the desktop file from {{ic|$XDG_CONFIG_HOME/autostart/}} to {{ic|$XDG_DATA_HOME/applications}}.
| |
| * Using {{ic|ls -l}}, make sure that this desktop entry is a regular file you can edit, and not a link to the system location. If it is a link, replace it with a copy of the original as described above.
| |
| * Make a symbolic link to the user application directory (default XDG dirs substituted for convenience):
| |
|
| |
| ln -s ~/.local/share/applications/''desktop_entry'' ~/.config/autostart/
| |
|
| |
| Now, the file in your application launcher will stay the same as the one that is autostarted.
| |
| }}
| |
|
| |
| ==== Modify environment variables ====
| |
|
| |
| To set [[environment variables]], in the ''.desktop'' file, edit the {{ic|1=Exec=}} line to first use the {{man|1|env}} command to set your variables. For example, with the original line commented out:
| |
|
| |
| {{hc|~/.local/share/applications/abiword.desktop|2=
| |
| ...
| |
| # Exec=abiword %U
| |
| Exec=env LANG=he_IL.UTF-8 abiword %U
| |
| ...
| |
| }}
| |
|
| |
| ==== Modify command line arguments ====
| |
|
| |
| To change or add the command line arguments, edit the {{ic|1=Exec=}} line to append the desired options. As an example, with the original line commented out:
| |
|
| |
| {{hc|~/.local/share/applications/steam.desktop|2=
| |
| ...
| |
| # Exec=/usr/bin/steam-runtime %U
| |
| Exec=/usr/bin/steam-runtime -no-browser %U
| |
| ...
| |
| }}
| |
|
| |
| ==== Hide desktop entries ====
| |
|
| |
| The visibility of the desktop entry can be controlled in multiple ways. See the [https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys Desktop Entry Specification] for more information. [[Add]] one of the following lines to your ''.desktop'' file:
| |
| * ''All'' desktop environments, choose one (or both) of the following:
| |
| ** Add the line {{ic|1=NoDisplay=true}} for applications that you do not want displayed in the menus.
| |
| ** Add the line {{ic|1=Hidden=true}} for applications that you consider deleted and do not want displayed in the menus.
| |
| * ''Specified'' desktop environments, choose one of the following where {{ic|''desktop_names''}} is a semicolon-delimited list of desktop environments (e.g. {{ic|GNOME}}, {{ic|GNOME;Xfce;KDE;}}):
| |
| ** Add the line {{ic|1=NotShowIn=''desktop_names''}} to ''hide'' the entry only in the specified desktop environments.
| |
| ** Add the line {{ic|1=OnlyShowIn=''desktop_names''}} to ''show'' the entry only in the specified desktop environments.
| |
|
| |
| == See also ==
| |
|
| |
| * [[Wikipedia:.desktop]]
| |
| * [https://freedesktop.org/wiki/Howto_desktop_files/ Information for developers]
| |
|
| |
|
| |
| [[Category:Freedesktop.org]]
| |
| [[Category:Configuration files]]
| |
| [[Category:Package development]]
| |