Tuesday, December 15, 2009

GNOME with Fluxbox

I've mentioned before that I'm a big fan of Fluxbox. Nevertheless, I'm also a big fan of the GNOME project and Gtk. I like gnome-panel, gnome-keyring, gnome-power-manager, and a whole host of programs that run as part of a GNOME session. I just happen to not like Metacity and Nautilus--or maybe it's just that I like Fluxbox a lot. I also love gnome-settings-daemon and having a nice way to set backgrounds and nice looking themes (something that Fluxbox is missing).

Here's some boring history... Feel free to skip it.

I've always had trouble getting GNOME and Fluxbox to play nicely. I could just be dumb, but GNOME doesn't make it very easy on me either. For a while I used the 'gnome-session-remove' tool to remove metacity and nautilus and then I would start Fluxbox. This worked well, but gnome-session-remove was removed from GNOME, apparently without a replacement. Then I started digging around in the gconf-editor. When I found the /desktop/gnome/applications/window_manager directory, I thought I had found what I needed. Alas, every single key in that directory has been depcrecated since GNOME 2.12, and they don't appear to do anything anymore. For a while I got by just hacking together an .xinitrc to load everything I wanted, but, for me it was a pain to even get all the correct GNOME pieces--especially when working on my laptop--so that everything worked as expected (my main issues were with gnome-keyring, and the gnome power daemons). Additionally, audio no longer works in openSUSE in runlevel 3, so the .xinitrc solution was out the door. (I probably could have hacked together something in .xsession or some other level 5 voodoo, but I doubt this would have resolved the other issues.)

Fluxbox didn't make it very easy on my either. I finally just started loading a standard GNOME session and then killing Nautilus and Metacity and then starting Fluxbox. This worked quite well, but the Fluxbox toolbar would always steal the "system tray" (I don't know what we really call it) icons from the gnome-panel, and I like my little applet icons. I supposed I could have just made both panels visible, but that would just be redundant and silly. This, however, caused me to stumble onto an actual solution, which was to compile Fluxbox without its toolbar. After that, I just need to find a decent way to tell GNOME to load Fluxbox instead of Metacity.

The exciting part...

Here's how you can get Fluxbox and GNOME to play nicely (with only a minor hack):

  1. Get the Fluxbox source. I used the current Git code.
  2. Configure Fluxbox with --enable-toolbar=no during the configuration step.
  3. Run gconf-editor and replace the value of the /desktop/gnome/session/required_components/filemanager key with an empty string (the default is "nautilus").
  4. And here is the minor hack: Run (as root) 'echo "exec startfluxbox" > /usr/bin/gnome-wm' (after backing up the gnome-wm file, of course). I label this a hack, because the file says not to edit it.
I suggest everyone try this; it's quite nice ;) I have all the GNOME nicities, with all of the Fluxbox simplicity, power, and productivity enablement. Here are some things that I consider nice about Fluxbox:

  • Instead of having a "Start" menu, right clicking anywhere on the desktop produces the (highly configurable) menu.
  • Alt+LeftClick moves a window (same as Metacity), and Alt+RightClick resizes a window. Metacity has the resize feature as an option in gconf, but Fluxbox is much more configurable because of its keys file. For example, I prefer to resize the window in the same way, regardless of where my mouse is positioned on the window.
  • Scrolling with the mouse anywhere on the desktop swaps workspaces
  • Very customizable menu
  • Double clicking on menu bar "collapses" the window like a window shade, only leaving the title bar. Clicking on the title bar a second time expands the window. This is also an option in GNOME from the gnome-control-center.
  • A window can be dragged between workspaces (a feature in Compiz, and maybe somewhere in GNOME).
  • Window title bars take up much less space and can be configured to be even smaller (or configured in a number of different ways).
  • Some people like the Fluxbox slit, but I don't use it.
  • Window tabbing, which allows multiple windows to share the same window and tabbing to occur at the title bar (so that a tabbed window doesn't take up any more space than an non-tabbed window). Behold:


And here is a screenshot of the entire desktop:

From Linux

Hopefully there is an even better solution and someone can enlighten me.


Stoffe said...

That window tabbing is extremely sexy I must say! And being able to group arbitrary windows like that is something I've been long for for a long time. Wonder if Compiz has this somewhere, somehow? I recall a hopelessly unusable "tabs" plugin, but that was a long time ago...

liberforce said...

Instead of removing nautilus as the default filemanager, edit this key instead:
You'll be able to remove the filemanager from the components to launch. And to replace metacity by fluxbox, changing the value of /desktop/gnome/session/required_components/windowmanager to fluxbox should be enough.

The comments in gnome-wm even tell you to do so:

# NOTE: DON'T USE THIS. Please have your window manager install
# a desktop file and change the gconf key
# /desktop/gnome/session/required_components/windowmanager

bgmerrell said...

@liberforce Yeah, I had tried that too. That file also says to "have your window manager install a desktop file," which Fluxbox doesn't do. Maybe it has something to do with that. I did mention in my post that the file says not to edit it.

Sven said...

Nice post! I have used fluxbox for several years. Some weeks ago I switched to xmonad (a tiling window manager), which is also easy to use with GNOME. You value "the GNOME nicities, with all of the Fluxbox simplicity, power, and productivity". My impression is that xmonad gives me even more power and productivity (I am not quite sure about the simplicity part).

Neville said...

WOW, this is really awesome. BTW, do you use any replacement of nautilus?

bgmerrell said...

@Neville, Hey man. No I don't use any replacement for Nautilus.

作弊 said...