Sunday, October 17, 2010

Make an incredibly fast Linux Desktop with Fluxbox

There are a lot of Linuxers out there who make use of lightweight window managers due to the benefit of having a customized and lightning fast Desktop environment yielding productivity on a cheap machine. Fluxbox is this kind of window manager and has been r00tb0x's favorite for a long time.

This article will not cover a detailed installation of fluxbox as it is a fairly easy process if you have a decent package manager such as apt-get:

apt-get install fluxbox

After installation, reboot the machine and choose Fluxbox as your default window manager. If you have problems installing Fluxbox you can just visit the official website. Once you are inside Fluxbox you might get lost. So the following are configuration tips to maximize your environment:

Changing the background:
This task is not a right click on the desktop, select background, and save the settings. You would need to execute the following command from terminal:

fsetbg -f /path/to/wallpaper.jpg

Keyboard Shortcuts:
The default Fluxbox is not very usable. To launch an application you need to click on the desktop and select the application from a little context menu (TWM lookalike) which is very unpractical. However when you assign keyboard shortcuts, Fluxbox becomes an efficient monster. The ones defined by default are the F1 to F12 keys and are assigned to change the workspace. While switching workspace is a common task, there are other important shortcuts to define such as minimizing and closing windows and launching applications. All the key bindings are defined inside ~/.fluxbox/keys file. Note that Mod1 refers to 'alt' and Mod4 refers to the windows key.

As a tip, you can define most of shortcuts through the Mod4 key so they do not interfere with the inbuilt applications' shortcut keys. This is an extract of a configuration file which was used by one of the authors at r00tb0x, and which you can easily adapt to your desktop as you wish:

# locks X11 display to the current user
Mod4 l :ExecCommand xscreensaver-command --lock
# opens a number of programs with quickkeys. These are just examples, I am sure
# you get the point...
Mod4 f :ExecCommand firefox
Mod4 e :ExecCommand firefox <a href="" title=""></a>
Mod4 i :ExecCommand aterm -name aterm -sl 3000 -tr +sb -sr -sk -bg black -fg white -fade 90 -bl -tn xterm -fn -misc-fixed-medium-r-normal-*-*-120-*-*-c-*-iso8859
-15 -g 116x57 -e /usr/bin/irssi
Mod4 g :ExecCommand gaim
Mod4 u :ExecCommand amule
Mod4 m :ExecCommand gmplayer <a href="" title=""></a>
Mod4 v :ExecCommand vmware
Mod4 Print :ExecCommand gnome-screenshot
# This launches fbrun, which in turn launches other programs
Mod4 r :ExecCommand fbrun
# Program Control. It just makes life simpler...
Mod4 4 :Close
Mod4 q :Minimize
Mod4 w :Deiconify All OriginQuiet
# if you have aterm (emerge x11-terms/aterm), then this opens a really nice
# transparent aterm with no borders, fitting nicely with 1024x768
# resolution, while still leaving room for conky. Once again, feel free to
# modify.
Mod4 a :ExecCommand aterm -name aterm -sl 3000 -tr +sb -sr -sk -bg black -fg \
white -fade 90 -bl -tn xterm -fn \
-misc-fixed-medium-r-normal-*-*-120-*-*-c-*-iso8859-15 -g 116x57
# Fluxbox has no sound control, so we need to do a hack to get one
# Modify Sound
Mod4 F11 :ExecCommand aumix -v -3
Mod4 F12 :ExecCommand aumix -v +3
# Reconfigure Fluxbox
Control Mod4 Delete :Reconfigure

This is a very powerful configuration and will maximise your productivity - We guarantee you that with these shortcuts you will not use the mouse for a while, and it is only a little portion of what you can define in Fluxbox. Note that in the last part of the configuration we are also including the possibility of changing the sound volume through keyboard as well - you just need to install aumix, which is a command line mixer but takes arguments so volume is altered on the fly.
Startup Programs:
You might need to execute a bunch of commands when you start fluxbox, such as setting the desktop, or launching some scripts. You can make all these configurations inside the ~/.fluxbox/startup file. Just add entries to that file and next time you boot into fluxbox, they are executed on startup. This is an extract of our startup file:

# Define background:
fbsetbg -f /home/r00tb0x/wallpapers/43492-escher.jpg
# Applications you want to run with fluxbox.
fetchmail -d 60&

Save Window positions:
One of the most things I enjoy in fluxbox is the possibility to save window sizes, positions, and workspace locations. This is a feature which one cannot find in other environments such as Gnome or KDE. This is ideal if you want to launch certain applications in the same workspace so that your default workspace will not be cluttered. Again, this is another reason why Fluxbox increases your efficiency and productivity.

To save the window position, just right click on the window and select Save Window Position from the context menu.

One word of advise...Make yourself a favor a get used to Fluxbox for a couple of days before you give up and return to your old overbloated windows manager.
Post a Comment