How can I edit/create new launcher items in Unity by hand?
Solution 1
For 11.04 and earlier:
Unity does support custom launchers from .desktop files. To create custom launcher from a .desktop
file you need to create a *.desktop
file for your program.
gedit ~/.local/share/applications/name.desktop
The .desktop
file should look something like this:
[Desktop Entry]
Name=the name you want shown
Comment=
Exec=command to run
Icon=icon name
Terminal=false
Type=Application
StartupNotify=true
In your file manager open your home folder and navigate to:
(You may need to press ctrl+h to show hidden files to see the .gconf
directory.)
.gconf-> desktop-> unity-> launcher -> favourites
you'll see a bunch of folders starting with "app-
".
you need to create a folder for your program. Use the same name.desktop you used in /usr/share/applications
. Go into 1 of the folders for something that is already on the dock & copy the xml file and paste that into your new folder. Open it with your text editor and change the name of the *.desktop
to your name.desktop
.
Open gconf-editor (you can open gconf by running the command gconf-editor
in the Terminal) & go to:
desktop-> unity-> launcher -> favorites
Double click the list on the right & add your name.desktop
.
Log out & back in and you should see your launcher. (thank you kerry_s on the Ubuntu Forums for helping with this answer)
Unity also has a feature called Lenses. By default, you have two in Unity: Applications and Files. In the future, you will be able to install and create a lot more. There is some info about that on the Ubuntu wiki: https://wiki.ubuntu.com/Unity/Lenses
Solution 2
Updated: 2015-Dec
For Ubuntu 15.10 or 14.04 LTS (11.10 or later, with Unity (3D))
NOTE: This can replace the function of an existing icon, or (once created) can be searched for (from Dash icon) to add to current button-bar.
First make your OWN copy of any of the .desktop files you want to modify. It is MUCH safer, and then you can always delete and start over.
(list all files)
ls /usr/share/applications/*.desktop
Example: Mozilla Firefox, firefox.desktop
(do this once, or after deleting any failed attempt)
cp /usr/share/applications/firefox.desktop ~/.local/share/applications
Then carefully change any wording, or add additional options.
(edit the file)
gedit ~/.local/share/applications/firefox.desktop &
Note: The ampersand '&' releases the command line immediately.
My own 'firefox.desktop' file:
[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
Name[es]=Navegador web Firefox
Name[fr]=Navigateur Web Firefox
Name[it]=Firefox Browser Web
Name[nl]=Firefox webbrowser
Comment=Browse the World Wide Web
Comment[de]=Im Internet surfen
Comment[es]=Navegue por la web
Comment[fr]=Naviguer sur le Web
Comment[it]=Esplora il web
Comment[nl]=Verken het internet
GenericName=Web Browser
GenericName[es]=Navegador web
GenericName[fr]=Navigateur Web
GenericName[it]=Browser web
GenericName[nl]=Webbrowser
Keywords=Internet;WWW;Browser;Web;Explorer
Keywords[de]=Internet;WWW;Browser;Web;Explorer;Webseite;Site;surfen;online;browsen
Keywords[es]=Explorador;Internet;WWW
Keywords[fr]=Internet;WWW;Browser;Web;Explorer;Fureteur;Surfer;Navigateur
Keywords[it]=Internet;WWW;Browser;Web;Navigatore
Keywords[nl]=Internet;WWW;Browser;Web;Explorer;Verkenner;Website;Surfen;Online
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/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;application/x-xpinstall;
StartupNotify=true
Actions=NewWindow;NewPrivateWindow;NewSafeMode;ProfileManager;
[Desktop Action NewWindow]
Name=Open a New Window
Name[de]=Ein neues Fenster öffnen
Name[es]=Abrir una ventana nueva
Name[fr]=Ouvrir une nouvelle fenêtre
Name[it]=Apri una nuova finestra
Name[nl]=Nieuw venster openen
Exec=firefox -new-window
OnlyShowIn=Unity;
[Desktop Action NewPrivateWindow]
Name=Open a New Private Window
Name[de]=Ein neues privates Fenster öffnen
Name[es]=Abrir una ventana privada nueva
Name[fr]=Ouvrir une nouvelle fenêtre de navigation privée
Name[it]=Apri una nuova finestra anonima
Exec=firefox --private-window
OnlyShowIn=Unity;
[Desktop Action NewSafeMode]
Name=Open in Safe Mode
Exec=firefox --safe-mode
OnlyShowIn=Unity;
[Desktop Action ProfileManager]
Name=Open Profile Manager
Exec=firefox --ProfileManager
OnlyShowIn=Unity;
My own 'libreoffice-startcenter.desktop' file:
[Desktop Entry]
Version=1.0
Terminal=false
Icon=libreoffice-main
Type=Application
Categories=Office;
Exec=libreoffice %U
# MimeType=application/vnd.openofficeorg.extension;
MimeType=application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-template;application/vnd.oasis.opendocument.text-web;application/vnd.oasis.opendocument.text-master;application/vnd.sun.xml.writer;application/vnd.sun.xml.writer.template;application/vnd.sun.xml.writer.global;application/vnd.stardivision.writer;application/msword;application/vnd.ms-word;application/x-doc;application/rtf;text/rtf;application/vnd.wordperfect;application/wordperfect;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-word.document.macroenabled.12;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.template.macroenabled.12;application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.opendocument.spreadsheet-template;application/vnd.sun.xml.calc;application/vnd.sun.xml.calc.template;application/vnd.stardivision.calc;application/vnd.stardivision.chart;application/msexcel;application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.ms-excel.sheet.macroenabled.12;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.template.macroenabled.12;application/vnd.ms-excel.sheet.binary.macroenabled.12;text/csv;application/x-dbf;application/vnd.oasis.opendocument.graphics;application/vnd.oasis.opendocument.graphics-template;application/vnd.sun.xml.draw;application/vnd.sun.xml.draw.template;application/vnd.stardivision.draw;application/vnd.oasis.opendocument.presentation;application/vnd.oasis.opendocument.presentation-template;application/vnd.sun.xml.impress;application/vnd.sun.xml.impress.template;application/vnd.stardivision.impress;application/mspowerpoint;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.ms-powerpoint.presentation.macroenabled.12;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.ms-powerpoint.template.macroenabled.12;application/vnd.oasis.opendocument.formula;application/vnd.sun.xml.math;application/vnd.stardivision.math;
Name=LibreOffice
Name[pt_BR]=BrOffice
GenericName=Office
GenericName[de]=Büroanwendungen
GenericName[en]=Office
GenericName[es]=Oficina
GenericName[fr]=Bureautique
GenericName[it]=Office
Comment=The office productivity suite compatible to the open and standardized ODF document format. Supported by The Document Foundation.
Comment[de]=Die zum offenen und standardisierten ODF-Format kompatible Sammlung von Büroanwendungen. Unterstützt durch »The Document Foundation«.
Comment[en]=The office productivity suite compatible to the open and standardized ODF document format. Supported by The Document Foundation.
Comment[es]=Suite de productividad para la oficina compatible con ODF, el formato de documentos abierto y estandarizado. Con el soporte de la Document Foundation.
Comment[fr]=Suite bureautique compatible avec le format de document standard et ouvert ODF. Soutenue par The Document Foundation.
Comment[it]=La suite di produttività compatibile con il formato standard e aperto dei documenti ODF. Supportata dalla The Document Foundation.
X-Ayatana-Desktop-Shortcuts=Writer;Calc;Draw;Impress;Math;
[Writer Shortcut Group]
Name=Writer
Exec=libreoffice --writer %U
TargetEnvironment=Unity
[Calc Shortcut Group]
Name=Calc
Exec=libreoffice -calc %U
TargetEnvironment=Unity
[Draw Shortcut Group]
Name=Draw
Exec=libreoffice -draw %U
TargetEnvironment=Unity
[Impress Shortcut Group]
Name=Impress
Exec=libreoffice -impress %U
TargetEnvironment=Unity
[Math Shortcut Group]
Name=Math
Exec=libreoffice -math %U
TargetEnvironment=Unity
A multi-tool icon 'toolbox.desktop' file:
[Desktop Entry]
Name=Ubuntu Toolbox
Comment=System Settings
Exec=unity-control-center --overview
Icon=redhat-tools
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;System;
OnlyShowIn=Unity;
Keywords=Preferences;Settings;
X-Ubuntu-Gettext-Domain=unity-control-center
X-Ayatana-Desktop-Shortcuts=GnomeTerminal;SoftwareCenter;SoftwareUpdates;
[GnomeTerminal Shortcut Group]
Name=Gnome Terminal
Exec=gnome-terminal
TargetEnvironment=Unity
[SoftwareCenter Shortcut Group]
Name=Ubuntu Software Center
Exec=software-center
TargetEnvironment=Unity
[SoftwareUpdates Shortcut Group]
Name=Update Manager
Exec=update-manager -c
TargetEnvironment=Unity
Here are some of my earlier efforts.
Solution 3
For 11.10 and newer:
You can still create the Launcher on the Desktop by using the old GUI dialog.
Using ALT+F2
type:
gnome-desktop-item-edit --create-new ~/Desktop
(Capital D)
This will start the dialog( Create launcher):
You can put this .desktop
file in any folder, and then drag and drop to the launcher.
Note: The package gnome-desktop-item-edit
must be installed first, so if you have gnome-panel
installed, then it is installed automatically.
Solution 4
For 11.04 and earlier:
This is a method without editing config files and without root privileges.
First create the Launcher on the Desktop (only temporary)
- right click your desktop
- select
Create Launcher...
- create the custom Launcher as you want to.
Now you got the launcher on the Desktop. If you are satisfied with it, get it in the Launcher Panel:
Open your Home Folder. Press
Ctrl + H
to show hidden files if necessary.Browse to
.local/share/applications
Drag and drop your Launcher from Desktop to that folder.
Now drag and drop your launcher from
.local/share/applications
to the Launcher Bar on the left on your Screen.You can now delete your custom Launcher on the Desktop if it's still there.
That's it.
Solution 5
I see many complex answers here. This solution is, I think, simple.
- (First install the package
alacarte
, if you don't have it. This is the menu editor that was installed by default before 11.10. Obviously you only have to do this once.) - Start "Main Menu" by searching for it in the dash.
- Add an item for your application and close the editor.
- Start the application by searching for it in the dash.
- Right-click on the icon and "Keep in launcher"
In Oneiric, you may also need to install the package gnome-panel
, which alacarte
should, but does not, depend on. See:
https://bugs.launchpad.net/ubuntu/+source/alacarte/+bug/826049
Related videos on Youtube
Ike
Updated on September 17, 2022Comments
-
Ike over 1 year
Will Unity allow making custom launcher icons from
.desktop
files or via menu editing system? (Right now the launcher doesn't give the option to "keep in launcher" on all programs.For some programs I use, I have to make custom launchers or
.desktop
files.For instance, daily blender builds are generally just folders with an executable.
In basic Gnome or KDE, I can make a new menu entry with the menu editing system. Then, I can also add it to Docky either from the menu or by dragging a
.desktop
file to it. Unity launcher doesn't support drag and drop, so thats not a bug or anything, but when I open a.desktop
file, it has unpredictable results. Most time it will not have "keep in launcher". Sometime it will have a pinnable item without the.desktop
's icon, and if I pin the item to the launcher, it will not call upon the program again after closing it. I've also gotten it to just work with a.desktop
file forceltx
.-
Anatoly Mironov almost 13 yearsIf your Ubuntu has non-English locale, the custom icon may not work in the Unity Dash (but it works perfectly on the Desktop). Before drag-n-drop to the Unity Dash, edit your desktop file (e.g. with
gedit
) and remove the row with localized icon, in my caseIcon[sv_SE]=gnome-panel-launcher
and leave the other "Icon=" row. -
Dan Dascalescu almost 9 yearsIt's ridiculous how difficult it is to create a shortcut to an app. If Windows can make is so easy, why can't Ubuntu?
-
魔大农 over 8 yearsHave a look at Xubuntu: Xfce has very elegant support for this through the menu editor. Launchers can subsequently be added to the desktop through a context menu.
-
-
Jorge Castro about 13 yearsYou can just copy it to ~/.local/share/applications so you don't need to mess with the sudo.
-
Bazon about 13 years@Jorge: Yes, that works too. But is browsing to a hidden directory more easy? I'll type this alternative when I got time.
-
Bazon about 13 yearsby the way: Dragging from Desktop to Launcher directly works also, but only if you don't delete the Launcher on the Desktop.
-
Bazon about 13 yearsa further test showed you can move the launcher from Desktop to anywhere , it's only important that you don't delete the launcher (*.desktop file) afterwards, the symbol in the launcher bar seems to be a link to the other launcher in the file system.
-
krumpelstiltskin about 13 yearsThere no longer appears (in 11.04) to be the path "desktop-> unity-> launcher -> favorites" in the gconf-editor.
-
JannieT about 13 yearsIt seems like you don't have to put the launcher in .local/share/applications folder before you drag and drop it on the launcher. You can store it in any folder.
-
Paul Lindner about 13 yearsThanks. That made it easy. Now I have to figure out how to change the icon (emblem?).
-
tobi about 13 years@ John K: In the "creater launcher" dialogue in the beginning you can set an icon by clicking on the default icon in the top left of that window.
-
Ubuntuser about 13 yearsmy default launchers bar is empty
-
Lode almost 13 yearsThe answer below from Bazon has a way that works for 11.04 and is way easier.
-
b. e. hollenbeck over 12 yearsThis doesn't work for all applications, particularly those that you install from source. I've tried pinning Netbeans 7.0 to the Unity bar in every way possible, before making my own .desktop file.
-
fitojb over 12 years@aendruk See rationale for that removal on GNOME’s Bugzilla.
-
JMC over 12 yearsIcons can be rearranged by clicking and holding the icon for few seconds.
-
dumb906 over 12 yearsif your method is used, the application would not fall under any category.
-
Bart van Heukelom over 12 years@dumb906 What do you mean? You can put the launcher in whatever category in the menu you want. Unless you mean something else by "category"?
-
Stefano over 12 years@aendruk: you can still open the "Create launcher window" with: gnome-desktop-item-edit --create-new <name of the desktop file>
-
Georgii Ivankin over 12 years@aendruk to use the gnome-desktop-item-edit make sure you have gnome-panel package installed
-
gregghz over 12 yearsThis is by far the simplest solution.
-
nickf over 12 yearsWhen I do this, it shows up like you say, but I can't actually launch the application. It just sits there with a pulsing glow as if it is launching, but it never does.
-
copolii over 12 yearsHow on earth does this answer have less up-votes than the others? This is the FASTEST, SIMPLEST, MOST CORRECT answer!
-
stivlo over 12 yearsFor Ubuntu this is an usability failure (a lot of other things are great, but here it falls short). The option to add a new application manually should be in the dash menu or in dash / more apps. @copolii this answer has less votes because was given many months after the original question. It works, I've also +1
-
Luis Alvarado about 12 yearsThanks THIS is the solution I was looking for. The option should again be added in Ubuntu since this affects things from Wine apps in the Desktop, to customized scripts and programs that need parameters.
-
LnxSlck about 12 yearsThis is the one that worked for me in Ubuntu 12.04
-
Ubuntuser over 11 yearsdoesnt work for 12.04
-
Alexis Wilke over 11 yearsThat was the correct folder for me too! I guess when you upgrade from 11.04 or other older versions. Maybe they could have moved that folder to the new location instead of just creating a new folder... Thank you for adding this comment.
-
Andree over 11 yearsThe link to desktop file specification page is very useful. Thanks.
-
albfan over 11 yearsalacarte, as good as always. Simple and effective.
-
wberry about 11 yearsI had to
sudo apt-get install gnome-panel
first. -
That Brazilian Guy over 10 yearsWhat if there are no
.desktop
files? That's the case fot Sublime Text 2, for example. -
That Brazilian Guy over 10 yearsDoesn't work for me in 12.04.2
-
That Brazilian Guy over 10 yearsWorks for me in 12.4.2, but I had to install
gnome-panel
-
Bryce over 10 yearsIt's buggy in 12.04 see and vote at bugs.launchpad.net/ubuntu/+source/alacarte/+bug/1079953
-
Bevor over 10 yearsTested with creating a launcher for manual Eclipse installation on 12.04.3. Works perfect.
-
laconbass over 10 yearsWorks perfect on 13.10
-
rubo77 almost 10 yearsThis doesn't seem to work any more on 14.04
-
rubo77 almost 10 yearsThis works fine in Ubuntu 14.04; And if you want to add an icon to that Launcher, you have to select one with a total path, for example from
/usr/share/icons/
(otherwise the icon will not be shown in the launcher) -
Cory almost 10 yearsOnce you've copied and made the change, how do you actually get the new icon into the dash sidebar?
-
david6 almost 10 yearsJust drag from
~/.local/share/applications
to dash sidebar. Open 'Nautilus/Files'; View > Show Hidden Files; navigate from '.local' > '.local/share' > ''.local/share/applications'; drag .desktop file .. -
mchid over 9 yearsworks fine for creating one on 14.10
-
guettli over 9 yearsThis answer solves it. But I ask myself: Why is this answer needed? I think unity should support this in a way which does not need an explanation. A more easy solution would look like this: right click, choose "Add" ...
-
user68023 about 9 years@guettli It's unbelievable, isn't it! Guess it's part of the "we hate end user customisation" which means you can't move the panel to the bottom of the screen, barely change the launcher behaviour, move the close/minimize etc icons to the right of the windows etc.
-
trappedIntoCode about 9 yearsThis should be the accepted answer!
-
It's Willem almost 9 yearsWhat if I want to create a launcher for a Python script?
-
It's Willem almost 9 years@LnxSlck Me too! +1 to Bruno for this amazing answer! Upvotes abound!
-
It's Willem almost 9 yearsDid not work for me in Ubuntu 12.04.5 LTS...
-
laconbass over 8 yearsAnd works like a charm in 14.04 too
-
魔大农 over 8 yearsBy far the best answer I've found. Also it's the only one that's easier than installing Xubuntu.
-
estibordo about 8 yearsDesktop files can also be in
/usr/local/share/applications
. -
david6 about 8 yearsTo clarify: The files in
/usr/local/share
are the launcher scripts created during application install. (as above) I recommend copying these to.local/share
BEFORE attempting any further customisation. -
Dan Dascalescu almost 8 yearsDoesn't work in 16.04 - the menu item does't get saved.
-
Dan Dascalescu almost 8 yearsDoesn't work in Ubuntu 16.04. It reads the menus correctly, but trying to create a new menu item fails silently - the item just isn't saved.
-
Dan Dascalescu over 7 yearsAgree with @Alex: it's incredible how pigheaded Canonical is about their decisions. Check comment #2 on this gem.
-
Dan Dascalescu over 7 yearsWorks in Ubuntu 16.04.1, but you should edit the .desktop files it create and further edit the Name and Icon properties.
-
MWB over 7 years@david6 the "dragging" should have been part of the answer instead of comments. Anyhow, I'm sad to report that Ubuntu seems to have removed this functionality in 14.04. Following an update, custom *desktop can still be dragged to the launcher, but they just don't show up :-(
-
Machtyn over 6 yearsThis worked for me in 16.04.
-
XavierStuvw over 6 yearsWorked with 14.04. If you move the icon to the launcher, however, and then delete the parent icon on the desktop (for cosmetics), the icon on the launcher will disappear too.
-
Paulo Henrique almost 6 yearsWork for me on Ubuntu 18.04. Thanks
-
Diego over 5 yearsThis works for Ubuntu 18.04 as of now. Instead of dragging and dropping to the Launcher Bar you can find the launcher icon and then "add to Favorites".
-
rubo77 about 4 yearsMaybe you have to add a line
Path=/tmp/
so it works in Ubuntu 19.10 too. note, you cannot double click on the icon in nautilus, but you can search for it in dash and then right-click on it to add it to favorites