Sunday, August 10, 2008

Hack all Day, Run all Night

Late last week I did a good old emerge --sync && emerge -uD world (and etc-update, too, if you want to be pedantic about it) cycle, and X started auto-detecting my monitor's available modes. Yeah, "welcome to the 90s, Al," but I generally stick to not running ebuilds until they come unmasked, which keeps me a bit behind the times. I'm still on Firefox 2.0.0.16, in fact. It actually discovered a higher resolution available for my crappy old monitor. Yay, more pixels! Since my fonts are mostly set by point sizes and X does DPI correctly, they were mostly immediately occupied by larger (in pixels) but smoother fonts.

So this led me to screw around finding what else X can autodetect now. Turns out you need almost nothing in your xorg.conf these days; actually I think that's been true for a while, even as far behind the times as I am, I just haven't bothered to mess with it until more recently. Specifically I started getting into xkb.

It turns out the version of xorg-server that allows one to set keyboard hotplug rules in a /etc/hal/fdi/policy/... file is still masked, but for some stupid reason, even though my keyboard worked fine, I kept messing with the settings. You see, the keyboard is a Sun Unix keyboard. It looks like this (it's probably cut off by the sidebar, but you can click on it to see it alone!):



I'm not sure if the guys that wrote Unix back in the 70s would be proud, amused, or bemused to hear people say stuff like this, but it certainly is often said that Unix is more of an ideal than an operating system. Implemented by many, never perfectly, probably getting worse with every new feature, but occasionally making feeble gestures towards perfection. Which is sort of why a bunch of those dudes plus several others wrote Plan 9, although those guys are real engineers and not pretentious dweebs that can program a little (see Dimond, Al), so they did it more for real technical reasons. At least that's what they think. Anyway, Unix being an ideal and all, it's been true for a damn long time that when you plug a Real Unix Keyboard into a computer running x.org, the major implementation of X, the major Unixy graphical system, X just goes on thinking it's a Windows keyboard. Alt Graph, Compose, Meta (the ones with diamonds on them)? Those keys have real meanings to Unix. And X always thought they were the Alt, Menu, and Windows keys, respectively.

And I could tell X to treat the right-side Alt as Alt Graph, the Windows keys as Meta, and the Menu key as Compose. Lots of people do, even people with normal Windows keyboards, so it's really easy to do. But I care what X thinks about the keyboard attached to it. Yes, it's important to me that my graphics subsystem knows it's running on a computer with a Real Unix Keyboard plugged into it. No, I do not have a girlfriend. If I did have a girlfriend I would care what she thought about keyboards; mine, hers, and just general thoughts. But I would not configure her user profile on my box to switch the Control and Caps Lock keys to the vulgar Windows-keyboard positions. I would do anything for love, but I won't do that.

The way you tell X what sort of keyboard you have is with xkb. It has a somewhat-complicated configuration system that's documented fairly inconsistently, even for a piece of software. It's actually hard to set xkb up the Right Way; most people are content when it works. I did finally get it working and Right. Mostly. Two flaws. The blank key up where Esc is on most keyboards gives the same keycode as the Props key (this is a known problem on many keyboards related to scancode-keycode translation and the fix is using the evdev driver, which is an trial for another day). And there's a "Compose" LED that doesn't light up, which I suspect is either a problem in kbd's USB HID support which will be fixed when I switch over to evdev, or a limitation in Linux's USB HID Keyboard support, which would be most disappointing. Close enough for now. I decided to look around to see if I could submit my changes upstream so other people with the same desires as me could have an easier time of it and found that someone had beat me to it, in the most recent release of xkeyboard-config. Most recent unmasked version in Portage is two versions back. Grumble. Whoever did it, though, made almost the exact same changes I did. The same feeble gestures.

So anyway, after all that I went running. About a half-mile from the end, at Cermak and Racine, I stopped to stretch. The sky was very clear over Pilsen, and immediately down Cermak there aren't really many tall buildings, just low-slung factories and warehouses. So I could see the Dan Ryan in perfect clarity, hovering over everything a half-mile away, and the green overhead sign probably announcing the Stevenson; this-a-way to Joliet, St. Louis, New Orleans, that-a-way to Lake Shore Drive. And though there were no clouds overhead there were low clouds over Lake Michigan, which in the distance looked like mountains. The whole scene reminded me of San José. And reminded me that although I have now rode a century, I still have to ride the century over Mt. Hamilton (or mountain of equal or greater value).

1 comment:

heatrose said...

so i have to admit that i didn't read most of this post, 'cause i'm tired but was like "hey i haven't read al's blog in awhile", and when this looked all computery i figured it'd require more wakeful brain processing power than my brain was feelin', i skimmed it (and i did read yr more recent post abt eating dog penises right now, but can't begin to address that. recall: tired. thinking about it might actually give me nightmares.).

but then came the last paragraph. and "cermak and racine" caught my eye. and then i was forced to read on, petrified that You Had Seen smallTrain (this capitalization pattern not official, just used to go with the computery theme)... before i had. because i'm a bad person like that, and would be jealous. also, curious.