biotext.org.uk

Tag: OS X

How to make sure your media disk is mounted before starting iTunes

by Andrew on Dec.30, 2009, under Tips

This is an Apple Annoyance that’s been bugging me for a while — if your iTunes library is on an external HD, and you start iTunes without it mounted, the bloody thing can seriously mangle its own library index (under Tiger at least).

So I’ve replaced my iTunes Dock icon with a little AppleScript that checks whether said disk is mounted first:

1
2
3
4
5
6
7
tell application "Finder"
	if exists (disk "LaCie") then
		tell application "iTunes" to activate
	else
		display dialog "Don't start iTunes without LaCie external disk mounted." buttons {"OK"} default button 1 with title "Cannot start iTunes" with icon stop
	end if
end tell

Compile, save as script, add to dock, bingo. (Obviously, replace LaCie with the name of your external HD, as it appears in /Volumes when mounted.)

For extra points, you can give it iTunes’ icon too. Just get Info on iTunes and select the little icon in the top left (not the big one under Preview). Then just cmd-c, select the same icon in the script’s info window, and cmd-v.

Leave a Comment : more...

MacBook keyboard hacks for # (hash/pound/numbersign)

by Andrew on Nov.07, 2009, under Tips

One of the few annoying things about my oldish MacBook Pro is its keyboard, for example a few unresponsive keys, but particularly the lack of a # key. It’s a UK keyboard, and has £ for shift-3, and # is hidden in alt-3 (not labelled).

This is fine in native desktop apps, but less fine in some text-mode programs (e.g. vim), when for some reason this often produces a superscript 3 instead.

So I’ve set up a custom keyboard mapping in iTerm to map F3 to #, which works nicely. However!

If I’m SSHed in to a remote Linux machine (or even my local Ubuntu VirtualBox) neither of these keys work in X apps. But, xmodmap (via the config file ~/.Xmodmap) can help. For some reason, Macs all have a dedicated key for these characters — § and ± — which no-one ever uses. But with this line in ~/.Xmodmap we can remap it to produce #:

keycode 18=numbersign

UPDATE: I’ve found a better way which works pretty much globally…

Using Ukelele you can copy the British keyboard layout and then remap keys to your heart’s content. I’ve moved the § character to the alt-§ key combination, in case I ever need it, and moved the # character to the raw § key. This seems to be respected almost everywhere so I don’t need to mess around with alt-3 or F3 any more. Joy. It also works over JollysFastVNC to a remote RealVNC server, which none of the other methods did.

Unfortunately, things still aren’t perfect. If I actually open a VirtualBox console session into GNOME on the local Ubuntu VM, the pointless § and ± key actually produces < and > so neither of these tricks work. In fact, I can’t get anything to generate a # even though I have the MacBook Pro Intl keyboard layout selected in GNOME. Any ideas?

UPDATE 2: YES!! I’ve finally cracked it for VirtualBox. With the help of the xkeycaps command, I discovered that X the keycodes coming into Ubuntu weren’t what I thought they were — somewhere the Mac-ness of the keyboard layout was getting lost. It turned out that the § key was generating keycode 94 instead. So I set up this in .Xmodmap on the Ubuntu VM:

keycode 94=numbersign

Now it works in VirtualBox too. Leave gifts of thanks below :-)

Leave a Comment :, , , , more...

Running RasMol from Firefox and Finder in OS X

by Andrew on Mar.24, 2009, under Tips

A colleague asked me today, how can we set up someone’s Mac to open .pdb files in RasMol when clicking a .pdb link in Firefox. This turned out to be a non-trivial operation. Here’s how I did it, with RasMol 2.7.2 and Firefox 3.0.7 on OS X 10.4.

(continue reading…)

Leave a Comment :, , , more...

Search

Use the form below to search the site:

Leave a comment if you can't find what you need.