§2023-03-30
¶Application entry
Desktop entries for applications, or .desktop files, are generally a combination of meta information resources and a shortcut of an application. These files usually reside in /usr/share/applications/ or /usr/local/share/applications/ for applications installed system-wide, or ~/.local/share/applications/ for user-specific applications. User entries take precedence over system entries.
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 freedesktop specification.
- modified as
$ diff /usr/share/applications/firefox.desktop /usr/share/applications/firefox.desktop.ori
115c115
< Exec=env GTK_IM_MODULE=fcitx5 /usr/lib/firefox/firefox %u
---
> Exec=/usr/lib/firefox/firefox %u
232c232
< Exec=env GTK_IM_MODULE=fcitx5 /usr/lib/firefox/firefox --new-window %u
---
> Exec=/usr/lib/firefox/firefox --new-window %u
340c340
< Exec=env GTK_IM_MODULE=fcitx5 /usr/lib/firefox/firefox --private-window %u
---
> Exec=/usr/lib/firefox/firefox --private-window %u
- original /usr/share/applications/firefox.desktop
[Desktop Entry]
Version=1.0
Name=Firefox
GenericName=Web Browser
...
GenericName[ja]=ウェブ・ブラウザ
...
GenericName[zh_CN]=网络浏览器
GenericName[zh_TW]=網路瀏覽器
Comment=Browse the World Wide Web
...
Comment[ja]=ウェブを閲覧します
...
Comment[zh_CN]=浏览互联网
Comment[zh_TW]=瀏覽網際網路
Keywords=Internet;WWW;Browser;Web;Explorer
....
Keywords[ja]=Internet;WWW;Web;インターネット;ブラウザ;ウェブ;エクスプローラ
....
Keywords[zh_CN]=Internet;WWW;Browser;Web;Explorer;网页;浏览;上网;火狐;Firefox;ff;互联网;网站;
Keywords[zh_TW]=Internet;WWW;Browser;Web;Explorer;網際網路;網路;瀏覽器;上網;網頁;火狐
Exec=/usr/lib/firefox/firefox %u
Icon=firefox
Terminal=false
X-MultipleArgs=false
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json;
StartupNotify=true
StartupWMClass=firefox
Categories=Network;WebBrowser;
Actions=new-window;new-private-window;
[Desktop Action new-window]
Name=New Window
...
Name[ja]=新しいウィンドウ
Name[ja_JP-mac]=新規ウインドウ
...
Name[zh_CN]=新建窗口
Name[zh_TW]=開新視窗
Exec=/usr/lib/firefox/firefox --new-window %u
[Desktop Action new-private-window]
Name=New Private Window
....
Name[ja]=新しいプライベートウィンドウ
Name[ja_JP-mac]=新規プライベートウインドウ
....
Name[zh_CN]=新建隐私浏览窗口
Name[zh_TW]=新增隱私視窗
Exec=/usr/lib/firefox/firefox --private-window %u