Table of Contents

Fluxbox

NB This is from a long time ago in a galaxy far away. January 2016 in fact. I changed to i3wm(1) and now use sway(1). It might still be useful, who knows?

A keyboard-heavy, para-tiling configuration

Everyone's desktop experience is different. KDE users like one thing. Gnome users like another - then there's Gnome Classic, Gnome Modern, LXDE and XFCE … A common theme in all these is “Multiple Overlapping Windows managed by the User via the Mouse.”

They're all OK as far as they go, but something about them all has annoyed me over the years - the amount of time spent re-sizing and flipping between all the different windows and the waste of space around the edges of the nest of windows.

Often I find myself trying to get the most out of my screen real-estate by lining up windows to each other and stretching them out to the screen edge - some WM's make this a bit easier by snapping the moved corner to an existing edge. But it's still a lot of work. Just try clicking and dragging 2 or 3 windows so they have a visually pleasing equal size, without wasteful gaps and fill the screen completely.

For another thing, it's just too fiddly to drive the mouse into those tiny window-corner re-sizing tools and drag them around.

So I thought I'd try tiling window managers - awesome(1), xmonad(1), dwm(1) … there are many, and I've tried a few. None, so far, really do it for me for one reason or another. Perhaps it's because I don't want tiling absolutely everywhere. I like to have docks and gkrellm running on all desktops and some tiling managers don't do that sort of thing well. STOP THE PRESS: I discovered i3 and it's fabulous

Or maybe I'm just too bedded in with fluxbox(1).

Whatever, I have evolved (and present here) a bunch of scripts that use wmctrl(1) and should, therefore work with any WM, not just fluxbox(1). I also have a nice, consistent and easily memorised set of key assignments in a fluxbox(1) keys file - but they could easily be ported to Gnome or KDE and I have done that too. Unfortunately, the Gnome and KDE formats for key assignments are not so easily ported around but if there's interest I will provide what I've done with them.

The scripts plus the key bindings provide a para-tiling approach - tiling where I want it, non-tiling elsewhere with really snappy key assignments that save me from all that tedious mouse clicking and dragging stuff.

Just imagine - a single key press to marshall all your windows into a consistent size and neatly tesselated across the screen.

I should mention that mostly what I do is develop code of some sort or other. Vertical pixels are more valuable to me than horizontal pixels as they are the limiting factor on the number of lines of code that I can see on one screen. That's extra important on today's letterbox 16:9 displays - and there's just no way to turn a laptop screen into portrait mode! So I tend to push my docks, clock and gkrellm off to the RHS of the screen and have no top or bottom bar.

My normal work setup with tile -3 which is assigned to key S-C-M-3:

A more extreme example with tile -9:

What I'll try and do here is give a breakdown of each feature of my fluxbox(1) usage. Maybe it'll be useful to someone.

In all the keys assignments presented here:

Installing & Starting fluxbox

fluxbox was my favourite screen manager for many years - it's minimal and fast, it allows me to use the 'hot' keys that I like (eg Mod4-x runs my favourite xterm konsole(1) - in fact, I almost have no need to use the mouse (until the browser runs, anyway!).

By the way, I'm not too into 'themes' so look elsewhere for pure eye-candy - this is automation stuff. Also, these scripts are specific to my machines and environment - some of them won't be much use unless you edit them to your own needs - please don't run anything marked * without editing it first.

Installing fluxbox (on fedora):

Fedora doesn't have a 'spin' for fluxbox so you need to start with something else. The default fedora install uses Gnome, but there are spins for KDE, XFCE and LXDE. I generally use the LXDE spin as it's pretty light and doesn't have all the Gnome/KDE junk that I'm unlikely to use.

rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

install the essentials:

yum install fluxbox feh wmctrl xmessage inotify-tools xvkdb xscreensaver zenity

other nice to haves:

yum install mrxvt gkrellm emacs nitrogen konsole # customise this to your own taste!

remove evils:

gnome-screensaver used to be fairly useful and it used to play nice with xscreensaver - nowadays (eg fedora-14) it's braindead and it runs no matter what you do. Something to do with d-bus. Whatever, it's just a lot easier to get rid of it:

rpm -e gnome-screensaver

login manager setup - gdm/kdm/lxdm etc

Getting gdm, lxdm, kdm, etc to offer fluxbox(1) as well as gnome/kde etc is probably more fully documented elsewhere, but this is what I use:

.xsession _should_ be called by gdm and kdm. However, on fedora, I needed to install xorg-x11-xinit-session.

I've a somewhat longer treatment of this here: starting_x

Using startx

Some people prefer to live without a login manager; me too, sometimes. In this case a couple of extra things need to be supplied - startx(1) will call your .xinitrc * file. In turn, this calls your .xsession file as above.

Starting up fluxbox

I have a single set of scripts for all my machines and environments, home and work:

Scripts to generate menus etc

(some of these rely on argp.sh from this site - see scripts):

Other useful scripts

Laptop peculiarities

These are not specific to fluxbox(1) so I've put them here

NOTE: * = edit these before using

Work Spaces

In workspace 1 I generally place a number of terminals (I like konsole) and emacs windows all tiled without window decorations.

On the other workspaces I have other apps running - eg a browser, maybe rapidsvn(1) for svn GUI operations - although mostly I use CLI svn(1). Maybe a vncviewer(1) back to my home server to keep an eye on downloads and TV recording. A VirtualBox running Windows for corporate apps. You get the idea.

For navigating between these I use a consistent set of C-M- commands. Thus:

As usual, Mod4- can be used instead of C-M- in the above key assignments.

Moving Windows Around

