Category Archives: English

Mission Control grabbed my keyboard shortcuts

The previous so called “Spaces” are now part of “Mission Control” in Mac OS X 10.7 Lion. It implements multiple work spaces as known from common Linux desktop environments.

Unfortunately it grabs the global keyboard shortcuts Ctrl-1, Ctrl-2, …, Ctrl-0 and Ctrl-Option-1, Ctrl-Option-2, …, Ctrl-Option-6 to switch to the corresponding space by default. This prevents using any of these shortcuts in an application. I had defined some of those for use with my favorite editor vim, where the shortcuts ceased to work after the upgrade to Lion.

Even more unfortunate, it’s a tedious task to stop Mission Control from allocating these keyboard shortcuts. The GUI offers the configuration check boxes only for spaces which are currently enabled.

So the solution was to enable all possible spaces, which are capped at a maximum of 16, using the Mission Control interface. Then disable the check box for each of them in System Preferences > Keyboard > Keyboard Shortcuts.

As said a tedious task, but works. I was hoping to provide some defaults write command here, but I was unable to determine where these settings are stored.

tvtime on Linux kernel 2.6.38 without V4L1 API

My favorite application for watching analogue TV is tvtime. Unfortunately it has not been updated for a few years now. As is the rule for unmaintained code, the upstream version finally is no longer compatible with Linux kernel 2.6.38. The V4L1 API has now been removed after being deprecated for a really long time.

But Devin Heitmueller from KernelLabs invested some time to remove the parts from tvtime that still needed the old API. The source is available from this mercurial repo.

hg clone http://www.kernellabs.com/hg/~dheitmueller/tvtime
cd tvtime
autoreconf -i -f
./configure --prefix=/usr/local --disable-nls
make
make install

There is also a report in Gentoo’s Bugzilla with a new ebuild attached, but I haven’t tried that. Installing the new patched tvtime to /usr/local works for now.

I am all ears if anyone can recommend an alternative to tvtime. I know about xawtv, but the interface is poor and offers less features than tvtime.

Hauppauge WinTV HVR-1300 with Linux kernel 2.6.38

After the upgrade to Linux kernel 2.6.38, the boot process for my machine hang quite long while Populating /dev with existing devices through uevents. After investigations it turns out that the cx88 driver used for my Hauppauge WinTV HVR-1300 tv card was not correctly converted to the new mutex system while removing the BKL. This is being tracked in the kernel bugzilla as bug #31962.

Fortunately, there is a patch attached to the mentioned bug report which resolves the problem:

cd /usr/src/linux
wget -O cx88-2.6.38-fix-driver-deadlocks.patch 'https://bugzilla.kernel.org/attachment.cgi?id=53722'
patch -p1 < cx88-2.6.38-fix-driver-deadlocks.patch

[Edited on 2011-04-23: replaced patch 52902 with 53722]

After applying the patch, build and install your kernel as usual. But there are still some more problems with 2.6.38 related to tvtime. See also my next post.

I do not follow kernel development close enough to know in which git tree this has to show up to confirm if it has been merged yet. Hopefully this patch will make it into the next kernel release.

bash: for-loop with glob patterns

It is common to use a for-loop with glob patterns:

for i in *.txt; do
    mv $i $i.old
done

But if the glob pattern does not match anything it will be preserved unchanged in the command. This results in command execution of mv *.txt *.txt.old which fails because no file named *.txt (literally!) exists.

As this is not the desired behavior, here is a way how to do this as expected without forking using the nullglob bash shell option.

oldnullglob=$(shopt -p nullglob)
shopt -s nullglob

for i in *.txt; do
    mv $i $i.old
done

eval "$oldnullglob" 2>/dev/null
unset oldnullglob

This will silently prevent the execution of the mv command. If you use failglob instead of nullglob bash will interrupt the evaluation of any command if the glob pattern did not match anything.

Disclaimer: Be careful with this option, as this will not be the expected behavior in all cases. Most (in)famously it breaks bash-completion if you set it in your interactive bash session. I suggest to use it temporary only.