Skip to main content

Hints for X11 on Mac OS X

One of the lovely features of Mac OS X, being based on Unix technology, is that it's possible to run X11 based applications with an almost native look and feel. Unfortunately this doesn't translate completely due to the way the X11 server is implemented. It is a single app, and all X11 windows are considered children of it, so the OS X window manager treats all X11 windows as a large group. This does mean, however, that those of us used to working with X11 apps in a different way to OS X native apps can do so, as long as you don't mind the slight mismatch of behaviour.

One of the first things folk notice about the OS X window manager for X11, quartzwm, is that the mouse focus model is completely unintuitive. Focussing a window requires clicking within it, but then activating controls requires another click. You can't just move the mouse over to a window and click, and expect anything to happen. This is usually resolved in one of two ways; turning on "focus follows mouse", or enabling "click through" to allow the window to respond to the focussing click as if it were already focussed.

When I'm using a linux window manager, I am happy working in either of these modes. For Gnome, I like to have click-to-focus, and for more lightweight WMs like Fluxbox, I prefer focus-follows-mouse. Fortunately, enabling either of these options for quartzwm (for Snow Leopard, anyway) is as simple as opening the preferences pane and clicking a checkbox. For OS X, I find that click-to-focus matches the rest of the OS best, so I enable click-throughs.

When using X11 on OS X, it is usually to use the Gimp. This is bundled as a self-contained application, and will launch the X11 server on demand. Of course, all the Gimp's windows are still considered a part of the X11 app, but the Gimp dock icon responds to drag-and-drop and other OS X features. It's a bit weird, but easy to get used to.

Enabling click-through makes working with the Gimp a lot more fluid. The multi-window interface is a pain to work with otherwise, because even something as simple as changing which tool you're using requires clicking the toolbox window, then clicking again to select the tool. It is very frustrating to click a tool and then try to use it, only to realise that a) the tool never got selected, because the WM swallowed the click before the Gimp could respond, and b) the tool window is now focussed, so trying to use the tool on the image will not work until you refocus it with yet another click.

For those of you who don't like using nasty, icky GUIs for something like changing WM preferences (why are you using OS X again?) there is a command line way to do it. In a terminal (or Xterm if you're so inclined), type one of the following to enable focus-follows-mouse (ffm) or click-throughs:
defaults write org.x.X11 wm_ffm -bool true
defaults write org.x.X11 wm_click_through -bool true
Another useful feature built into quartzwm is the ability to shut down the X server automatically when no windows are left. For those of use who only use the occassional X11 program, and are somewhat obsessive about not leaving programs running in the Dock that aren't actually in use, this is very useful indeed. To enable it, enter the following command into a terminal:
defaults write org.x.X11 wm_auto_quit -bool true
A secondary option allows you to specify a short timeout, in which the WM will wait for a few seconds to see if you start any more windows. If you do, quartzwm doesn't shut down and continues until all windows really have gone. It is very important to use this option if you use the Gimp. With a 0 second timeout, the X11 server will close as soon as the Gimp splash screen disappears, because it takes a moment for the main image window to appear. This fraction of a second delay is enough to make the X11 server disappear and take the Gimp with it, making it impossible to start up. I would recommend a 5 second timeout to make sure that all windows really are closed, and more importantly, no more are on the way before shutting down the X11 server.

To enable this feature, enter this command in the terminal:
defaults write org.x.X11 wm_auto_quit_timeout -int 5

Note that all this options are available in earlier versions of Mac OS X than Snow Leopard. For Leopard users, they are identical. For Tiger users, replace all references to org.x.x11 with com.apple.x11. This is because versions of OS X prior to Leopard used the now mostly defunct XFree86, while Leopard and Snow Leopard have moved to the much sexier X.org.

Comments

Popular posts from this blog

Sheffield CAMRA 35th Steel City Beer Festival!

The first weekend of October has rolled around, so once again it is time for the Sheffield CAMRA Steel City Beer Festival. Now in its 35th year, the festival has seen a lot of change in the recent past. After the terrifying ordeal that was the Darnall Liberal Club, standing out in a field with beer seems like a much nicer proposition. Unfortunately, reviews of the 34th festival were tainted with dissatisfaction, both with the venue and the organisation as a whole. I didn't attend last year, but I attended this year with some trepidation. Thankfully, the whole event was better run than I had been led to believe, but not without its fair share of hiccups. Two marquees provided more indoor space, the place didn't smell like a donkey sanctuary, and the beer tasted great. There were around a hundred beers to try, and thirty ciders, so even more than some previous years. After a couple of false starts, our little troop of merry drinkers (myself, Emma and Chris) finally arrived at

iPhone OS 3.0.1 fixes SMS hijack bug

A lot of Apple haters have been rubbing their tiny hands with glee recently after news reports of a security flaw in the iPhone OS 3.0 that could allow hackers to "Hijack every iPhone in the world" . Many were quick to point out how slow Apple were for not releasing a patch, and many simply made it a soap box for "iPhone sucks, use Android" rants. However, on July 31st, Apple released iPhone OS 3.0.1, with a patch for this SMS issue. It installs easily enough, job done. Of course, not being privy to such information as how to hack my own phone with this exploit, I can't check if it does the job. Either way, there it is. A fix. More detail on the OS 3.0.1 release notes .

Why won't I leave me alone!?

Sometimes I just wish I could ignore my brain so I might be able to concentrate for ten minutes.