Thursday, May 27, 2010

Configuring Compiz to emulate Spaces and Expose

If you have an OpenGL-capable video card and driver for Linux, like the GeForce 7900 GS in my big box, you can run Compiz on Ubuntu 10.04 and emulate Spaces and Expose'. So here's how to do it in Gnome (I do not recommend KDE on Ubuntu 10.04 due to some serious bugs I found):
  1. Install the latest proprietary driver via System->Administration->Hardware Drivers. Without this installed, my GeForce 7900 simply would not do 3D, and Compiz wouldn't run.
  2. Install the Compiz settings manager:
    • # apt-get install compizconfig-settings-manager simple-ccsm
  3. Identify the X11 mouse buttons you wish to use. Sorry, I identified those via trial and error. On my Logitech Anywhere MX mouse, here is the map from mouse action to X11 mouse button:
    • Button 1: Left click
    • Button 2: Right click
    • Button 3: The 'menu' button
    • Button 4: scroll wheel forward
    • Button 5: scroll wheel back
    • Button 6: scroll wheel left
    • Button 7: scroll wheel right
    • Button 8: backmost-arrow button (on left side of mouse)
    • Button 9: forwardmost-arrow button (on left side of mouse)
  4. Select Preferences->Appearances and select your theme that you want, then click the Visual Effects tab. Select 'Normal' unless you want the wobble-on-window-move effect (which I hate because it makes it hard to accurately place the window). It should do some work, then ask you if you want to keep it. Say yes :). Then exit out of that.
  5. Select Preferences->CompizConfig Settings Manager
  6. Under Desktop, choose "Expo". This is half of the Spaces look-alike, though it doesn't *quite* work like Spaces. Under Expo Key, set it to whatever key you wish to use to enable Expo, either Windows-E (the usual setting, note that the Windows key is called 'Super' in this UI because the Compiz folks apparently hate Windows ;), or a function key of your choice. Note that I recommend using the 'Super' prefix for that function key, because otherwise you end up conflicting with applications, since normal keyboards don't have a 'fn' key like Mac keyboards that can be used to access regular function key codes of function keys assigned functions in the GUI.
  7. Expo won't work with four workspaces all in a row, so right-click on the four workspaces in a row at the bottom right of your screen, select 'Preferences' from the resulting pop-up menu, and set it to a 2x2 grid.
  8. Now you need to set your arrow keys left/right/up/down to move you between the workspaces. Click 'Back' in the Compiz Settings UI, and select 'Desktop Wall'. Click the 'Bindings' tab. Expand the 'Move within wall' collection, and set the Move Left/Right/Up/Down keyboard shortcuts. I suggest Super-left, Super-right, Super-up, Super-down.
  9. Okay, click Back, and now let's set our Expose'-lookalike. This is under 'Windows' and is called 'Scale'
  10. The question is, which one of these do you want to use? "Initiate Window Picker" allows "Expose" on all windows on the current workspace. Unfortunately, if you have a multi-monitor system, it puts all those windows onto the monitor where your mouse is currently residing. This gets very cluttered if you have two large monitors (I'm running a pair of 1050p monitors). In that case, I suggest using 'Initiate Window Picker for Windows on Current Output', which does it just on the monitor your mouse pointer is hovering over. I selected Mouse Button 9, the forward-arrow button on the left side of my mouse, to do this.
The end result: Something that approximates what Expose' and Spaces would have looked like if implemented by someone in the Communist-era USSR who'd approximately heard descriptions of how they worked, but had never actually seen them. You can practically hear the clunks of heavy metal and whirring of primitive gyroscopes as you activate them. The Expose-clone doesn't work well with multiple displays because of its bad habit of trying to collect all the windows onto the current display, thus requiring the 'on Current Output' kludge to avoid getting window overload. The Spaces clone requires more mouse clicks to move windows between "Spaces" (it doesn't simply exit to the workspace you just moved the window to, it stays activated until you double-click on a workspace), and doesn't have a handy icon to get to it quickly in case you're using a laptop that lacks a 9-button mouse (!). And like virtually all things dealing with Linux user interfaces, it takes a jillion-step process to get it configured and set up, with oodles of trial and error to figure out which X11 "mouse button" corresponds to which actual button on a mouse.

In short, Linux programmers still haven't figured out that users just want things to work. I've had to whack my own teams on the hands a few times when they brought back a design prototype that had oodles of screens, buttons and widgets to tweak -- "No, I want one input box here, one submit button there, that's all the user cares about, he just wants to do the job, he doesn't want to adjust all the internal stuff you're exposing here." Complexity is the enemy of user interface usability and consistency -- something which geeks seem to not understand, I've had to do this (shoot down too-complex user interfaces) repeatedly over the past ten years. Sadly, there is nobody to do this for Linux (well, except what Nokia did for Maemo, which works really well at giving a consistent user interface to all Maemo apps, but Maemo is pretty specific to its particular environment) -- and thus Linux continues being an incoherent mess for the average end-user.

Still, for my purposes, it works fine at keeping my workflow working while I run a bunch of KVM virtual machines with VNC viewers into them. So I'm a bit less grumpy today. But I sure wish there was a benevolent dictator for the Linux user interface the way there is for the Linux kernel itself... it's frustrating, the technology is there, but nobody has actually turned it into a coherent whole, and the distribution vendors seem either overwhelmed by the situation or just don't care. Oh well, back to work...

