Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
19
rated 0 times [  19] [ 0]  / answers: 1 / hits: 22259  / 2 Years ago, wed, may 25, 2022, 3:26:44

Possible Duplicate:

What is the syntax for .desktop files?

How do I add a custom launcher?






I prefer to create new desktop launchers (.desktop files) using just a text editor, for example to create an iotop launcher I write:



[Desktop Entry]
Name=iotop
Exec=gksudo "gnome-terminal -x iotop"
Type=Application


But I haven't found any documentation on the format. Can someone give me a link to the format specification?


More From » .desktop

 Answers
2

The .desktop file specification is here:
http://standards.freedesktop.org/desktop-entry-spec/latest/



An example .desktop file would be:



[Desktop Entry]
Version=1.0
Type=Application
Name=Foo Viewer
Comment=The best viewer for Foo objects available!
TryExec=fooview
Exec=fooview %F
Icon=fooview
MimeType=image/x-foo;
NotShowIn=KDE;


A .desktop file can have translations integrated, by specifying the language:



Name=Foo Viewer
Name[en_GB]=Foo Viewer
Name[el_GR]=Φου Βιούερ


If you want to add unity submenus to unity panel icon, then you can create a desktop file. An example from http://maketecheasier.com/8-really-useful-ubuntu-unity-quicklists/2011/05/07



First copy the original .desktop file and open it with your favourite text editor:



cp /usr/share/applications/firefox.desktop ~/.local/share/applications
gedit ~/.local/share/applications/firefox.desktop


Then edit the file:



[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
GenericName=Web Browser
Exec=firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;
StartupWMClass=Firefox
StartupNotify=true
X-Ayatana-Desktop-Shortcuts=NewWindow;Private;Safe;ProfileManager;MakeTechEasier

Name[en_US]=Firefox Web Browser

[NewWindow Shortcut Group]
Name=Open a New Window
Exec=firefox -new-window
TargetEnvironment=Unity

[Private Shortcut Group]
Name=Private Mode
Exec=firefox -private-toggle
TargetEnvironment=Unity

[Safe Shortcut Group]
Name=Safe Mode
Exec=firefox -safe-mode
TargetEnvironment=Unity

[ProfileManager Shortcut Group]
Name=Start Profile Manager
Exec=firefox -ProfileManager
TargetEnvironment=Unity


Now run nautilus ~/.local/share/applications/ and drag-and-drop your newly-created "Firefox" unity desktop file in the unity bar.


[#41305] Thursday, May 26, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
whipstder

Total Points: 189
Total Questions: 110
Total Answers: 99

Location: Uzbekistan
Member since Sat, Feb 27, 2021
3 Years ago
;