Thursday, October 07, 2004

Hacking the Fluxbox menu

As I've previously mentioned, my old Dell Latitude is running Slackware 10 setup to use the very lightweight Fluxbox window manager. I chose Fluxbox because it requires fewer system resources than KDE, Gnome, or even Afterstep. It therefore allows me to make the most of this old hardware.

There are a couple of ways to launch apps after you're in Slackware's Fluxbox setup. The first is to right-click on the desktop, which brings up a menu, while the second is to start the app from a terminal (although you start your first terminal from the menu). I wanted to add a couple of items to the menu so that I didn't have to type in a command to start them any time I wanted them to run. This is pretty easy.

My Fluxbox config file is /home/dave/.fluxbox/menu. It's a plain text file which starts off like:

[begin] (Fluxbox-0.1.14)
[exec] (rxvt) {rxvt}
[exec] (mozilla) {mozilla}

The first line is the beginning section of the menu (duh). The lines starting with "[exec]" are entries in that section for executable programs. The next item, in parentheses, is the text that appears in the menu. The final item, in brackets, is the command that will be run when you click on it. So, to add an entry for the gkrellm system monitor, I added:

[exec] (gkrellm) {gkrellm}

To add an app installed to a location not in my PATH, you'll need the full path to the executable, like this:

[exec] (thunderbird) {/opt/thunderbird/thunderbird}

One nice thing is that when you edit the "menu" file, changes take effect as soon as you save it. You don't need to restart X and have Fluxbox re-read the file.

No comments: