Window placement

Window placement is kind of a big deal to me. Out of all the different styles and algorithms for window placement, my favorite for the longest time has been “Random”. Random window placement had a better chance of putting an application window where I wanted it on the screen than any other option – until now.

But first, a bit about window placement:

Microsoft Windows tries to place a window where it was the last time you had it open. I thought this was a good idea at first, until I remembered I use many windows from the same application. Anyway, after that, I don’t know where Windows tries to put new windows.

GNOME 2, FVWM, and many other user interfaces I’ve tried seem to have a thing for the upper left corner of the screen. I hate the upper left corner of the screen! It’s the last place I want a new window is in the upper left corner of the screen, especially when I have a big empty desktop.

I’ve tried a few tiling window managers, but they just weren’t my thing. Oh, well.

Finally, I started using Openbox. I was sad at first, because everything looked great about Openbox except for one thing: the only options for window placement are “Smart” and “Under mouse”. I’m too lazy for “Under mouse” and when a window manager says “Smart” placement I usually don’t find it to be too smart.

I decided to look at the source code for the “Smart” placement, and I was pleasantly surprised! It goes through these logical steps:

  1. If a window knows where it wants to go (like Pidgin instant messenger does) then just put it there.
  2. If there are no windows open, then put it at the center of the screen.
  3. If there are windows open, then find a space where it will fit and center it in that space.
  4. Finally, if it can’t fit anywhere without overlapping another window, place in on the screen randomly.

I love it!

Comments are closed.