24 Dec 2013

Fluxbox Ubuntu 12.04 Setup

I've been trying out some alternative desktop environments under Ubuntu and decided to give Fluxbox a try for a while. These are my notes on customizing Fluxbox. I chose to model my Fluxbox setup after this one by chirilas. It uses wbar and conky but I couldn't find any details on how it was configured, so here's what I did.

Fluxbox Menu Style

It looks like the example above uses the carp menu style. I liked that style but wanted to increase the font size for the menu and for the window title bar. I made a copy of the directory /usr/share/fluxbox/styles/carp and called it carp_greg. I made the following changes:

menu.frame.font:                        sans-9:bold
menu.title.font:                        sans-10:bold
toolbar.clock.font:                     sans-9:bold
toolbar.workspace.font:                 sans-8:bold
toolbar.iconbar.focused.font:           sans-8:bold
toolbar.iconbar.unfocused.font:         sans-9
window.font:                            sans-10:bold

Fluxbox Menu

I like the Nautilus file manager but it conflicts with the Fluxbox menu. To correct this, I you have to edit the Fluxbox menu configuration file, /etc/X11/fluxbox/fluxbox-menu. Change the line for Nautilus as described here, to add the --nodesktop option to the startup. While I'm at it, I added my most frequent programs to the top of the Fluxbox menu:

[exec] (Chromium) {/usr/bin/chromium-browser} </usr/share/pixmaps/chromium-browser.png>
[exec] (Gnome Terminal) {/usr/bin/gnome-terminal} </usr/share/pixmaps/gnome-terminal.xpm>
[exec] (Nautilus) {/usr/bin/nautilus --no-desktop} </usr/share/pixmaps/nautilus.xpm>
[exec] (Emacs 23 (X11\)) {/usr/bin/emacs23} </usr/share/pixmaps/other/Emacs.png>
[exec] (Baobab) {/usr/bin/baobab} </usr/share/pixmaps/baobab.xpm>

Mouse Focus

I always liked the old X11 Motif focus follows mouse option but in Motif, there was a setting to delay the focus change by some amount of time and I want to set the delay for Fluxbox. There is a description of the options here using the session.autoRaiseDelay option. Open the ~/.fluxbox.init file in your favorite editor and find the session.autoRaiseDelay setting. It was set to 250 on my system (1/4 of a second). I'm going to change that to 1/2 of a second:

session.autoRaiseDelay:    500

After changing the setting, choose Restart from the Fluxbox menu.

Dual Monitors

I also had to use xrandr to configure the Fluxbox window manager to recognize my two monitors and their position relative to each other. Execute the xrandr command with no options to view the video card and monitor options that the window manager sees. I created a script which executes the commands to setup my monitors.

xrandr --auto --output HDMI1 --mode 1920x1200 --right-of VGA1
xrandr --auto --output VGA1 --mode 1920x1200 --right-of HDMI1


I used wbar as a quick start bar. Unfortunately, it doesn't handle dual monitors well, so I set it as a vertical start bar. Here's the start command line I used:

wbar -isize 48 -above-desk -bpress -p left -vbar -nanim 3

And here's the .wbar configuration file:

i: /usr/share/pixmaps/chromium-browser.png
c: chromium-browser
t: Chrome

i: /usr/share/pixmaps/other/GNOME-Terminal.png
c: gnome-terminal
t: Terminal

i: /usr/share/pixmaps/nautilus.xpm
c: nautilus --no-desktop
t: Nautilus

i: /usr/share/pixmaps/firefox.png
c: firefox
t: Firefox

i: /usr/share/pixmaps/other/Emacs.png
c: emacs
t: Emacs

I also didn't care for the default font used for wbar so I executed the following commands to change the font:

sudo rm /usr/share/wbar/iconpack/wbar.osx/font.ttf
sudo ln -s /usr/share/fonts/truetype/freefont/FreeSansBold.ttf /usr/share/wbar/iconpack/wbar.osx/font.ttf


Fluxbox doesn't support transparency which makes for an ugly wbar when layed over your background. This is can be easily solved by installing xcompmgr and adding it to your startup file. The install can be done with this command:

sudo apt-get install xcompmgr


I'd also like to use Conky for a clock and system information widget. There's a collection on Conky examples here. Backgrounds To set the background, execute the command fbsetbg -i to insure that you have a utility available to do the job. You can then use the fbsetbg -r <directory> to set the background to a random image in the specified directory. In the next section I set the fbsetbg command to automatically run on startup.


I need to get both wbar and the dual monitor configuration to be setup at login time. Fluxbox has a startup configuration file, ~/.fluxbox/startup. Here's what mine looks like:

xrandr --auto --output HDMI1 --mode 1920x1200 --right-of VGA1
xrandr --auto --output VGA1 --mode 1920x1200 --right-of HDMI1
fbsetbg -r ~/Pictures/MyBackgrounds
xcompmgr -c &
(sleep 3 & wbar -isize 48 -above-desk -bpress -p left -vbar -nanim 3) &