Speed up the Gnome Menu and Fix the Annoying Icon Delay

Recently I installed a copy of Ubuntu Feisty Fawn 7.04 on an older computer and I noticed that the Gnome menu was slow and the icons next to the menu items were taking a few seconds to load. At first I attributed this to the old slow computer. I later went home and booted up my new dual core system with 2gigs of RAM and noticed the same problem. At this point I knew that there was something wrong.

The first problem with the Gnome menu is that it loads the menu icons as needed causing a delay before you can see the icons. By default when you click the Gnome menu the icons are retrieved and loaded after the click (this is why there is a delay) and put in memory so they can be called later. Once the icons are in memory there will be no delay the next time you go to the same menu item. However, I think this is a bug since you should never see a delay in a menu system even if it is the first time you click on it. You can fix this problem by typing the following command as root.

gtk-update-icon-cache -f /usr/share/icons/THEMENAME/

Remember to replace the THEMENAME with the actual icon theme set you are using. The default is ‘gnome‘.

The second problem I find with the Gnome menu is that it as a built in delay before sub menus are generated when you hover over them with your mouse. Unlike the ‘bug’ I described before this one is actually a feature :). Many users don’t want the sub navigation menu popping out as they are moving their mouse down the list to their final destination. The only problem is the delay is too slow by default and I recommend speeding it up a bit. You can do that with the following command.

echo gtk-menu-popup-delay = 100 >> ~/.gtkrc-2.0

If this speeds up the menu too much or not enough you can modify the speed by opening up the file .gtkrc-2.0 in your home directory and change the ‘100′ to a smaller number (faster) or a larger number (slower). You can do this with your favorite text editor or Nano text editor if you don’t have a favorite :).

nano -w ~/.gtkrc-2.0

This tweak should work on all distributions of linux.

So far I have tested it on Ubuntu Feisty Fawn 7.04.

For another performance tweak you can also Turn Off Gnome Animations and Hide Window Contents While Dragging. This is especially useful for older machines or servers.



19 Responses to "Speed up the Gnome Menu and Fix the Annoying Icon Delay"
  1. Jade Robbins on September 17th, 2007

    Are there supposed to be php tags around those?

  2. Mark Sanborn on September 17th, 2007

    heh, of course not… I accidentally left them in there when I did the code tag for wordpress. Thanks for catching that.

  3. Jade Robbins on September 18th, 2007

    No problem. Had me a little confused there :D

  4. Dakkar on October 14th, 2007

    Hello, is there a way to know what Icon theme I’m using, I looked at the theme manager and my icon theme name is OSX but I don’t see any folder with that name under /usr/share/icons, could be in another location?

    Thanks in advance

  5. Don on October 14th, 2007

    awesome simple fix. another great reason open source excels while windows continually stumbles

  6. Mark Sanborn on October 15th, 2007

    Dakkar, It could be under /~/.icons That is where I store my personal themes I download. It is hard to say where you stored it. You can re-install it in System > Preferences > Theme. You can also specify the icon set in customize.

    If you are sure the theme name was OSX and you think the file name might have osx in it do a search with:

    updatedb
    slocate osx

    Hope this helps.

  7. John on October 24th, 2007

    Trying to do the icon cache thing.. It claims there is no theme index file when I point it to the folder where my icon set is located, yet there _is_ an index.theme file. Hmmmm…

  8. Mark Sanborn on October 24th, 2007

    John,

    That is interesting I have never gotten that error before are you sure you are typing in the correct path to the theme?

    Can you touch the index.theme file?

    Mark

  9. John on October 24th, 2007

    Hi, Thanks for the response.

    Pretty certain I have the correct path. What do you mean by touch the index.theme file?

    This is the error I get:

    No theme index file in ‘/home/John/.icons/leopard-icons/’.
    If you really want to create an icon cache here, use –ignore-theme-index.

  10. Mark Sanborn on October 24th, 2007

    Try,

    gtk-update-icon-cache -f -ignore-theme-index /home/John/.icons/leopard-icons/

    and see if that speeds up the menus. The touch command modifies the file modified date to current date. This command is useful in determining if the file is there and can be altered.

  11. John on October 24th, 2007

    Ok, so turns out I did have the incorrect path. Shouldn’t have capitalized the J in John. So I ran the correct command:

    gtk-update-icon-cache -f /home/john/.icons/leopard-icons/

    But I got this:

    The generated cache was invalid.

  12. Mark Sanborn on October 24th, 2007

    Yeah, you have to be careful in Linux everything is case sensitive. One tip I can give is use the tab key for completing file paths in the command line as it will not make mistakes.

    Try running:

    gtk-update-icon-cache -f /usr/share/icons/gnome/

    Just to make sure you can run the command. You may have an icon pack that is referencing files(icons) that aren’t there causing an invalid cache.

  13. John on October 24th, 2007

    Oh, now that you mention it, I did replace some icons myself awhile back, but I used the same file names as the old ones.

    You sure know your icons. ;)
    This command worked fine:

    gtk-update-icon-cache -f /usr/share/icons/gnome/

    Looks like it will be complicated to cache my altered leopard-icons set, since I did play around with them previously.

  14. Mark Sanborn on October 24th, 2007

    John,

    Yeah you may want to start with the original pack and make sure that all the files replaced are the exact same name. It can be kinda tricky making your own sets of icons. But on the other hand it can be rewarding having cool icons to look at. :)
    I guess you will have to decide to have a slow menu or take the time to make a custom icon pack that will cache.

    Glad I was able to steer in the right direction anyways. :)

  15. John on October 24th, 2007

    Thanks a ton!

  16. mael on December 5th, 2007

    thanks!

  17. GNUbie on December 24th, 2007

    Thanks for this tips! I’ve been bothered by this quite some time but always was to lazy to sort it out. Now I decided to do some googlin’ and here I am. Another satisfied customer! Merry Xmas to you Sir! Thanks again.

  18. Mark Sanborn on December 24th, 2007

    Merry Xmas to you too!

  19. Wesley Tanaka on February 19th, 2008

    Great tip. And it motivated me to figure out how to restore my missing menu icons too!

Leave a reply