Weekend Project: Set Up a Fast and Lightweight Desktop with Fluxbox

1054

Would you like a faster computer this weekend? We can’t spot you the cash for a faster machine, but by embracing a faster and lighter desktop, you can enjoy a speedier computing experience on your Linux desktop. If you’re ready to soup up your system, dive in and give Fluxbox a shot.

As mentioned in the Five Best Alternative Window Managers for Linux article in January, Fluxbox is just one of many fantastic window managers you can choose from.

Getting Fluxbox: The Road Less Traveled

You shouldn’t have any trouble finding Fluxbox packages on a major Linux distribution, but you won’t find as many Fluxbox-based derivatives. Xfce and LXDE each have Fedora and Ubuntu spins, and you can choose LXDE and Xfce as options when installing openSUSE as well. Fluxbox? It’s the road less traveled.

For this tutorial, I decided to use a default Fedora 14 and started with the fluxbox, fbdesk, fluxconf, and alltray packages using the GUI for PackageKit. Note that this isn’t as minimal as you could get — if I wanted a really minimal system (as opposed to just a lighter desktop/window manager), I’d go with a minimal install of Fedora or just start with Debian.

Installing Fluxbox should add it to the GNOME Display Manager (GDM) chooser, so you can log into Fluxbox instead of GNOME. Log back in and you should see something similar to Figure 1. Pretty sparse, yes? You might be wondering, “how the heck do I launch an application?” Right-click on the desktop (there’s plenty of it) and you’ll see Fluxbox’s root menu. Here you can choose Run and open a dialog box to enter an application (like firefox) to run. Unlike GNOME or KDE, Fluxbox doesn’t come with a pre-populated menu of applications.

Editing the Root Menu

You can, however, edit the Root Menu to add applications. Here’s what you’re going to do. Run fluxbox-generate_menu. This will automagically add a number of applications to the Root Menu, but it doesn’t grab a full selection. The new menu is /home/user/.fluxbox/menu where user is your username (also expressed as ~/.fluxbox/menu.

The first thing we’re going to do is copy that to ~/.fluxbox/my-menu and change one line in the file ~/.fluxbox/init:

session.menuFile ~/.fluxbox/my-menu

Go to the Root Menu and look for Fluxbox menu -> Reload config. That will re-read your configuration so that Fluxbox will now use your configuration. Why do you do this? You don’t want an application (like fluxbox-generate_menu) to write over your customized menu.

Now, open ~/.fluxbox/my-menu in your favorite text editor. The syntax is fairly simple:


[begin] (Fluxbox)
[encoding] {UTF-8}
    [exec] (gnome-terminal) {gnome-terminal}
    [exec] (firefox) {firefox}
    [exec]  (Run) {fbrun}
[submenu] (Terminals)
    [exec] (gnome-terminal) {gnome-terminal}
[end]
...
[endencoding]
[end]

 

Each [exec] line tells Fluxbox that it’s going to have a menu entry to run a program. The string in parenthesis, like (firefox) is the text you’ll see in the menu. The string in curly braces ({firefox}) is the command name that will run.

Fluxbox Default Layout

The submenu syntax is what creates, you guessed it, submenus. I recommend creating a backup of the file and then editing it, and make sure you make a backup each time until you’re comfortable with the syntax.

Getting Used to Fluxbox

Let’s start with first things first. The default style for Fluxbox is functional, but homely. Go to the root menu and select Fluxbox -> System Styles and choose a style that you prefer.

Now let’s explore the dock a bit. Fluxbox’s dock is pretty simple, but it’s not inflexible. Click on the text that says Workspace and you’ll see a menu of options to configure the placement of the dock and its size. If you’re using a multihead setup (dual monitors, or more…) then you can also choose which “head” gets the dock. I have gotten accustomed to placing the GNOME menu at the top of the screen, and I also like to situate the Fluxbox dock at the top as well.

One thing that may be confusing is that some options (like Toolbar width) has a value that is adjusted by right or left-clicking. Left-clicking reduces the value, right-clicking increases.

Another nifty mouse trick — scrolling while you’re hovering the mouse over an empty spot on the desktop will switch through the workspaces. Fluxbox isn’t alone in this behavior, of course, but it’s a nice feature.

Speaking of middle buttons, let’s look at tabbing. Tabbing is a feature that you would almost never stumble on by accident. Use your middle button to click on a window and drag it to the title bar of another window. When you use the middle button on the title bar, it should just highlight that window’s titlebar. You’ll see an outline of the titlebar only. Drag it to the other window’s titlebar and then bingo, they’re tabbed together. Now you can switch back and forth between them using the tabs in the title bar.Fluxbox Modded

To separate the windows, click on the title bar of the window you want to remove (again using the middle button) and drag away.

You’ll also notice that the dock has two arrows on the right-hand side next to the clock. Clicking these will cycle through the applications that are open.

Fluxbox doesn’t have its own file manager, so you might want to add your own. I’d recommend emelFM2 or Thunar. You can use Nautilus as well, but you have to be careful in how you start it. Run nautilus --no-desktop --browser and Nautilus should behave itself. Otherwise, Nautilus takes over the management of the desktop itself too.

As mentioned in the Five Best article, GNOME has its default window manager — but you’re not locked in to it. You could use Fluxbox as GNOME’s window manager by running the following:

gnome-session-remove metacity fluxbox &

If you want to make it permanent (I’d recommend trying it for a while first) run gnome-session-properties and add fluxbox to the Startup Programs. You’ll need to use gnome-session-save as well. A big hat-tip to the Fluxbox Wiki for that info.

Extra Credit

If you really want to get into Fluxbox, you’ll want to check out how to configure the Apps-file and Keys-file. The apps-file controls exactly how applications will open. The size of the window, the workspace, etc. Very handy if you like to micro-manage your windowing environment.

The keys file lets you configure managing windows from the keyboard. This is deep overkill for a lot of users, but if you are a big fan of keeping your hands on the keyboard as much as possible (Vim users, are you listening?) then the keyboard shortcuts that Fluxbox enables are really interesting.

Spend the weekend with Fluxbox. Its apparent simplicity is deceptive. By spending some time tinkering with Fluxbox you’ll have a desktop that’s not only fast and light, but very powerful as well.