-ELG

Wednesday, May 26, 2010

Attack of the Linux Penguins

Recently I've been using Ubuntu 10.04 Lucid Lynx as my desktop development system. This is the first time in a long time that I've used Linux on the desktop -- for the past three years I've been using MacOS on the desktop, sharing the source code tree via NFS to a Linux VMware client to do compiles and testing. Since what I've been principally doing during this time is appliance and distribution design, the fact that VMware is not the speediest of environments did not make much difference.

However, I needed more virtual machines to look at potential client configurations than I could easily fit on a Macbook Pro, even the very well endowed Macbook Pro that I own (which has 8 gigabytes of memory), so clearly I needed to throw more hardware at the problem (heh! Typical software engineer answer!). So I installed 10.04 on a well-endowed desktop/server system complete with RAID5 array and 8GB of RAM, and set out to configure clients using the KVM (Kernel Virtual Machine) system that comes with Ubuntu 10.04.

So, the Good:

  1. KVM rocks. The performance I get out of KVM is far superior to anything I've ever experienced with VMware even on faster hardware. I am currently running a load on my system that would have both cores maxed out under VMware due to VMware's per-VM overhead. Under KVM, I'm at around 30% on both cores.
  2. The Virtual Machine Manager that ships with Ubuntu for managing KVM is far easier to use than the latest editions of VMware Server's management UI, but not as good as the VMware Fusion management UI on MacOS in that it doesn't have any equivalent, as far as I can tell, of the VMware Tools module that allows transparent window pointer moves between the KVM virtual screen window and the host OS screen.
  3. Gibber is a really cool Twitter/Facebook/etc. client, easily as good as anything on MacOS. I especially like its multi-pane capabilities for viewing multiple streams in parallel.
  4. Performance in general rocks. It feels snappy and things happen quickly, even though it's running software RAID5 so you'd expect significant overhead from the disk driver. But there isn't -- Linux's cache-block elevator does very well at optimizing RAID access.
Now for the bad:
  1. The user interface in general is reminiscent of mid-1990's Windows. It looks and feels dated and obsolete, and lacks many of the modern navigational aids of Windows 7 or MacOS 10.5.
  2. While I got multi-screen support working for two displays attached to my nVidia 7900 video card (which has two outputs), the dated UI gives no easy way to navigate between the various applications open on the two screens. The window boxes clustered at the bottom of the leftmost screen are not easily accessible from the rightmost screen, and there's no equivalent of Apple's Expose' or Windows 7's similar application-picker function that can be bound to a mouse button so selecting an application is a mouse button away.
  3. Neither the KDE nor Gnome filesystem browser allowed providing a user name/password to a CIFS server whose shares you wished to list. As a result, I could not use the CIFS browser to browse to shares on my Mac or on our Windows servers here on the office, neither of which will provide you with a share list unless you authenticate first. On the Mac, this Just Works -- the initial attempt to get the share list fails, but then you click the "Connect As" button, put in the user name and password, voila.
  4. In general, integration with Apple and Windows networks was pathetic. I was reduced to doing manual mounts via the CLI mount.cifs command, which I should never have to do on a supposedly modern desktop operating system.
And finally, the ugly:
  1. KDE on Ubuntu 10.04 is atrocious. There is an important directory service under KDE that sucks up gigabytes of RAM. I had to switch back to the unsatisfactory, but at least functional and efficient, Gnome UI to get work done. KDE used to be fast and clean, but it has become as bloated and dysfunctional as Windows.
  2. Multi-screen support on 10.04 has taken several steps backwards. Window managers crashed when I used the standard X11 Xinerama extension. So I used the proprietary TwinView nVidia driver for my nVidia 7900 video card (a high end card from two generations back, somewhat obsolete today but I use it for Linux because its support is mature) and now multi-screen support is back... but only for the displays attached to this single video card.
My conclusion: Ubuntu 10.04 is thus far the closest that Linux has gotten to a usable desktop operating system. It is a state of the art desktop environment -- if you have been locked in a server room with pizza slid under the door for the past 15 years and still think Windows 95 is the be-all and end-all of user interface design. Both Windows 7 and MacOS 10.5/10.6 put it to shame on all measures of appearance and usability.

I can appreciate the effort that has been put into Ubuntu 10.04, and the difficulties involved in trying to turn a mass of random software from miscellaneous strangers into a coherent operating environment. But that does not change the fact that Linux on the desktop remains stuck in a time warp, fighting the battles of two decades previous in an era where time has moved on. It is especially sad that KDE today is no more usable than KDE 2.0 was ten years ago -- indeed, is *less* usable because of the bloat that has been put on top of what was a clean fast simple and well-integrated user interface. KDE has become a 1959 Cadillac, with fins the size of a aircraft tailfin and a thousand pounds of chrome weighting it down as it staggers down the highway like a bloated whale. Windows 7 suffers from some similar user interface bloat, but it has an excuse -- it's Windows. KDE has no such excuse.

So for the meantime, here's what I say: If you want a coherent, usable user environment, buy a Mac. If you want a fast server environment, use Linux. And if you want something that's neither as coherent as a Mac or as good as a server as Linux, then run Windows 7, which gives you a mediocre implementation of both worlds. As for me, I'm going to stick with my Mac on the desktop, and continue using Linux on my server. That gives me the best user environment *AND* the best server environment... but not, alas, in the same box. So it goes.

-ELG