Customizing the Gnome panel menubar in Debian

By ALLurGroceries

This is probably for advanced users, proceed at your own risk. It might also apply to Debian-derived distros like Ubuntu, Mint, etc. No guarantees though.

The goal of this article is to allow you to personalize your Gnome menu. Here's mine, for example:

Changing the name of the menus requires a locale translation file and changing the icon uses update-alternatives.

Changing the menu text

Open your favorite text editor and paste this in:
msgid ""
msgstr ""
"Project-Id-Version: gnome-panel trunk\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-05-26 00:59+0000\n"
"PO-Revision-Date: 2008-05-26 00:59+0000\n"
"Last-Translator: PUT YOUR NAME HERE IF YOU WANT\n"
"Language-Team: None\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Launchpad-Export-Date: 2008-04-16 01:47+0000\n"
"X-Generator: Launchpad (build Unknown)\n"

msgid "Applications"
msgstr "YOUR NAME FOR APPS"

msgid "Places"
msgstr "YOUR NAME FOR PLACES"

msgid "System"
msgstr "YOUR NAME FOR SYSTEM"
Change the menus to your liking, and save it somewhere, say ~/custommenu.so. Then convert it to the necessary binary format:
msgfmt ~/custommenu.so
The above command will produce custommenu.mo.

For the next part, you must know which locale you are using. This should be en_US for users in the USA, en_GB for the UK, etc. To find out for sure, you can run:

echo $LANG
This will return en_US.UTF8 for example. The part before the period is what matters. If this doesn't work for some reason, just run the locale command to find out your locale.

OPTIONAL: If you are NOT using en_US, you may want to back up your existing locale's menu first in case you want to undo this. Replace en_US with your locale below, and if you are on Sid it's just locale instead of locale-langpack:

sudo cp /usr/share/locale-langpack/en_US/LC_MESSAGES/gnome-panel-2.0.mo /usr/share/locale-langpack/en_US/LC_MESSAGES/gnome-panel-2.0.mo.orig

Move the file into place. If you are using Debian Lenny, the command is:

sudo cp ~/custommenu.mo /usr/share/locale-langpack/en_US/LC_MESSAGES/gnome-panel-2.0.mo
For Debian Sid (and maybe testing?) as of 1/2010, use:
sudo cp ~/custommenu.mo /usr/share/locale/en_US/LC_MESSAGES/gnome-panel-2.0.mo
Finally, reload gnome-panel and you should see your custom menu text:
pkill gnome-panel

Changing the menu icon

First, find or create a 22x22px .PNG or any SVG of a reasonable filesize. You probaly want it to have a transparent background. Now move it somewhere logical, say /usr/share/pixmaps/ if you are feeling lazy:
sudo cp customicon.png /usr/share/pixmaps

The icon is managed by the Debian alternatives system, so it must first be installed there. In this example I'm using customicon.png in /usr/share/pixmaps as my custom icon. The 99 at the end should safely give it the highest priority over any other alternatives.

NOTE: Use the following for gnome-icon-theme versions 2.28.0-1 or earlier (to find your installed version run: apt-cache show gnome-icon-theme )

sudo update-alternatives --install /usr/share/icons/gnome/scalable/places/start-here.svg start-here.svg /usr/share/pixmaps/customicon.png 99
You should be able to see the updated alternative by running:
update-alternatives --display start-here.svg

Next, force an update of the icon cache, since we have just changed the icon set:

sudo gtk-update-icon-cache --force /usr/share/icons/gnome
Finally, reload gnome-panel, and your icon should appear!
pkill gnome-panel
If for some reason you want to change it back, run:
sudo update-alternatives --config start-here.svg
If you mess things up terribly, you can reset it to fresh settings with:
sudo update-alternatives --remove-all start-here.svg
sudo update-alternatives --remove-all start-here-32.png
sudo apt-get --reinstall install gnome-icon-theme