fluxboxAdding Fluxbox menu icons is easy.  Icons are usually not included in menu entries out of the box, but support for them usually is.  In this post, i’ll outline three simple steps required for adding icons to your Fluxbox menu.  OK, let’s get at it.

Image Type Support

The first thing you’ll need to do is determine what image type(s) your installation of Fluxbox supports.  From a terminal, type fluxbox -i, and direct your attention to the Compiled options section towards the end of the output.

Compiled options (- => disabled):

You’ll see more options than are listed above, but the two above are the what you’re looking for.  If the option is preceded by a dash (e.g., IMLIB2 vs. IMLIB2), then it was disabled when your installation of Fluxbox was compiled and it is not available.

If the IMLIB2 option is enabled, then you’ll be able to use most common image types for your icons (png, jpg, etc.).  If only the XPM option is enabled, you’ll be limited to .xpm files.  If neither are enabled, you’re out of luck.  That is a rare situation though.

The Icons Themselves

The actual icons are simply little image files.  The files may be of any type that is supported.  I use a variety of images pulled from different places on my system and some i make myself.  You may wish to gather them together into a common directory, e.g., ~/.fluxbox/MyIcons, but it’s not required.

Fluxbox will automatically scale down images to fit them in your menu.  At some point, Fluxbox will no longer scale your larger images. I’m not sure where this cut-off is, but it’s pretty large, so it’s unlikely that you will experience a problem.  The size to which images are scaled is determined by the style (theme) you are using.  (Here are instructions for editing that propery of a theme.)

The menu File

To display an icon for a particular menu item, you simply need to make an edit to that item’s entry in the menu file (~/.fluxbox/menu). The standard menu entry syntax is:

[tag] (label) {command} <icon>

The lines below are an example of a menu entry before and after adding an icon.

[exec] (Quest for Glory II) {QfG.sh}
[exec] (Quest for Glory II) {QfG.sh} <~/.fluxbox/MyIcons/qfg2.xpm>

And that’s all there is to it.  And by the way, you don’t need to reload your Fluxbox configuration after making any changes.  Your changes will take effect as soon as you save the menu file.

Further Reading


Fluxbox Faqs

Editing the menu