The version of metacity that ships with Debian Sarge has all of the focus theft prevention code disabled entirely, meaning that every new window ever created steals (or is given, however you want to put it) focus. I’ve spent quite a while this morning trying to figure out how to disable this behavior, finding nothing, except a few discussions where people said they disliked this behavior.
Unable to find any information about this on Google, I consulted the source, and found:
/* Disable the focus-stealing-prevention stuff for now; see #149028 */
The bug in question, Bug 149028 – Focus stealing bugs roundup is currently not assigned to any developers (status: NEW). It seems like most of the discussion there is about how to get window focus to work the way the user expects it to — ie the way they think the user expects it to, and not to provide ways for the user to decide for themselves how they want it handled. This is the type of thing I expect from Microsoft or other commercial software, but not from Open Source software.
Anyway, the goal of this post is to get a solution out there so others in my predicament can control their window manager behavior. Power to the people, and all that.
Here’s a replacement metacity package (2.8.8_1_dpk) which adds the following keys (as can be viewed in gconf-editor):
They default to true. Changing them to false gives you the correct..ahem..the behavior I was originally looking for. dpkg -i metacity_2.8.8_1_dpk_i386.deb will install this, and then you just have to kill the current metacity process. Gnome will restart it, at least in the default configuration.
In case you’re curious, here’s the patch against the metacity-2.8.8 directoroy that comes with Debian Sarge stable (ie, run apt-get source metacity, put this 001_dpk_focus_toggle.diff patch in metacity-2.8.8/debian/patches, and run ./debian/rules build, and away you go). If it matters I’m releasing the patch under the I don’t care what you do with it license.
Footnote: I recognize this is not the optimal solution for everyone. I just know I can’t stand having windows take over focus under any circumstances. I’m not even sure this covers every case — maybe applications can force focus theft. So, no guarantees or anything.
Edited: I was probably a bit too harsh above. I recognize that these are open source volunteer projects that I often complain about. It just doesn’t seem to me that a year of discussion (or multiple years of nothing as is the case with many FreeBSD bugs) can result in a solution. This is where leadership could step in and state “This is how it’s going to be”, and then just get it done. Open source is about choice — if the users don’t end up liking how it was done, they could change it later on, but at least these bugs won’t be sitting around effectively idle.