Archive for the 'Apple' Category


Chromium for Mac install script

Chrome isn’t officially out for Mac yet, but in the mean time you can get Chromium — the open source version — to give it a try. It is not recommended to use Chromium for daily browsing at this stage! (although you can of course, but don’t transfer money with it okey?)

For me the problem is that it gets developed quite fast, so instead of downloading it every day I wrote this installer to make it easy to get the latest version:

curl$(curl >
killall Chromium
rm -R /Applications/
cp -R chrome-mac/ /Applications/
rm -R chrome-mac
open /Applications/

All you need to do is paste this in a file and run that file by dragging it into You might just as well open Automator and add the ‘Run Shell Script’ action to it with this code, or make a crontab/initd to run it automatically.


[updated] Mobile Safari better then Safari 4?

[update]: The latest Webkit does support 3D transitions! Examle

Screen shot 2009-10-11 at 3.20.07 PM

Today I was reading about developing web apps for my iPod touch. While reading this article about CSS animations I downloaded the example. To my surprise the example said it required iPhone simulator to run. Stubborn as I am I tried to open it with Safari 4… This gave the following result(try for yourself!):

Picture 11

Surprised as I was I opened it with the iPhone simulator, which yields this result:

Picture 13

It seems that the iPhone supports 3D and perspective css statements that Safari 4 does not support. Isn’t it strange that a mobile device can do things a full sized computer can’t(except for trowing with it while holding a drink in your other hand)? My first thought was that the Mobile Safari was released after Safari 4, so it might have a newer version of Webkit(that’s what powers Safari and Chrome). But the oposite is true, Safari 4 runs Webkit 530.18 and my iPod Touch runs  528.18. I’m to lazy to compile a nightly build of Webkit to see if it works, but until then I got no clue why Safari 4 can’t do this CSS magic.

Here are 2 screenshots of the browser string of both:

Picture 12IMG_0007


Ipod touch WiFi mouse with Python (web app)

You might know it is possible with several applications to turn your iPod Touch or iPhone into a wireless mouse. You download/buy the app in the app store, install the server and voila, finished!

This works perfect, so why did I make another one? I think the problem is that you need a client and a server. Maybe the best option would be making an app that implements the Bluetooth mouse protocol so you can use it as a normal Bluetooth mouse. The problem with that is that I don’t know anything about C or Bluetooth. So I reversed the plan and made a server without the need for a client.

I’ll explain how it works. I wrote a Python app that extends the Python built-in webserver to server an empty html document. Well… almost empty, it only contains some JS to send back the touch events. Back at the server I register the events and move the mouse.

Although ‘move the mouse’ sounds easy, that is the most complicated part of the application. It currently only works for Windows and Mac.

The advantage of using Safari is that it gives us JS access to all touch movement as wel as allowing for portrait and landscape mode and pinch-to-zoom for detailed movement. In the future I might add a text field to send text to the computer, but this would be another cross-platform horror…

You can download the app form my box widget in the sidebar. Just run it with Python and point you iPod touch/iPhone to <computer ip>:3333


Control the mouse on Mac with Python!

It’s 00:30 now here… After searching the internet for the whole day I finally found to move AND click the mouse with Mac OS X!!!

This link on StackOverflow got me on the right path. It explains how to use pyobjc to move the mouse around, but this does not include clicking it 😦 After a few more hours of Googling I found this extra piece of information for writing a command line click utility. But the pyobjc nor the Apple functions are documented very well, so I had absolutely no clue on how get the function into Python.

Then I finally found this xml document… I had nearly did away with it as it looked useless at first. Until I noticed that at the function described in the first document it showed {CGPoint=ff}, this piece of code was confusing me the most about this whole stuff. Well, the rest was guesswork at the interactive shell… ‘v{CGPoint=ff}III’ is the final string I came up with.

So here they are!

import objc

def clickMouse(x, y, button):
    bndl = objc.loadBundle('CoreGraphics', globals(), '/System/Library/Frameworks/ApplicationServices.framework')
    objc.loadBundleFunctions(bndl, globals(), [('CGPostMouseEvent', 'v{CGPoint=ff}III')])
    CGPostMouseEvent((x, y), 1, button, 1)
    CGPostMouseEvent((x, y), 1, button, 0)

def moveMouse(x, y):
    bndl = objc.loadBundle('CoreGraphics', globals(), '/System/Library/Frameworks/ApplicationServices.framework')
    objc.loadBundleFunctions(bndl, globals(), [('CGWarpMouseCursorPosition', 'v{CGPoint=ff}')])
    CGWarpMouseCursorPosition((x, y))

How I think it works:

  1. The first line works like an import statement to include CoreGraphics… nothing Python related happens here.
  2. The second line is the most important one. From the just imported bundle it imports the C function to Python… I think the second part is for mapping Python data types to C data types.
  3. Line 3 and 4 run the fresh C function with Python data types! (once for keyDown and once for keyUp, otherwise Finder gets stuck)


My blog has moved!

My blog has permanently moved to a self hosted Wordpress at

This blog will stay around for accidental search engine visitors.


This is me

Blog Stats

  • 22,921 hits