Tuesday, June 5, 2012

Ubuntu 12.04

So, it's been quite a while since I last used Ubuntu. The most recent version I used prior to yesterday was 6.06. ...Yeah. This will basically be an "impressions and some useful tweaks" post.

Overall, in the graphics department, Ubuntu has come a long way. I remember popping a freshly burned CD of Ubuntu 5.04 into a CD drive, booting it, and seeing that ugly as all fuck brown theme for the first time. Now it's actually pleasing to the eye.

Usability-wise, well, it's Ubuntu. It's the Windows of Linux. If you can't see the nice big Firefox icon and click it to browse the internet, well, you're probably blind. The thing it's on, called the Dash, works similarly to the taskbar in Windows. The button up at the top brings up a screen that immediately shows you the programs you've run most recently, and it has a search box so you can type in the first few characters of what you're looking for. This is neat for novices, but to be honest I prefer the old Applications menu structure, and I'm dying for some menus so I can organize things.

Thus begins a long list of things I preferred about older Ubuntu distributions. They didn't adulterate the environment so much, leaving it up to you to customize its look and feel from thousands of options. This one has about three options for the look and feel. If you don't like those, well, you're stuffed.

The settings program is fairly straightforward and I was able to tweak a few things to my liking through it, but two of the big things I like that I can't adjust through it are the workspaces and sloppy focus on the mouse cursor. In fact, even though there's a nice button on the dash that shows four workspaces, I can't get into any workspaces other than the first one. I even made sure I had the keyboard shortcut for changing workspaces correct. Still, the button is useful in that clicking it shows you all the windows on the current workspace and you can click one of them to focus it. So if you have a lot of stuff open and overlapping, it makes it easy to find the window you want.

Ubuntu also has an "app store" of sorts, which is basically their replacement for the Synaptic package manager from earlier versions of the distribution. In addition to letting you install free packages, you can buy commercial Linux programs through it. Including a lot of popular indie games, like Braid, World of Goo, and more. Heck, you can even buy the Humble Indie Bundle 5 through it. I'd get the bundle, but... I already have Psychonauts and I'm not too interested in the rest of it.

Ubuntu also has a cloud storage service called Ubuntu One. Just by using Ubuntu, you get 5GB of free cloud storage. Which is cool if you have files that you want to be accessible from elsewhere and maybe happen to lack a USB flash drive with the capacity to store them all. But generally speaking, you probably already use Dropbox and will be installing the Linux Dropbox client.

Getting a multi-monitor setup going is fairly simple. To do it entirely within the GUI without having to mess around with config files, you pretty much need to install the proprietary drivers for your graphics card, which are recommended anyway because your visual experience and 2D/3D performance will be greatly increased in comparison to the open source driver.

However, multi-monitor in Linux does have its nuances in comparison to Windows. When watching YouTube, if you have hardware rendering on, the hue of everything is off and it all looks blue. Fullscreen works as expected in this mode, though. If you disable hardware rendering to get correct colors, Flash sees both monitors as one big desktop for the purpose of determining your screen resolution. So it sets its fullscreen window to that size. But then it goes "oh hey, our fullscreen window shouldn't span monitors!" and scales it down to fit in one monitor. So what you end up with is a really wide and not very tall fullscreen window. And since Adobe has discontinued Flash for Linux, it won't ever get fixed. All the more reason to promote HTML5 video, I guess.

As far as running Windows programs is concerned, you have to install Wine. Wine is essentially an open source implementation of the Windows API and all of its libraries. The majority of regular old Windows programs will simply work out of the box, with no configuration changes. It's when you delve into the realm of playing Windows games that you start having to mess with things. Fortunately, there's another package called Winetricks that helps greatly with that.

Overall, it's pretty easy to use, but parts of the whole ease of use thing grate on me because I want to get in and tinker with things and Ubuntu doesn't really want you to get in and tinker with things. Still, it's decent for an intro to Linux, and proof that Linux is more than ready for the desktop. Tweaks after the break.
Now, on to the tweaks. A bunch of this is just extra packages I needed for daily use that I installed, but some of it is for usability with my trackball. All of this is done from the terminal, so if for some reason you're following along, you'd do well to open it up.

The very first thing I did was use xmodmap to swap some buttons around on my trackball. It has buttons in each of the four corners around the ball itself, and right click defaults to the lower right corner. I like it in the upper right corner. Fortunately, this is easy to solve using xev to figure out which button is which and then remapping with xmodmap. In my case, xev told me that the lower right button's id was 3, and the upper right button's id was 8. Thus, the xmodmap command looks like this:

xmodmap -e 'pointer = 1 2 8 4 5 6 7 3 9 10 11 12'

Pretty straightforward, to be honest. Button 8 becomes the third button, which inherits the role of right click, and button 3 takes over button 8's old role.

Then, I installed xbindkeys and xautomation, along with a few other packages I wanted. It's quite a shame that I've never found the xte program provided by the xautomation package on a different distro. First, to do this, you have to enable the universe and multiverse repositories. That's fairly simple, but does involve editing a config file:

sudo nano /etc/apt/sources.list

Once in there, I added 'universe multiverse' to the end of every line that had 'main restricted'.

Now that I had the repositories enabled that contain the packages I wanted, I set things in motion.

ttf-corefonts-installer - the Microsoft Core Fonts for the Web. They made these freely available a while back in the interest of cross-system compatibility. They're no longer available from MS, but the community keeps them maintained via sourceforge.

xautomation - Provides us with the xte binary, which uses the XTest Extensions to let us generate fake input events.

xbindkeys - Allows us to easily hook a keyboard/mouse combination and define a program that should be run when that combination is pressed.

The first two we'll get to are xautomation and xbindkeys. The first thing you do after installing xbindkeys is run this in a terminal, from your home directory:

xbindkeys --defaults > .xbindkeysrc

This generates the file that xbindkeys will read its configuration from and pre-fills it with some examples to get you started. The next thing I did was open ~/.xbindkeysrc so I could configure my double click button:

"xte 'mouseclick 1' && xte 'mouseclick 1'"
b:8 + Release

That sets up button 8 on the mouse, which if you remember from the bit about xmodmap above, we swapped with button 3. Button 8 is now the lower right button. We hook both its press and release events with this, and run xte twice to generate two clicks. Technically we could just do xte 'mouseclick 1 mouseclick 1', but all my attempts to get that to work failed, as it only generated one click event (both press and release).

After that, all that's left to do is start xbindkeys:

xbindkeys

Derp. Anyway, trackball remapped and double click button configured, all without any kind of official software from the trackball manufacturer. The other things either need less configuration or are configured more to taste than any specific purpose.