Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: HOWTO: Ubuntu Applications Menu: Add Missing Icons & Fix Broken Icons

  1. #1
    Join Date
    Jun 2005
    Location
    Clarksville, TN
    Beans
    304
    Distro
    Ubuntu 10.04 Lucid Lynx

    HOWTO: Ubuntu Applications Menu: Add Missing Icons & Fix Broken Icons

    This guide is written for Dapper Drake 6.06

    Note 1: This tutorial assumes that you've enabled the universe & multiverse repositories. If you haven't, the HOWTO for that is here.

    Note 2: With the exception of the follow-along examples, all menu entry files are accessed read-only.
    This is completely safe as the commands given for this do not use sudo, su, etc. The only other commands that use administrative privilege are the installation of the Debian menu & the Circus Linux game as part of the HOWTO.


    Purpose:
    -
    Install the Debian menu so all installed applications are accessible via Applications->Debian.
    - Adding missing entries and/or icons to Ubuntu's Applications menu.
    - Help with applications that won't launch from the menu icon.


    Blue text is informational and not required to “just get it done”. You will gain a better understanding of the what, where, & why if you read the blue text.

    I have spent a good bit of time customizing my Applications menu, mostly adding entries and icons for the Debian packages that only show in the Debian menu. I like the terminal just fine, it's saved my bacon more than a few times, but I also like a nice, clean uniform Applications menu to peruse. I think Ubuntu has done a great job with the menus for Ubuntu packages, but things can get a bit messy when you start adding Debian packages. Oh yeah, I like a LOT of the Debian packages, especially the games.




    A. Install the Debian menu to make all installed applications accessible via the Applications->Debian menu.

    I have the Debian menu installed, it will give us the info necessary to build the menu entries for our Ubuntu menu.

    Let's make sure you do too:
    Edit: Added suggestion by ryu kun from this post further down the thread.
    Code:
    sudo apt-get update
    sudo apt-get install menu menu-xdg
    update-menus
    Verify this after installation finishes by going to: Applications->Debian

    If you haven't installed any Debian packages, the Debian menu will still install properly, but may not be enabled. You can verify this in Alacarte by going to: Applications->Accessories->Alacarte and clicking Applications on the left, and it should be listed on the right. The Debian menu will become visible in the Applications menu when you install a Debian package from the repositories. Don't worry if you can't enable it yet, it'll be there when it's supposed to.




    B. Adding missing entries & icons to Ubuntu's Applications menu.

    I'm going to show you how to do this manually (without Alacarte), but if you know the path to the icon & executable binary (the application) as well as the command to run the application, then you can just as easily use the Alacarte Menu Editor. The reason I have given manual instructions first is that I will also show you how to find the above information if you don't know it.

    1. Let's start by identifying the directories that contain the menu entries we'll be working with. As background for noobs, the menu is constructed of a bunch of simple text files stored in the following designated directories.

    Ubuntu Applications menu entries are here:
    /usr/share/applications


    Debian Menu entries are here:
    /var/lib/menu-xdg/applications/menu-xdg


    Icons are found in these locations:
    /usr/share/pixmaps
    /usr/share/icons
    /usr/bin/name-of-app

    Most of these text files are less than 10 lines long and are easy to understand, although many of the menu entries that come pre-installed with Ubuntu have a large number of translations for the text in the Name & Comment fields which adds a significant number to the line count.

    The naming convention for .desktop files in the Ubuntu menu is: application-name.desktop so the menu entry for gaim would be a text file named gaim.desktop and would be found in: /usr/share/applications. Simple. Once you get the hang of it, you'll be able to guess the filename easily in most cases.

    The naming convention for .desktop files in the Debian menu is: X-Debian-Maincategory-Subcategory-app_name.desktop so the menu entry for gaim would be a text file named X-Debian-Apps-Net-gaim.desktop and would be found in: /var/lib/menu-xdg/applications/menu-xdg. This makes guessing the filename a good bit more difficult, so we'll need to enlist the aid of gedit to browse the Debian menu entry directory, more on this later.


    2. Let's take a look at the contents of the Ubuntu menu entry file. I've bolded the lines that are actually necessary for the English menu. For other languages, adjust as necessary.
    Open a terminal by going to: Applications->Accessories->Terminal, then do:

    Code:
    gedit /usr/share/applications/gaim.desktop
    Since this is a pre-installed package, we'll see lots of translations:

    [Desktop Entry]
    Encoding=UTF-8
    Categories=Application;Network;
    Exec=gaim
    Icon=gaim.png
    StartupNotify=true
    Terminal=false
    Type=Application
    Name=Gaim Internet Messenger

    Name[ca]=Missatger d'Internet Gaim
    Name[cs]=Gaim Internet Messenger
    Name[da]=Gaim - internet beskeder
    Name[de]=Gaim Internet Messenger
    Name[es]=Gaim - cliente de mensajería de Internet
    Name[fr]=Gaim Messagerie Internet
    Name[hu]=Gaim azonnali üzenetküldő
    Name[it]=Gaim Internet Messenger
    Name[ja]=Gaim
    インターネット・メッセンジャー
    Name[ko]=게임 메신저
    Name[nb]=Gaim lynmeldingsklient
    Name[nl]=Gaim - Expresberichten
    Name[pl]=Komunikator Internetowy Gaim
    Name[pt_BR]=Mensageiro via Internet Gaim
    Name[pt]=Mensageiro Internet Gaim
    Name[ro]=Mesagerul Gaim
    Name[ru]=Gaim - клиент обмена мгновенными сообщениями
    Name[sl]=Gaim - spletni sel
    Name[sq]=Lajmësjellësi Internet Gaim
    Name[sv]=Gaim Internet Messenger
    Name[zh_CN]=Gaim 互联网通讯程序
    Name[zh_TW]=Gaim 網路即時通
    GenericName=Internet Messenger
    GenericName[ca]=Missatger d'Internet
    GenericName[cs]=Internet Messenger
    GenericName[da]=Internet beskeder
    GenericName[de]=Internet Messenger
    GenericName[es]=Cliente de mensajería de Internet
    GenericName[fr]=Messagerie internet
    GenericName[hu]=Azonnali üzenetküldő
    GenericName[it]=Internet Messenger
    GenericName[ja]=インターネット・メッセンジャー
    GenericName[ko]=메신저
    GenericName[nb]=Lynmeldingsklient
    GenericName[nl]=Expresberichten
    GenericName[pl]=Komunikator Internetowy
    GenericName[pt_BR]=Mensageiro via Internet
    GenericName[pt]=Mensageiro Internet
    GenericName[ro]=Client de mesagerie
    GenericName[ru]=Клиент обмена мгновенными сообщениями
    GenericName[sl]=Spletni sel
    GenericName[sq]=Lajmësjellës Internet
    GenericName[sv]=Meddelandeklient
    GenericName[zh_CN]=互联网通讯程序
    GenericName[zh_TW]=網路即時通
    Comment=Send instant messages over multiple protocols
    Comment[ca]=Envieu missatges instantanis en múltiples protocols
    Comment[cs]=Posílat instant message různými protokoly
    Comment[da]=Send beskeder over flere protokoller
    Comment[de]=Multi-Protokoll Instant Messenger Client
    Comment[es]=Cliente de mensajería instantánea multiprotocolo
    Comment[fr]=Envoie des messages instantanés en utilisant divers protocoles
    Comment[hu]=Azonnali üzenetküldés többféle protokoll használatával
    Comment[it]=Client multiprotocollo per messaggi immediati
    Comment[ja]=複数のプロトコルを介してインスタント・メッセージを送信しますComment[ko]=다중 프로토콜 메신저
    Comment[nb]=Send lynmeldinger over flere protokoller
    Comment[nl]=Multi-protocol programma voor expresberichten
    Comment[pl]=Komunikator internetowy obsługujący kilka protokołów
    Comment[pt_BR]=Mande mensagens instantâneas por múltiplos protocolos
    Comment[pt]=Envie mensagens instantâneas sobre vários protocolos
    Comment[ro]=Trimiteţi mesaje instant în orice reţea
    Comment[ru]=Обмен мгновенными сообщениями с использованием множества протоколов
    Comment[sl]=Pošiljajte neposredna sporočila prek različnih protokolovs
    Comment[sq]=Dërgoni mesazhe të atypëratyshëm protokollesh të ndryshëm
    Comment[sv]=Sänder snabbmeddelande över mĺnga protokoll
    Comment[zh_CN]=通过多种协议发送即时消息
    Comment[zh_TW]=透過多種通訊協定發送即時訊息
    X-Ubuntu-Gettext-Domain=gaim
    If we strip the extra languages off the file, we get this (closer to what you'll see on Debian menu entries):

    Code:
    [Desktop Entry]
    Encoding=UTF-8
    Categories=Application;Network;
    Exec=gaim
    Icon=gaim.png
    StartupNotify=true
    Terminal=false
    Type=Application
    Name=Gaim Internet Messenger
    GenericName=Internet Messenger
    Comment=Send instant messages over multiple protocols
    X-Ubuntu-Gettext-Domain=gaim
    3. Next, let's look at the contents of the Debian menu entry file.
    Open a terminal and do:
    Code:
    gedit /var/lib/menu-xdg/applications/menu-xdg/X-Debian-Apps-Net-gaim.desktop
    As you can see, the Debian menu entry has a hideous filename, but the contents are very simple & straightforward.

    Code:
    [Desktop Entry]
    Type=Application
    Encoding=UTF-8
    Name=Gaim
    GenericName=
    Comment=Multi-protocol Instant Messaging Client
    Icon=/usr/share/pixmaps/gaim-menu.xpm
    Exec=/usr/bin/gaim
    Terminal=false
    Categories=X-Debian-Apps-Net
    4. Now, let's install the game Circus Linux. This will provide us with an opportunity to create a menu entry for the Ubuntu menu.

    To install Circus Linux open a terminal & do:
    Code:
    sudo apt-get install circuslinux
    Verify that it installed correctly by going to Applications->Debian->Games->Arcade->Circus Linux. Also note that it does not appear in Applications->Games.

    5. Open gedit (without sudo) from the Applications->Accessories menu or do:
    Code:
    gedit
    and browse to: /var/lib/menu-xdg/applications/menu-xdg. In this folder you'll see the .desktop files, but they will show with whatever name is in the "NAME=Application Name Here" section of the file, not the actual filename.

    Here is a screenshot of what you will see in both of the folders with the .desktop files.


    This is not very intuitive at first, but when you create & then save a new menu entry file, you must name it like: app-name.desktop even though that isn't the name you'll see if you open the parent directory (/usr/share/applications) after creating the entry.

    Here is a screenshot of the gedit save dialog as it comes up. You MUST change the filename here or the entry will not appear in the Applications menu.


    Here is a screenshot of the gedit save dialog as it should look after you change the filename appropriately.


    If you forget to name the file appropriately such as: (app-name.desktop or application.desktop), it won't appear in Ubuntu's Applications menu. Dashes & underscores are ok but NO spaces in the filename.

    6. The Debian menu entry for Circus Linux is an example of a menu entry with just the minimal information. To look at it, do:
    Code:
    gedit /var/lib/menu-xdg/applications/menu-xdg/X-Debian-Games-Arcade-circus_linux.desktop
    It's contents look like this:
    Code:
    [Desktop Entry]
    Type=Application
    Encoding=UTF-8
    Name=Circus Linux
    GenericName=
    Comment=Circus Linux!
    Icon=/usr/share/pixmaps/circuslinux-icon.xpm
    Exec=/usr/games/circuslinux --fullscreen
    Terminal=false
    Categories=X-Debian-Games-Arcade
    7. We can simply create a new file called circuslinux.desktop in /usr/share/applications:
    Code:
    sudo gedit /usr/share/applications/circuslinux.desktop
    and then copy & paste the contents of the above file into the empty file we just created.

    8. Then we have to alter the Categories line to match the Ubuntu Applications menu. To find out what should go there, we look at an existing Ubuntu Applications menu entry from the category we want our new entry to go in. A good choice would be Same GNOME. To see the contents of this file do:
    Code:
    gedit /usr/share/applications/same-gnome.desktop
    and scroll down until you see the Categories line. You can just copy the Categories line and paste it onto the end of your new circuslinux.desktop file and delete the old Categories line. It should now look like this:
    Code:
    [Desktop Entry]
    Type=Application
    Encoding=UTF-8
    Name=Circus Linux
    GenericName=
    Comment=Circus Linux!
    Icon=/usr/share/pixmaps/circuslinux-icon.xpm
    Exec=/usr/games/circuslinux --fullscreen
    Terminal=false
    Categories=GNOME;GTK;Game;LogicGame;
    9. Save the file and then you should have a Circus Linux entry complete with icon in Applications->Games.




    C. If you have a menu entry that just doesn't have an icon:
    This segment is from my post in this thread.

    1. Open Application->Accesories->Alacarte Menu Editor
    2. Click on the category you want the icons in.
    3. File->New Entry
    4. Fill in the lines appropriately.

    Example:

    Name: Rosegarden
    Comment: Whatever-you-want-here
    Command: rosegarden
    Icon: Location-of-icon-file-here

    Hint: look in /usr/share/pixmaps, /usr/share/icons & /usr/bin/name-of-app for the icon that goes with the app in question.

    If you don't find it there, you can google for a suitable icon image.

    For example:
    To find an icon for Rosegarden:
    1. Go to google images, enter "rose" or whatever you need. Then choose the image that best suits your needs. I would use the blue rose image here because it has a simple, clear picture with a solid white background. Note that personal, non-commercial use of images grabbed off the net is probably OK, but distribution of these images could be a violation of copyright law. You're on your own with this.

    2. I would then right click on the image and select "Save Image As..." then I'd clean up the filename from "rose_blueLt1_small.jpg" to something simpler like "rose.jpg" and save to the Desktop.

    3. Next, I open the image in GIMP.

    4. Once in GIMP, I click Image->Scale Image then I enter 64 in the dimension (Width or Height) that is the largest and hit enter. This should automatically scale the smaller dimension to the new size which is proportionally smaller than the new size of the larger dimension. Then click "Scale".

    5. Next click File->Save as... click "Select File Type (By Extension)" and choose "X PixMap image" from the list and click save, then close GIMP.

    6. Open a terminal Applications->Accesories->Terminal and enter:
    Code:
    sudo cp ~/Desktop/rose.xpm /usr/share/pixmaps
    7.Then open up Alacarte Menu Editor again, and select the category on the left you put Rosegarden into, then double click the rosegarden entry on the right when the list appears.

    8. Click the Icon box and when the dialog box opens, be sure you're in /usr/share/pixmaps, if not, browse there with the Browse button on the top right. once in /usr/share/pixmaps Click on the rose.png icon, then click "OK", the icon should now be visible on the rosegarden entry. Click close on the rosegarden entry.

    9. You should now see the icon with the rosegarden entry in Alacarte. Then click close on Alacarte. Check your menu, if you see the entry, but no icon, then do the following in Terminal:
    Code:
    killall gnome-panel
    to refresh the menu.



    D. If you have an application which has an icon in the Ubuntu Applications menu, but only opens from the command line:


    1. Open up Alacarte and verify that the menu entry has the appropriate command to run the application. Verify by opening a Terminal and entering the command listed.


    2. Try setting the program to “Run in Terminal”. Some apps need to be opened this way. You can do this by going to Applications->Accesories->Alacarte, select any Category on the left and double-click any entry on the right. In the config dialog that appears, the checkbox just to the right of the icon is what we're after here. You can also do this by entering:
    Code:
    sudo gedit /usr/share/applications/name-of-app.desktop
    in the terminal, and changing the line
    Code:
    Terminal=false
    to
    Code:
    Terminal=true
    or vice-versa. This is from my post in this thread.


    3. Verify that the binary has the proper permissions. This was suggested by ardchoille here. The full thread can be found here.


    For even more menu customization, use the link below to see kassetra's guide, which works hand-in-hand with this guide.
    HOWTO: Create & populate Sub-Menus in the Applications Menu


    Sorry for the extra-long post.

    Feedback, suggestions and constructive comments are welcome. As usual, this is probably a work in progress.


    This is my first HOWTO, so go easy on me.

    Greenstar
    Last edited by greenstar; September 17th, 2006 at 12:42 AM. Reason: Typo

  2. #2
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Beans
    163
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Ubuntu Applications Menu: Add Missing Icons & Fix Broken Icons

    Quote Originally Posted by greenstar View Post
    C. If you have a menu entry that just doesn't have an icon:
    This segment is from my post in this thread.

    1. Open Application->Accesories->Alacarte Menu Editor
    2. Click on the category you want the icons in.
    3. File->New Entry
    4. Fill in the lines appropriately.

    etc...
    ...and then file a bug on Launchpad for the appropriate package.
    I love this smiley!

  3. #3
    Join Date
    Jun 2006
    Location
    /Earth/Asia/Vietnam
    Beans
    211
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOWTO: Ubuntu Applications Menu: Add Missing Icons & Fix Broken Icons

    Thanks for the well-structured HOWTO, greenstar
    .:.:.[)[@[)|2.:.:.
    "Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side-effect." -- Linus Torvald.

  4. #4
    Join Date
    Oct 2005
    Location
    dinerty@dinerty-wireless:
    Beans
    493
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: Ubuntu Applications Menu: Add Missing Icons & Fix Broken Icons

    What a brilliant guide, came in handy when my annoying aMSN icon would not delete from menu.

    God I love having a terminal for jobs like this

  5. #5
    Join Date
    Apr 2006
    Beans
    267
    Distro
    Kubuntu 7.04 Feisty Fawn

    Re: HOWTO: Ubuntu Applications Menu: Add Missing Icons & Fix Broken Icons

    Thank you greenstar. The guide is great. I was having a horrible time using the graphical ala carte menu editor. I had menu entries I didn't want that wouldn't go away and other entries that wouldn't show up no matter what I did. Thanks for showing me the easy way to edit these. Great for a first HowTo as well.

  6. #6
    Join Date
    Sep 2006
    Beans
    23

    Exclamation Re: HOWTO: Ubuntu Applications Menu: Add Missing Icons & Fix Broken Icons

    I did the "sudo apt-get install menu" with no errors.

    However, when I try to look at this file, it doesn't exist, and won't allow me to create it:

    gedit /var/lib/menu-xdg/applications/menu-xdg/X-Debian-Apps-Net-gaim.desktop

    This just opens an empty file with no contents. I've tried pasting in what it says the contents SHOULD be, but when I try to save and exit in gedit I get "Unexpected error: File not found"

    When I try the same using vi, I get
    "/var/lib/menu-xdg/applications/menu-xdg/X-Debian-Apps-Net-gaim.desktop" E212: Can't open file for writing
    Hit ENTER or type command to continue

    I've spent hours fighting just to be able to run stuff I've installed but cannot find. Any tips would be appreciated.

  7. #7
    Join Date
    May 2005
    Location
    Istanbul
    Beans
    262
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: HOWTO: Ubuntu Applications Menu: Add Missing Icons & Fix Broken Icons

    Quote Originally Posted by BadDolphin View Post
    I did the "sudo apt-get install menu" with no errors.

    However, when I try to look at this file, it doesn't exist, and won't allow me to create it:

    gedit /var/lib/menu-xdg/applications/menu-xdg/X-Debian-Apps-Net-gaim.desktop

    This just opens an empty file with no contents. I've tried pasting in what it says the contents SHOULD be, but when I try to save and exit in gedit I get "Unexpected error: File not found"

    When I try the same using vi, I get
    "/var/lib/menu-xdg/applications/menu-xdg/X-Debian-Apps-Net-gaim.desktop" E212: Can't open file for writing
    Hit ENTER or type command to continue

    I've spent hours fighting just to be able to run stuff I've installed but cannot find. Any tips would be appreciated.

    Please run this code:

    Code:
    sudo apt-get update
    sudo apt-get install menu menu-xdg
    update-menus

  8. #8
    Join Date
    Jun 2005
    Location
    Clarksville, TN
    Beans
    304
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Ubuntu Applications Menu: Add Missing Icons & Fix Broken Icons

    Thanks for the feedback, everyone. I'm glad this HowTo has been helpful. Also, I've incorporated ryu kun's suggestions into the guide regarding installation of the Debian menu. Thanks ryu kun, I credited your contribution in the edit note.

    Greenstar

  9. #9
    Join Date
    May 2007
    Beans
    21

    Re: HOWTO: Ubuntu Applications Menu

    I have the same problem as BadDolphin above. I've installed menu and menu-xdg, and ran update-menus. The verbose option says it found 140 entries, but /var/lib/menu-xdg still doesn't exist.
    I run Feisty, BTW.
    Any suggestions?

    Thanx, GreenStar, for a great HOWTO. I just wish I can get it to work...
    Last edited by sailor.nir; July 3rd, 2007 at 06:02 PM.

  10. #10
    Join Date
    Jun 2005
    Location
    Clarksville, TN
    Beans
    304
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Ubuntu Applications Menu

    Quote Originally Posted by sailor.nir View Post
    I have the same problem as BadDolphin above. I've installed menu and menu-xdg, and ran update-menus. The verbose option says it found 140 entries, but /var/lib/menu-xdg still doesn't exist.
    I run Feisty, BTW.
    Any suggestions?

    Thanx, GreenStar, for a great HOWTO. I just wish I can get it to work...
    1) Places->Search for Files...

    2) In the Search for Files... dialog:
    a)Name contains: gaim
    b)Look in folder: Click the list arrows on the right, select / or filesystem, if neither are present, choose other, then click the paper with pencil in top left of Browse dialog and enter / in the address box that opens and click open.

    3) Click find in Search for Files...

    4) The result should show you the files you need to make a menu entry work properly or build a new one from scratch. Example: gaim.desktop, gaim.png, gaim.svg, etc.

    5) I have no idea where your menu-xdg is located. Search for it as described above, it works great for me. Matter of fact, the search tool helped me figure out much of the information in the how-to. My search for menu-xdg gave no results on a fresh edgy install, but I've installed almost nothing yet.

    6) Beyond this I don't know.

    Greenstar

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •