Making Desktop Webapps in Lion
“By the sainted mustache of Charles Foster Kane! Is it ever hot out there! I should write an app that keeps my city’s Current Weather data from Weather Underground within easy view at all times!”
“Holy rosemary vinaigrette! Today promises to be a huge day of news for Apple! I need to keep an eye on the news from Macworld.com all day today! But there’s no such app for that particular function, dagnabbit!”
“Jumping prophets of Newton Lower Falls! I’m getting far too much work done today! If I don’t find a way to distract myself, I’ll set unreasonably-high expectations of how much work I’ll be expected to accomplish on a Friday! If only there was a way to keep the Adorable Baby Polar Bears Live Webcam on my screen at all times!”
If you’re running Snow Leopard, you’re doomed to a dull life of unmet expectations. At best, you’re at the mercy of third-party developers and their infernal expectation to actually be paid for the apps they write.
In Lion? It’s DIY all the way. Automator — that singularly-awesome utility and infrastructure for automating damned-near any task — has a new feature that allows you to open any webpage inside a popup window. It’s so easy to use and it’s so goddamned useful that I’m amazed it’s not being promoted.
Here’s the incredibly complicated procedure for building an app that keeps a webpage open in a floating window:
1) Launch Automator.
2) Create a new App. (Or a Workflow. But an App will be cooler because you can have it in the Launchpad and start it up with a single click.)
3) Find and drag the “Get Specified URLs” action into your workflow. Just type the name into the search box until Automator finds it for you.
4) Paste in the URL of the site you want to view.
5) Find and drag the “Website Popup” action into the workflow. Choose a size for the window.
6) Save. Done.
Your workflow will look like this:
And when you run the app, it’ll put up a popup window that looks like this:
It’s a real app. It’ll stick around and float above your other windows until you dismiss it. You can move it into other Spaces and do pretty much whatever you want with it.
Did you notice the Really Clever Thing the “Website Popup” does? You can specify the size of the popup window and you can also choose how the app will identify itself to the website. In this example, the “User Agent” has been set to “iPhone.” Which means that Macworld.com thought this app was an iPhone web browser, and it automatically delivered the compact edition of the site.
It’s a little like the “Web Clippings” feature of Dashboard. Except this isn’t Dashboard, so there’s actually a chance in hell that you’ll ever use this thing.
The less-snarky thing to say is that this tool integrates into your mainstream Mac workspace far better, and its definable User Agent setting means that you can get it to work with the far more useful mobile editions of your most useful sites. It’s particularly keen for webcams. A friend recently set up a webcam for his pet birds. As a Dashboard Web Clipping, I’d have to carefully adjust the clip size and then I’d have to be in Dashboard to actually use it. I also couldn’t share this with other people. As an Automator app, it’s two quick steps, it runs alongside my other apps, and any time my friend wants to share the webcam with someone, he can just email them the app.
I think the Automator team at Apple has two mandates. The first one, of course, is to give every Mac user more power and control over how they do things, to save everybody time, and to restore the sort of volksprogramming experience that the Mac community lost when Apple terminated HyperCard.
But the self-appointed mandate is to keep emphasizing the truly cool things that you can do with this utility. With each new OS release, there comes at least one new Automator action that I play with for a while and then think “I can’t believe I built something that does this in that little amount of time!