Moving windows around is a royal pain if you need to faf about with getting the mouse cursor on the title bar and then drag it around. To make it a little easier I map M-Mouse1-drag with the cursor anywhere on the window to start moving the window. That's 'press Alt, then left button and drag the window around'. This gives me a much bigger target.

To pop a window to be above all others (ie to be the front-most window) I have M-Mouse1 on the window.

To push a window to the bottom (ie all others are in front of it) I have M-Mouse2 (middle button) on the window. Surprisingly, this is actually more use than M-Mouse1 as it allows you to cycle through a stack of windows.

On some of my keyboards, the Home, End, PgUp and PdDn keys form a square. So I map them (when combined with C-M- keys) to let me quickly move windows about the screen:

If I want to send a window to a corner, I use these:

These look fearsome but it's amazing how your finger memory handles it after a couple of goes. There's always the window menu (S-Menu) if you can't recall the key chords.

For fine tuning, I use these:

Also, there is a 'move window mode' where the direction keys Up, Down, Right and Left move the window by 1-pixel and 10-pixels if shifted:

As usual, Mod4- can be used instead of C-M- in the above key assignments.

Resizing Windows

Finding those darn resize corners can be a royal pain. The fluxbox(1) default of M-Mouse3 “anywhere in a window” resizes from the nearest edge and is quite useful. That said, I rarely use it and rely more on the tiling commands:

This is enough for me but I also have window menu items (S-Menu) for half, third, quarter, sixth and ninth of a screen.

I find that 3 windows of 1/3 screen are just about right for coding on typical 1980×1280 screen - two emacs windows and one terminal.

For fine tuning, I use these:

Also, there is a 'resize window mode' where the direction keys Up, Down, Right and Left keys resize the window by 1-pixel and 10-pixels if shifted:

As usual, Mod4- can be used instead of C-M- in the above key assignments.

Tiling

Most of the tiling functionality is implemented in the tile script. Then, I have this in the .fluxbox/keys file:

Thus C-M-o arranges all windows on the current workspace and tiles them next to each other without resizing them. It works through all windows of the same class (eg all the terminals, then all the emacs windows etc) fitting them next to each other as far as possible. It start with the largest one, pushing it up into the top left corner, then works through the remainder. If it runs out of room, it starts again at the top left putting the next window above the previous one. All without touching the mouse. Of course, the most 'tiling-esque' effect happens when there is enough space for all the windows without overlap.

Tiling doesn't really need window decorations, so:

A very frequent use-case for me is to want all my windows to be the same size, tiled and without window decorations at all - after all, when you're tiled, you don't need the window decorations and you get an extra line for your editor or terminal in exchange for the title bar. Here are my key assignments for this:

Thus S-C-M-2 operates on every window in the current workspace, removes the window decorations, re-sizes it to half screen and then tiles them next to each other. Again, no need for the mouse (of course, there's nothing stopping you from putting something in your menus if you can't remember the key-chord).

As usual, Mod4- can be used instead of C-M- in the above key assignments.

fluxbox(1) has an ArrangeWindows command - but it doesn't seem to do what I want.

Since I often remove window decorations and tile my working windows across the whole desktop, it can be hard to get to the menus. Here's a couple of keyboard shortcuts to pop up the menus:

As usual, Mod4- can be used instead of C-M- in the above key assignments.

I have a bunch of scripting to build various menus - see the various menu files menuconfig menu usermenu user.menu windowmenu ../etc and the scripts update-user-menu ../etc

But one thing that fluxbox(1) lacks is a way to get its menus to update automatically - eg when you install or delete new software, you'd want it to appear in the menus without having to remember to rebuild them. The watch-files script here does just that. Check it out!

Cut & Paste

There are many Unix applications that cut and paste a little differently to what has become the de facto standard - ie C-x C-c C-v via the “clipboard”. In X the subject is a little more complex with several additional sources for paste such as the PRIMARY selection 1). There are others, but rarely used so I won't go into them.

If an application does not support the clipboard (eg emacs(1), most terminal emulators) then I can simulate it with the following keystrokes (which depend on xclip(1) and xvkbd(1)):

As usual, Mod4- can be used instead of C-M- in the above key assignments.

Runnings apps

Like me, your top 10 apps probably account for 99% of your use, so it's useful to have them directly at your fingertips rather than hunting through menus. You'll most likely want to customise these:

As usual, Mod4- can be used instead of C-M- in the above key assignments.

Note that most key commands that invoke external apps are run through my script xcheck(1) which watches for errors and pops any up in a dialog window. It helps debugging.

Auto-type

How many times a day do you type your email address or password? The following keystrokes use xvkbd(1) to insert those strings into the keyboard buffer stream. Passwords need to be stored encrypted so I use gpg(1) for the storage and gpg-agent(1) to unlock the keystore (once a day!). All this is done with a couple of my scripts lookup(1) and myautotype(1).

As usual, Mod4- can be used instead of C-M- in the above key assignments.

Screen Dumping

The script myscreendump(1) uses the X utilities xwd(1), ImageMagick and netpbm to enable various type of screen dumping:

Multimedia

These control the volume, backlight etc and use amixer(1). I don't use pulse, if I can help it!!

The play prev next buttons are specific to mplayer(1), my favourite media player. It needs a clause in ~/.mplayer/config to create the fifo for this control.

input=file=/home/bhepple/.mplayer/fifo

If you don't use mplayer(1) you can reassign these keys as you like.

Downloading

For convenience, there are tarballs of my scripts here:

Installation:

Put all the scripts somewhere on your $PATH - perhaps /usr/local/bin or ~/bin. As for the startup scripts:

1)
whatever is selected on-screen is automatically copied and available to be pasted with the middle mouse button or (often) with Shift-Insert