Linux

Think inside the box with Blackbox

If you're tired of your Linux desktop taking up all your system resources, there's a simple and amazingly fast answer...Blackbox! Jack Wallen, Jr. explains how to install, configure, and use this tiny Linux window manager.

Got the KDE or GNOME blues? Tired of desktop environments with huge overhead? If you're using Linux, there are more choices out there than you probably realize!

One such choice is Blackbox, a simple, yet full-featured, window manager for the Linux X Windows System environment. It runs, screaming-for-vengeance fast, on a minimum of hardware. If you don’t think you would like Blackbox, you’ve got another thing coming! Rob Halford would like Blackbox. You will, too.

In this Daily Feature, I'm going to hit you with an introduction on compiling Blackbox, a bit of configuration, and a little usage.

A hit of installation
Installing Blackbox really couldn't be easier! We'll be doing this from source, of course. Download the latest, stable version (as of this writing it is 0.61.1) and put it into a directory, such as /tmp.

After you have the new file downloaded to the /tmp directory, su to root and run the following commands:
cd /tmp
tar xvzf blackbox-0.61.1.tar.gz
cd blackbox-0.61.1
./configure
make
make install


Once you've run these commands, Blackbox is installed and ready to go. Unlike the .rpm version (or a preinstalled version), installing from source puts the main directories in /usr/local/share/, as opposed to /usr/share/.

To set your system up to run Blackbox, open your favorite editor (as a regular user) and create the file .xinitrc with the following contents:
exec blackbox

The next time you run the startx command, Blackbox will be ready to go!

The configuration smackdown
Configuring Blackbox is easy! No, it does not have a simple click-and-point GUI tool, but with a combination of menu clicks and quick ASCII text file edits, you can configure your Blackbox session to your heart’s content.

The first thing we are going to look at is the main desktop menu. Click the right mouse button anywhere on the desktop to access the desktop menu. This is a bit of a switch, since most of us are used to the left mouse button being the primary source of power.

The Blackbox menu configuration is simple. There are two routes you can take: global configuration or local configuration. We'll stick with local configuration because that way you don't run the risk of totally hosing your system. To take advantage of a local configuration-type system, you are going to have to pull off a few simple tricks. The first trick is to create the directory ~/.blackbox, as the target user. The next trick is to copy the global menu into the newly created directory. This feat is done (as root) with this command.

Now, still as root, run the command
chown USERNAME /home/USERNAME/.blackbox/menu

and you're getting close.

USERNAME
Don't forget to replace USERNAME with the actual name of the target user!

