Visigami

Wednesday, April 30, 2008 at 2:33 PM





I've always enjoyed searching for images on the web, but then it occurred to me that it would be really fun to be able to present the images in a more interesting way than typically seen in a web page. So, I decided to write Visigami, which is both an image search application and screen saver. We're making it open source (Apache license) on code.google.com and I hope you'll have as much fun playing around with it as I did writing it.

Right now Visigami can search from three different image sources: Google Images, Picasa, and Flickr. In the application, there's a search field where you can type a query. Images matching the query will then start animating on the screen. You can animate the images in several ways: fan, carousel, and grid. And there are a few different camera views: fixed, autopan, and mouse pan. There are sliders for adjusting settings such as display speed and zoom. The screen-saver uses exactly the same settings you choose in the application. Although the options panel for the screen-saver works, it's easier to tweak the settings in the application than to run the screen-saver.

Here are some tips on using the application:

* Use your mouse's scroll wheel to zoom in and out.
* While in "mouse-pan" mode, click in the image view and hold the Option key down to move the images with the mouse.

Have fun with Visigami. I'm always open to any feedback you may have.

AppMenuBoy

Tuesday, April 29, 2008 at 1:47 PM



Back in the days of Mac OS X Tiger (10.4), you could drag your Applications folder to the Dock and get a nice menu of your applications there. If you had any folders in the applications folder, you'd get hierarchical submenus in the Dock's Applications menu.

Apple turned this feature off in Leopard (10.5), replacing it with a simpler, less capable version. It came back partially in 10.5.2, when Apple added a list view for the Applications menu and other folders you add to the Dock.

My application AppMenuBoy restores the Tiger behavior plus a little more: it shows only applications, follows aliases, and if a folder contains only an application, it silently "hoists" that application in the menu so you don't have hierarchical menus that contain only a single icon.

The AppMenuBoy application is now featured on the Google Mac Developer Playground.

Manipulating keyboard LEDs through software

Thursday, April 17, 2008 at 11:50 PM

Over the last few years, on my websites and in my book, we have discussed how to access or manipulate several interesting Mac components: the sudden motion sensor, trusted platform module, infrared remote control, system management controller, traditional input devices, the backlit keyboard lights, the ambient light sensor, and so on. (Not every Mac has all of these components.) The most popular of these by far turned out to be the sudden motion sensor, which went on to be a building block for many, many cool programs.

Speaking of lights, there are some lights on your computer that we haven't talked about yet. The caps lock and num lock LEDs on your keyboard (not all keyboards have these) are examples. These LEDs can be manipulated through software: you can both query and alter their state from your own programs.

If you have an irrepressible urge to turn these LEDs on or off through software, here is a program that shows you how. (Note that the program only manipulates the LEDs — it will not actually cause caps lock or num lock to be engaged.) The program also serves as an example of how to do user-space Human Interface Device (HID) programming through the I/O Kit.

The program should work whether you have a wired USB keyboard or a Bluetooth wireless keyboard. Compile and run the program as follows.


$ gcc -Wall -o keyboard_leds keyboard_leds.c \
-framework IOKit -framework CoreFoundation
$ ./keyboard_leds -h
...

Usage: keyboard_leds [OPTIONS...], where OPTIONS is one of the following
-c[1|0], --capslock[=1|=0] get or set (on=1, off=0) caps lock LED
-h, --help print this help message and exit
-n[1|0], --numlock[=1|=0] get or set (on=1, off=0) num lock LED
...
$ ./keyboard_leds -c # query caps lock LED state
off
$ ./keyboard_leds -c1 # turn caps lock LED on
off
on
$ ./keyboard_leds -c0 # turn caps lock LED off
on
off
...

Receiving Apple infrared remote control events

Tuesday, April 08, 2008 at 3:42 PM



Most Mac models today ship with a six-button remote control and matching built-in infrared receiver. The remote control's primary purpose is to drive Apple's Front Row media application.

But maybe you'd like to use the remote for your own experiments. There are several software approaches to obtaining remote-button-press information. One of them is to communicate with Mac OS X's in-kernel infrared driver, which is implemented by the AppleIRController kernel extension. The I/O Kit layer in Mac OS X, which we would use for this kind of communication, is particularly powerful and flexible when it comes to allowing user-space access to hardware. So this approach is quite nice.

iremoted is a command-line program that uses I/O Kit interfaces to talk to the infrared driver and prints information about button presses and releases as they occur. I recently overhauled iremoted for Leopard, and the new version should work on both Tiger and Leopard. Moreover, the source for iremoted is now also available.

Enjoy talking to the remote control!