Speed up the Gnome Menu and Fix the Annoying Icon Delay
by Mark Sanborn on September 17, 2007
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.
20 comments
Are there supposed to be php tags around those?
by Jade Robbins on September 17, 2007 at 12:49 pm #
heh, of course not… I accidentally left them in there when I did the code tag for wordpress. Thanks for catching that.
by Mark Sanborn on September 17, 2007 at 12:56 pm #
No problem. Had me a little confused there
by Jade Robbins on September 18, 2007 at 10:01 pm #
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
by Dakkar on October 14, 2007 at 9:15 pm #
awesome simple fix. another great reason open source excels while windows continually stumbles
by Don on October 14, 2007 at 9:55 pm #
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.
by Mark Sanborn on October 15, 2007 at 8:20 am #
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…
by John on October 24, 2007 at 2:25 pm #
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
by Mark Sanborn on October 24, 2007 at 2:38 pm #
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.
by John on October 24, 2007 at 3:02 pm #
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.
by Mark Sanborn on October 24, 2007 at 3:11 pm #
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.
by John on October 24, 2007 at 3:26 pm #
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.
by Mark Sanborn on October 24, 2007 at 3:43 pm #
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.
by John on October 24, 2007 at 3:49 pm #
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.
by Mark Sanborn on October 24, 2007 at 3:57 pm #
Thanks a ton!
by John on October 24, 2007 at 4:09 pm #
thanks!
by mael on December 5, 2007 at 10:10 am #
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.
by GNUbie on December 24, 2007 at 3:41 am #
Merry Xmas to you too!
by Mark Sanborn on December 24, 2007 at 12:36 pm #
Great tip. And it motivated me to figure out how to restore my missing menu icons too!
by Wesley Tanaka on February 19, 2008 at 2:29 am #
To update all icons:
for d in /usr/share/icons/*; do gtk-update-icon-cache -f $d; done
With sudo:
for d in /usr/share/icons/*; do sudo gtk-update-icon-cache -f $d; done
Another option:
for d in /home/gareth/.icons/*; do gtk-update-icon-cache -f $d; done
Obviously “gareth” has to be replaced with your own username. And sudo should be added if needed.
I stole the code from the comments on this page:
http://hughsient.livejournal.com/12033.html
by gareth on July 30, 2008 at 6:57 am #