Fluxbox

Revision 8 as of 2005-12-02 20:48:43

Clear message

Ubuntu Fluxbox Howto

(This page is very much under construction)

What is Fluxbox?

[http://www.fluxbox.org Fluxbox] is a lightweight and responsive window manager for GNU/Linux. It is not as elaborate as GNOME or KDE, but it uses considerably fewer system resources. This makes it uniquely suited for situations where system resources, especially RAM, are very limited.

Fluxbox is rather minimalistic in its default configuration. Fortunately, it is easily customized and reconfigured by editing text files.

Why use Fluxbox?

As mentioned above, Fluxbox runs very happily on very few system resources. As such, it is ideal for use on older hardware. (For this reason, it is the default window-manager of the very aptly named [http://www.damnsmalllinux.org DamnSmallLinux] distribution). Moreover, it is fast and clean, and makes for a very efficient working environment.

STEP ONE: Installing Fluxbox

N.B.: Although the following assumes you already have Ubuntu installed, and are working from within GNOME, the steps shown are for installing Fluxbox using apt from the command line.

This is the easy part. Fluxbox is in the universe repositories. Enable the universe repositories, either in Synaptic or by uncommenting them in your /etc/apt/sources.list file, open a terminal, and execute

$ sudo apt-get install fluxbox

Restarting the Xsession with CTRL + ALT + BACKSPACE would bring up GDM, and Fluxbox would then appear on the sessions menu. However, I would NOT restart the Xsession at this point.

Why not? For some reason, the Fluxbox packages in Ubuntu's universe repositories create non-standard (at least for Fluxbox) xsession files, which means the ~/.fluxbox/startup configuration file is not automatically generated the first time Fluxbox runs.

(For a more complete discussion of what the ~/.fluxbox/startup file does, please see [http://gentoo-wiki.com/HOWTO_Fluxbox#Startup_Applications This page in the Gentoo Wiki])

Before we run Fluxbox, we must correct this oversight.

In a terminal, execute

$ sudo nano /usr/share/xsessions/fluxbox.desktop

When you see the following text:

exec=fluxbox

replace that line with

exec=startfluxbox

Once you have finished editing /usr/share/xsessions/fluxbox.desktop , restart the X server and log into fluxbox.

STEP TWO: Customization!

"Contributed by ChrisPeterman"

Okay I'll admit, the base Fluxbox install is quite bare. You only have a little taskbar/systray/clock combo at the bottom and the very cool right click menu. But how the heck to you start doing stuff? You've heard that Fluxbox is very customizable right? Well, here comes the meat and potatoes of it. Be very familier with the terminal because you will be using it a lot for this one to do various things. Also be familier with your favorite text editor, because all of Fluxbox's fun configuration is controlled by text files in ~/.fluxbox. Oh and unless I tell you, you don't need sudo for anything because we are working in our home directory.

The first file up is ~/.fluxbox/menu. This file controls the right click menu. Very simple syntax really. Note that if you are installing Fluxbox from a normal Ubuntu/Kubuntu/Xubuntu install (ie, you already have a Window Manager), then all your apps are in the menu already and your menu file will look something like this

[begin] (fluxbox)
[include] (/etc/X11/fluxbox/fluxbox-menu)
[end]

Or at least it SHOULD. The first and last lines define the beginning and end of the menu file, so everything goes between them. That include thing pulls in the file generated in /etc/fluxbox. Its generated by the Debian Menu package (sudo apt-get install menu) and if thats installed before Fluxbox is, it will automagically be put in the menufile. Case in point, on my laptop I did a barebones install and installed Fluxbox before the menu package and it didn't show up (but is in the same place in /etc) but on my desktop (which has run GNOME, XFCE, and now Flux in the same install) the menu package was around long before Flux was and thus the include is there. No biggie if it isn't, you'll see how to make your own now!

So the basic syntax for an executable (normal program entry) is thus

[exec] (Name you want to show up in the menu) {command} <path to icon>

The exec says this is an executable entry. The () is the name you want to show up in the menu. Now command is what you'd type in the terminal to run this. Its also practice to use the absolute path. How do you find this? With the which command

kyral@NebulaPeace:~$ which gaim
/usr/bin/gaim

Works for any command (almost...)

If there is an icon to go along with it, then put that in the <>, but its optional. Oh this all goes on one line and ends with a newline (basically hit return)

Now what about submenus? Right now any exec entry is going to be in the main menu. Its easy really

[submenu]  (Name of submenu) {}
stuff like execs and other submenus
[end]

Again submenu tells it that you are making a submenu, the name is in (). The {} is just a null command and is included by convention. You can put anything you want in the submenu, just when you are done defining it close it out with the end.

Now thats the basics about the Menu. Fluxbox generated all the config stuff for itself when it was installed, so its already there and you don't have to worry about it. Oh yes, you CAN have duplicate menu entries.

Here is the menu file from my laptop

[begin] (Fluxbox) {}
   [exec] (Gaim) {/usr/bin/gaim}
   [exec] (Firefox) {/usr/bin/firefox}
   [exec] (Irssi) { x-terminal-emulator -T "irssi-text" -e /usr/bin/irssi-text}
   [exec] (Bash) { x-terminal-emulator -T "Bash" -e /bin/bash --login}
   [exec] (BMP) {/usr/bin/beep-media-player}
   [exec] (VLC) {/usr/bin/vlc}
   [exec] (F-Spot) {/usr/bin/f-spot}
   [exec] (Acrobat Reader) {/usr/bin/acroread}
   [submenu] (Apps) {}
        [submenu] (Editors) {}
            [exec] (Emacs) {/usr/bin/emacs21}
            [exec] (Nano) { x-terminal-emulator -T "Nano" -e /bin/nano}
        [end]
        [submenu] (Net) {}

            [exec] (Telnet) { x-terminal-emulator -T "Telnet" -e /usr/bin/telnet}
            [exec] (w3m) { x-terminal-emulator -T "w3m" -e /usr/bin/w3m /usr/share/doc/w3m/MANUAL.html}
        [end]
        [submenu] (Programming) {}
            [exec] (Python) { x-terminal-emulator -T "Python (v2.4)" -e /usr/bin/python2.4}
        [end]
        [submenu] (Shells) {}

            [exec] (Dash) { x-terminal-emulator -T "Dash" -e /bin/dash -i}
            [exec] (Sh) { x-terminal-emulator -T "Sh" -e /bin/sh --login}
        [end]
        [submenu] (System) {}
            [exec] (gkrellm) { /usr/bin/gkrellm }
            [submenu] (Admin) {}
                [exec] (alsaconf) { x-terminal-emulator -T "alsaconf" -e /usr/sbin/su-to-root -p root -c /usr/sbin/alsaconf}
                [exec] (pppconfig) { x-terminal-emulator -T "pppconfig" -e /usr/sbin/su-to-root -p root -c /usr/sbin/pppconfig}
            [end]
            [exec] (aptitude) { x-terminal-emulator -T "aptitude" -e /usr/bin/aptitude}
            [exec] (DSL/PPPoE configuration tool) { x-terminal-emulator -T "DSL/PPPoE configuration tool" -e /usr/sbin/pppoeconf}
            [exec] (GDM flexiserver) {gdmflexiserver}
            [exec] (GDM flexiserver in Xnest) {gdmflexiserver -n}
            [exec] (GDM Photo Setup) {gdmphotosetup}
            [exec] (GDM Setup) {gksu gdmsetup}
            [exec] (pstree) { x-terminal-emulator -T "pstree" -e /usr/bin/pstree.x11}
            [exec] (reportbug) { x-terminal-emulator -T "reportbug" -e /usr/bin/reportbug --exit-prompt}
            [exec] (Run as different user) {/usr/bin/gksuexec}
            [exec] (Top) { x-terminal-emulator -T "Top" -e /usr/bin/top}
            [exec] (X-Terminal as root) {/usr/bin/gksu -u root /usr/bin/x-terminal-emulator}
        [end]
    [end]
    [submenu] (Help) {}
        [exec] (Info) { x-terminal-emulator -T "Info" -e info}
    [end]
    [submenu] (WindowManagers) {}
        [restart] (FluxBox) {/usr/bin/fluxbox}
    [end]
    [config] (Configuration) {}
    [submenu] (Styles) {}
        [stylesdir] (/usr/share/fluxbox/styles) {}
        [stylesdir] (~/.fluxbox/styles) {}
    [end]
    [workspaces] (Workspaces) {}
    [reconfig] (Reconfigure) {}
    [restart] (Restart) {}
    [exit] (Exit) {}
[end]

And the one from my Desktop

[begin] (fluxbox)
        [exec] (Evolution) {/usr/bin/evolution}
        [exec] (GAIM) {/usr/bin/gaim}
        [exec] (Bash) { x-terminal-emulator -T "Bash" -e /bin/bash --login}
        [exec] (Epiphany) {/usr/bin/epiphany}
        [exec] (BMP) {/usr/bin/beep-media-player}
        [exec] (Xine) {/usr/bin/xine}
[include] (/etc/X11/fluxbox/fluxbox-menu)
[end]

You can see the difference. My Desktop had the Debian Menus before I installed Fluxbox, hence the include came into play

Keyboard Shortcuts

Keyboard shortcuts are awesome to say the least. Why reach for the mouse when you can just hit a key combo and be done? The keyboard shortcut definitions are all stored in ~/.fluxbox/keys

Fluxbox comes with a few shortcuts preset, namely the familier Alt-TAB and mapping Alt+F1 through F12 to the 12 workspaces (If you have all of them enabled. By default Flux has 4 active). But we want to make our own don't we? Yup! Easy enough. Follow the syntax (again 1 per line)

<key combo> :ACTION

Now some things need explaining. One the key names. Alt is referred to as Mod1, CTRL as Control, and the Windows key is Mod4. Most of the other keys are what you expect. However if you want to be sure, there is a tool called  xev . Call it on the command line and start hitting keys. A LOT of gibberish will come up, like this

KeyPress event, serial 30, synthetic NO, window 0x1800001,
    root 0x3e, subw 0x0, time 3967824504, (728,435), root:(799,525),
    state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

Now most of that is gibberish that we don't need. What we want is the part in  keycode <something> (keysym <something>, Shift_L)  That last part (Shift_L) is what X sees the key as, thus its name. So use it (note the rules above about naming overrule this, so Alt is still Mod1, etc)

So now we have the key names. The format for the key combo is simple. Just put down the combo! So Alt+F1 would be  Mod1 F1 . Easy! Now the part after : is what the combo does. There are many options, but I am going to go through the ones I think will be most useful.

Action

Description

Close

Closes out the current window

Minimize

Minimizes the current window

MaximizeWindow

Maximizes the window

ShowDesktop

Minimize all windows

Restart

Restart Fluxbox

Quit

Quit Fluxbox and return to the login screen

ExecCommand

Run the specified command. Either give the command or the absolute path to the program (think what you did for the menu file)

Again we have an example file from my desktop

Mod1 Tab :NextWindow
Mod1 Shift Tab :PrevWindow
Mod1 F1 :Workspace 1
Mod1 F2 :Workspace 2
Mod1 F3 :Workspace 3
Mod1 F4 :Workspace 4
Mod1 F5 :Workspace 5
Mod1 F6 :Workspace 6
Mod1 F7 :Workspace 7
Mod1 F8 :Workspace 8
Mod1 F9 :Workspace 9
Mod1 F10 :Workspace 10
Mod1 F11 :Workspace 11
Mod1 F12 :Workspace 12
Mod4 F1 :ExecCommand /usr/bin/evolution
Mod4 F5 :ExecCommand x-terminal-emulator -T "Bash" -e /bin/bash --login
Mod4 F2 :ExecCommand /usr/bin/epiphany
Mod4 F3 :ExecCommand /usr/bin/xine
Mod4 F4 :ExecCommand /usr/bin/best --no-tray

Setting the Background

Now playing around with menus and keybinds is all well and good, but you want to set a background right? Easy!

fbsetbg <image file>

See? Big Grin :)

Note: fbsetbg is just a wrapper for other things that set wallpapers, such as Esetroot and feh. If you have one of those installed fbsetbg will determine the best one to use and use it. To find out what fbsetbg is using run  fbsetbg -i 

Feh can be installed with  sudo apt-get install feh 

Esetroot comes with ETerm so  sudo apt-get install eterm 

Styles

You can set the background just fine, but what about the theme. Well there is good news and bad news. The good news is that Fluxbox ships with a lot of themes (called Styles) by default. The bad news is that they only affect the windows themselves, not the "interior". That means if you are running GTK apps, then they will use the default grayish theme. Now thats good on its own, but it can really mess up a colorscheme. You can change it though, but first how to install and use Styles themselves.

Changing Styles is quite easy. Just to go the Styles submenu and click on it. Be warned though, some styles will override your background with their own, so you will have to change it back. Now what if you want to install a new style? Well first you have to know where to FIND them. Freshmeat has a lot of styles, so look there first. [http://themes.freshmeat.net/browse/962/]

Once you find one you like, download the tarball to ~/.fluxbox and extract it. One of two things will happen. It will be a good tarball and just put its files into ~/.fluxbox/styles, or it will put them someplace else in ~/.fluxbox. If the former occurs, then you are all set, the theme is in the Styles menu now. In the case of the latter you will have to find its style directory and move the file in it to ~/.fluxbox/styles. Fortunately 99% of the time it will make its own directory and the style dir will be in that (this is why we extracted in ~/.fluxbox, there aren't many dirs in there to begin with so its obvious when a new one is made).

Now thats all well and good, but I mentioned being able to apply GTK Themes. Yes you can. Install GTK Theme Switch with  sudo apt-get install gtk-theme-switch  and run it with  switch2 . A little dialog will pop up with a dropdown of all the GTK Themes installed. Just select and apply. Keep in mind that the Style will still be in control of the Window Decorations (Titlebar, window borders, etc), so if the GTK Theme normally sets those, it won't, but the rest of it will work. A good source of GTK Themes is [http://www.gnome-look.org GNOME-Look]. Stay away from the Metacity themes though. Those flat out won't work. Also if you need to install a new GTK theme, just download the tarball to ~/.themes and extract it.

STARTUP!

You've heard of ~/.fluxbox/startup, now learn how to use the thing.

Like all good scripts, this one is nicely commented out with quick instructions.

To set the background (overriding the style!) uncomment the fbsetbg line and place the location of the image as the argument to fbsetbg. Then comment out the part about setting a black background. Now run past the rest of it (note the comments if they sound interesting) and find the part about startup programs, it will be near the bottom. Here put all the programs you want to load with Fluxbox. Some things to consider. XScreensaver (The thing that controls the screensaver and screen locking) "doesn't" run with Fluxbox by default, so you want to add it to the startup script with  xscreensaver &  . The & tells it to run in the background (Like it should). This goes the same for things like the Beagle daemon,  beagled & . For other programs like GAIM, GKrellm (which is a REALLY good complement to Fluxbox), and anything else you want starting just put the command.

There IS something worth mentioning. Right at the bottom is the command to start Fluxbox. If you leave it as /usr/bin/Fluxbox, the Style wallpaper will override the background regardless. Now changing it to /usr/bin/startfluxbox will correct this, however for me it seems to completely crash Fluxbox. Just a note.

(To do, still: customization(done unless you have more - Kyral(aka Chris), a more complete discussion of ~/.fluxbox/startup(done somewhat - Kyral(aka Chris), usage how-to")

CategoryDocumentation CategoryCleanup