Once the file has been copied (and given the correct permissions), create a .blackboxrc file (as the regular user) in your user’s home directory (if it's not already there). This new file will start out with only one entry:
session.menuFile:       /home/USERNAME/.blackbox/menu

Now you are ready to edit the /home/USERNAME/.blackbox/menu file for local (and not global) configurations.

The menu
The Blackbox mouse menu is read from the menu file we copied a moment ago. The entries are incredibly simple and have the following syntax:
[exec]     (Name_to_be_seen_in_menu)    {command}

For instance, if you were going to set a menu entry to run the Evolution groupware application, your menu entry might look like this:
[exec]     (Evolution)    {evolution}

Pretty simple, eh? But where do you put it? It can't be that simple, can it? Well, yes and no. You will want to categorize your applications, etc. Let's say you want both the Networking and the Office categories. Within the Networking category, you want to have Evolution, Opera, Konqueror, Gftp, and Pan. Within the Office category, you want Applixware, StarOffice, Gnumeric, AbiWord, and VMware. Your menu configuration file will look something like this.

So the menu configuration seems fairly straightforward, eh? If we take a look at the Office submenu, we see something like Figure A.

Figure A
The Office submenu holds all our Office application needs.


Styles and feels
From the mouse menu, you will see a number of look-and-feel configurations. The first submenu is Styles. From the Styles submenu, you can choose the way you want your mouse menu, title bars, and toolbar to look. The style you see shown (both highlighted and running) in Figure B is a slightly modified Artwiz style.

Figure B
Selecting a different style is just a matter of clicking a different menu entry.


Within the Configuration mouse submenu, you will see a number of options (see Figure C):
  • ·        Focus Model: Controls how individual windows are focused. For your focus model, you have three choices: Click To Focus (windows focus when they are clicked on), Sloppy Focus (windows focus when the mouse moves into them), or Auto Raise (when the mouse moves into the window, the window automatically comes to the top).
  • ·        Window Placement: Controls how individual windows are placed when they are open
  • ·        Image Dithering: Smooths out the colors
  • ·        Opaque Window Moving: With this option selected, you will actually see the window move as you drag it around (as opposed to a wire frame).
  • ·        Full Maximization: With this option selected, maximizing a window will cover the entire screen (even covering the toolbar).
  • ·        Focus New Windows: When a new window (or application) is opened, it will immediately be focused.
  • ·        Focus Window On Workspace Change: Use this option with Click To Focus; when you move to a new workspace, whichever window last had focus will not have its focus taken away by the workspace change.

Figure C
The Configuration submenu contains nearly all configuration options you'll need to make Blackbox your friend.


Beyond the right-click mouse menu, there are two other menus that you will want to get to know. If you click the middle mouse button (or the right and left button together), you will see the Workspaces menu. Remember that Linux has the ability to take advantage of more than one desktop. In this menu, you have the following options:
  • ·        New Workspace: Add another workspace to your desktop.
  • ·        Remove Last: Remove the last added workspace. Depending on whether or not you've added workspaces, you will see them listed in this menu as well.
  • ·        Icons: Whatever you have iconified will be listed here. Click on any entry, and it will de-iconify.

You will see the last menu when you right-click the title bar of a window. This menu is used to apply certain actions on that particular window. The possible actions are:
  • ·        Send To: You can zap the window to a different workspace.
  • ·        Shade: You can draw the window up into the title bar so that only the title bar is showing. (You can activate this same action by double-clicking the titlebar.)
  • ·        Iconify: This option hides the window altogether. The only way to get the window back is to go through the middle mouse menu and navigate through the Icons submenu.
  • ·        Maximize: Maximize the window.
  • ·        Raise: Bring the window in front of all other windows.
  • ·        Lower: Lower the window behind all other windows.
  • ·        Stick: The window will always appear in the current workspace.
  • ·        Kill Client: Kill the application running within a window.
  • ·        Close: Close the window.

Walloped with usage
Using the Blackbox window manager is incredibly simple, efficient, and quite enjoyable! One aspect I've not discussed so far is the toolbar. The Blackbox toolbar is a thin bar that rests in one of six locations (Top Right, Top Center, Top Left, Bottom Left, Bottom Center, Bottom Right). The toolbar consists of three separate sections. The leftmost section indicates which workspace you are currently working in. Next to that section are two small arrows that allow you to move back and forth between workspaces. The center section indicates which window you are currently working in. To the right of the center are two more arrows that allow you to cycle through your open windows (a la [Alt][Tab]). Finally, the far right houses the date and time.

Of course, if you right-click on the toolbar, you will be presented with yet another mouse menu, with the following entries:
  • ·        Placement: Where do you want your toolbar today?
  • ·        Always On Top: Make sure the toolbar is never hidden behind a window.
  • ·        Auto Hide: When not in use, the toolbar will slide out of the way.
  • ·        Edit Current Workspace Name: Change the name of the current working workspace. (The default will be Workspace 1, Workspace 2, etc.)

One thing you might find a bit frustrating is that after you've spent all this time creating new workspaces and you exit the window manager, the workspaces are all gone. To prevent this, click the Reconfigure entry in the main mouse window after you add or change a workspace. This will save the changes you've made and when you restart, the changes will stick!

I typically run Blackbox with two workspaces: Networking and Work. I tend to keep all networking applications together and all productivity applications together. To name these spaces, right-click the toolbar, select Edit Current Workspace Name, enter the desired text, and press [Enter]. The new name will appear in the leftmost pane in the toolbar.

Conclusion
I'd like to say that Blackbox is for pretty much anyone, but truth be told, it's not. It's an outstanding GUI that runs with lightning speed but lacks most of the features that a lot of users have grown accustomed to. If you are not one of those users who depend on icons, task bars, bells and whistles, and you just want a GUI that can be gorgeous but light, check out Blackbox!

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

1 comments
Tim Legg
Tim Legg

It's really annoying when the command to copy a global config file to a local one is a dead link.  How hard could it have been to make this article one line longer?  archive.org don't even have that page.