☁ Stormcloud

RSS

Fix for Finder windows that forget view options

If a particular folder seems to lose its view options (anything set in View → Show View Options) every time you log out or restart, check if the file .DS_Store exists in that directory. (Replace [path] with the path to the directory that doesn’t remember its view options.)

$ cd [path]
$ ls -la | grep .DS_Store

Throughout this article, lines that start with $ are commands to be entered in a terminal window. Lines that do not start with $ are the output of the previous command.

If the file doesn’t exist, and isn’t created when you adjust view options for that folder, that’s why the Finder is forgetting its view state. You can create the file yourself, and then the Finder will start saving your settings to it. Run the following command in the same directory:

$ sudo install -o root -g admin -m 0664 /dev/null .DS_Store

This creates an empty file, which should now look like this:

$ ls -la | grep .DS_Store
-rw-rw-r--    1 root  admin     0 Aug 19 11:50 .DS_Store

Regular users (with admin privileges) are members of the admin group, but not wheel.

Change some view settings in that folder, and then check if the size of .DS_Store has changed:

$ ls -la | grep .DS_Store
-rw-rw-r--    1 root  admin     6148 Aug 19 11:50 .DS_Store

If the file size is no longer 0, the Finder is successfully saving your view settings, and from now on they should be honored.

If the size is still 0, make sure the parent directory has write privileges for admin. If it’s still not changing, try restarting the Finder, then check again.

$ killall Finder

Mountain Lion: desktop icon issue

There’s a similar issue with the desktop view options in Mountain Lion that affects some Macs. When icons are dragged to the desktop, they always move to the top-right as if auto sorting is enabled (regardless of the “Sort By” setting in View Options). If you’ve tried changing that setting to “None” or “Snap To Grid”, but icons are still automatically being sorted, try deleting the .DS_Store file for the desktop:

$ cd ~/Desktop
$ rm .DS_Store

Now log out and back in, and see if the problem has been resolved. If it’s still happening, try restarting your Mac (make sure the “Reopen windows when logging back in” option is not checked). You may need to restart a couple of times to make it stick.


Thanks to Trevor for the one-line command for creating the .DS_Store file with the proper owner/group/permissions.

OS X: How to set up custom keyboard shortcuts that actually work

Since (Mac) OS X 10.4 “Tiger”, it’s been possible to define your own custom keyboard shortcuts for pretty much any menu command in any application (you can set these up in System Preferences → Keyboard → Keyboard Shortcuts). For the most part, it works pretty well, but one thing that has always annoyed me is that some shortcuts don’t work until the corresponding menu has been opened at least once since the application was launched. This bug has been around since 10.4; here we are, seven years later, and the same old problem still exists in OS X 10.8 “Mountain Lion”. I got tired of waiting for Apple to fix this, so here’s my general solution that should work for any app / menu command that stubbornly refuses to let you use your own shortcut until the menu is opened.

Get FastScripts and enable UI Scripting

The basic idea: a simple AppleScript triggers the desired menu command, and the script is assigned a keyboard shortcut via FastScripts. You can assign up to 10 shortcuts for free — though it’s well worth the registration cost if you use other kinds of scripts too (such as the excellent Doug’s AppleScripts for iTunes).

Got FastScripts installed? Cool. The next thing you need to do is enable UI scripting. Open System Preferences → Accessibility (called “Universal Access” if you’re using an older version of OS X), and make sure “Enable access for assistive devices” is checked.

Simple shortcuts

For each shortcut you want to set up, you just need a simple AppleScript. Let’s create one that triggers the File → Export… command in Preview (which unfortunately doesn’t have a built-in shortcut). You’ll need OS X 10.7 “Lion” or later for this.

First, open the Preview app. Now open the FastScripts menu (see below) → FastScripts → “Create Preview Scripts Folder” (or “Open Preview Scripts Folder”, if it already exists).

Now open AppleScript Editor. Copy the following code and paste it into a new script, then click “Compile” to make sure it was copied correctly.

tell application "System Events"
    tell application process "Preview"
        click menu item "Export…" of menu "File" of menu bar 1
    end tell
end tell

This seems like a good time to mention an important detail: for menu items with ellipses (…), you have to use an actual ellipsis (single character that contains all three dots). If you type three separate periods, it won’t match the menu command (unless the app developer also made the same mistake — which they sometimes do). On a US keyboard layout, press [option]+[;] (semicolon) to type a real ellipsis.

Save your script as “Export” in the folder that FastScripts created/opened in the Finder. Now go back into the FastScripts menu → FastScripts → Preferences, and click “Script Shortcuts”. Your new “Export” script should appear in the list under Preview. Double-click where it says “(none)” to assign a shortcut, then type whatever shortcut you want to use (I used [command]+[shift]+E).

Now open an image or PDF in Preview and give your new shortcut a try.

Shortcuts for menu items that change

If the menu command changes depending on the current state of the app, your script needs to check if the menu item exists and change the command accordingly. Here’s a script I created that toggles the folders sidebar in the new Notes app in Mountain Lion.

tell application "System Events"
    tell application process "Notes"
        if menu item "Show Folders List" of menu "View" of menu bar 1 exists then
            click menu item "Show Folders List" of menu "View" of menu bar 1
        else
            click menu item "Hide Folders List" of menu "View" of menu bar 1
        end if
    end tell
end tell

Questions/problems? Send me a message on Twitter.

Kirby Ferguson on the nature of creativity

‘Everything is a Remix’ creator Kirby Ferguson’s recent TED talk is now available. Please check it out and pass it on. (And if you haven’t already seen it, do yourself a huge favor and watch the entire Everything is a Remix documentary series. There are four episodes, each about ten minutes long.)

I think we’re at a point in human history where it’s critical for us to shift our understanding about the nature of creativity. Copyright and patent laws have been shaped around an outdated model of ideas-as-property and the myth of the lone genius who creates new things out of thin air, with no influence.

A choice quote from the talk: “Creativity comes from without; not from within.”

Click the title of this post to watch the video.

Animoog: how to transfer presets between iPhone and iPad

If you use Animoog (an incredible synth designed specifically for touch screen devices — available for iPad and iPhone), you may have noticed there’s a new update out today, and along with it, Moog has released the first in-app purchase — a wonderful set of 32 patches designed by the one-and-only Richard Devine. It’s only $1.99, and the new sounds are awesome. Go buy it right away, then come back here.

Okay, now for the bad news. Because Moog decided to make a few extra bucks by selling the exact same app as two separate versions for iPad and iPhone (making you pay twice for the same thing, which really should have been a single, universal app), the in-app purchases don’t transfer either. In other words, you have to pay $1.99 twice, for the exact same presets, if you want to have them on both the iPad and iPhone version.

Or do you? Turns out you can easily export the new presets on one device, then import them into Animoog on the other device, and you’re good to go. Here’s how.

  1. After you buy the new presets, go to the Setup page and tap “Export Presets”.
  2. Open iTunes, select your device (the one you bought the presets with), go to the “Apps” tab, and scroll to the bottom. Select “Animoog” in the left-hand list, then drag the “ExportedPresets-(date).zip” file to the desktop.
  3. Unzip the file, open the folder, and make sure all the “RD-…” presets are in there.
  4. In iTunes, select your other device, go to the “Apps” tab, scroll to the bottom, select “Animoog”. Now drag all the “RD-…” files to the “Animoog Documents” box.
  5. Open Animoog on the second device. Go to the Setup page and tap “Import Presets”. It should automatically import all the RD presets. Now you have them on both devices without paying twice.

How to stop Safari 5.1 from unexpectedly reloading pages

Annoyed by Safari 5.1’s tendency to spontaneously reload pages when you didn’t ask it to? There’s a workaround for it, but it introduces a few problems of its own. Some Safari extensions will not work, and some of the new gestures won’t work either.

If you don’t rely on any extensions, and you can live without the new gestures (specifically, the new two-finger back/forward, smooth pinch-to-zoom, and the iOS-style smart-zoom), here’s how to fix it.

First, you need to enable the Debug menu in Safari, if you haven’t done so already. Copy the following line and paste it into a Terminal window, then quit and re-open Safari.

defaults write com.apple.Safari IncludeInternalDebugMenu 1

You should now see a Debug menu in Safari, to the right of the Help menu (not to be confused with the Develop menu). In this menu, disable “Use Multi-process Windows” by selecting it (when it’s disabled, it will no longer have a checkmark next to it).

Close all Safari windows. From this point, any new windows or tabs you create will have a title that ends in [SP] (“single process”). Safari will not reload any tabs in a single-process window. You can confirm this by selecting “Crash Web Process” from the Debug menu; this would normally trigger the tab-reloading behavior, but with “Use Multi-process Windows” disabled, this will no longer happen.

That’s it. If you end up missing your extensions or gestures, just re-enable “Use Multi-process Windows”.

If you use 1Password…

If you happen to use 1Password, you’ll notice it’s unable to automatically fill in your passwords in single-process windows. Fortunately, the 1Password pop-up (accessible via the [1P] toolbar button) still works, and still allows you to copy passwords and paste them yourself.

Some extensions will not work

Some extensions don’t work properly with single-process windows. In particular, extensions that interact with page content (such as ad and plugin blockers) don’t seem to work. If you find some of your extensions aren’t working properly, you might be able to install an older version of the extension that’s intended for Safari 5.0. I haven’t tried that, but if there are any extensions you can’t live without, it might be worth a shot.

Update: added info about missing gestures.

Update: I mistakenly referred to older versions of Safari extensions as being for Safari 4. Extensions were introduced in Safari 5, and it’s Safari 5.1 that moved to the new multi-process architecture of WebKit2 — i.e. this article actually only pertains to Safari 5.1. On further inspection, I’m not sure the reasoning I offered for extensions not working in single-process windows was accurate, so I’ve removed it.


Nerdy details (for those who care)

So what is a “multi-process window” anyway?

One of the new features in Safari 5.1 is a major new version of the underlying engine — WebKit2. Under WebKit2’s new process architecture, Safari consists of two separate processes — the “UI process” (the Safari application itself, including the address bar, toolbar, bookmarks bar, menus, etc.), and the “web process” (an independent process that loads and displays actual web pages).

Apart from other goals, the purpose of this is to provide some measure of crash protection. While it does prevent the entire Safari application from crashing (at least as far as I’ve seen), it doesn’t protect you from losing anything you’ve typed into text fields in web pages. All web content is handled by a single web process, so if any page malfunctions and causes the web process to crash, all open tabs will be reloaded, and anything you had typed into any of those pages will be lost. Furthermore, any downloads that were in progress will also be halted; you might be able to resume some downloads, but many will have to be started over. This can be very frustrating when downloading large files.

For that reason, the benefits of the new multi-process architecture are somewhat dubious, at least until Apple manages to address the issue of spontaneously reloading tabs (assuming it’s even possible to prevent this behavior without redesigning the overall architecture of WebKit again).

Check out the WebKit2 page on the official WebKit wiki for more details.

Further Ping integration in iTunes 10.0.1

iTunes 10.0.1 was released today. The update seems to be focused on added integration of Apple’s new Ping service (introduced in iTunes 10).

The Genius sidebar has now been replaced with a Ping sidebar, which shows a listing of recent activity from the people you follow, along with “Like” and “Post” buttons for the selected (or currently-playing) item (as long as it’s available in the iTunes Store).

The inline (→) arrow quick links in list view (shown in selected or currently playing songs, next to the song title, artist, album, and genre) have been removed. In place of those is a single (Ping) drop-menu, with commands to “Like” a song, “Post…” about it, or visit the artist’s profile in Ping. If you use Ping, this will save you a trip to the iTunes Store every time you want to tell your friends about a song or album. These commands have been added to the context (right-click) menu as well.

The (Ping) drop-menu also incorporates the quick link functionality of the (→) arrows, allowing you to jump to the corresponding song, artist, album, or genre in the iTunes Store. It’s now two clicks instead of one, but it does save space in list view, since those arrows no longer occupy space in the artist, album or genre columns.

Perhaps not many people were aware of it, but those (→) links could also be used to jump to the corresponding song/artist/album/genre in your own library, by holding [Option] while clicking the arrow. Similarly, if you hold [Option] before opening the new (Ping) drop-menu, you can show the song in your own library instead of the iTunes Store.

Previously, there was a hidden setting that allowed you to reverse the behavior, so the default action was to show the item in your own library, and required holding [Option] to jump to the iTunes Store. If you changed that setting (as I did, since I use those arrows to navigate my own library far more often than linking to the iTunes Store), the behavior is actually still reversed in 10.0.1 (the default action shows the item in your own library), but the subheading in the menu displays the wrong thing; when it says “Show in iTunes Store”, you’ll actually be taken to your own library, and vice-versa.

If you want to show items in your own library by default, you can still use this command to toggle the setting. Copy and paste this into a Terminal window:

defaults write com.apple.iTunes invertStoreLinks -bool YES

As with other UI changes in iTunes in the past, perhaps there’s a hidden setting to switch back to the arrows instead of the (Ping) drop-menu. If I find anything about that, I’ll update this post accordingly.

One other small quirk in 10.0.1: the “Auto Size Column” commands still leave space for the now-missing arrows. Until Apple fixes that, you’ll have to manually resize the Album, Artist and Genre columns if they’re ending up too wide.

Jul 5

Flickr’s regressive new map interface

Update: the ability to set a photo’s location by coordinates has been restored. The feature was in place by the time the new photo page launched. Thanks Flickr!

I’ll leave this post up as an explanation of how to assign accurate locations to photos, for those who don’t have a GPS-enabled camera (or standalone GPS device).


For the most part, I’m a big fan of the newly redesigned page for viewing photos on Flickr (currently in public beta). One area in which the new design is weaker, however, is the interface for placing your photos on the map. I think the best way to illustrate the problem is to take you through the process I use for adding the location to my own photos. I’ll add the location for this panorama I shot in Kyoto a few years ago.

  1. Since I don’t have a GPS device, I have to use a map to find the location from which the photo was taken. I find the location in Google Maps, then right-click approximately where I was standing and click “Center map here”.

    Google Maps: Center map here

  2. I can now get the coordinates (latitude and longitude) for that spot from the link for the current map view. I select and copy just the coordinates from the link.

    Google Maps: Link coordinates

  3. Now I open the page for my panorama on Flickr, and click “Add this photo to your map”.

  4. I enter the coordinates and click “Go”. Unfortunately, in this new Flickr map interface, the photo does not actually get placed at the coordinates I entered. The photo is still sitting at the bottom, waiting for me to drag it somewhere on the map. But the map is zoomed way out, and I can’t see the location I was looking at in Google Maps (this is why I use Google Maps and not Yahoo’s).

    Flickr (new): map input

    If I try to zoom in, I get the usual “data is unavailable” message. Can’t zoom in any further (Map, Hybrid and Satellite mode all show this same message). There is no way I can accurately place my image with this map view.

    Flickr (new): map input (zoomed)

  5. Since this new interface is completely unusable, I temporarily leave the public beta.

    Flickr: public beta opt-out

  6. Back in the old interface, I now click “Add to map”.

  7. I enter the coordinates and click “Go”. The photo is placed at the exact location I entered. Yahoo’s maps have no information at this zoom level, but because I don’t have to drag anything, it’s not a problem. I know the photo is in the correct location (confirmed by the location name given in the top right), and all I had to do was enter the coordinates. I’m done! I can now switch back to the new Flickr photo interface (which is significantly improved in almost every way…except for the map input).

    Flickr (old): Map input

My message to Flickr staff: please restore the ability to enter simple coordinates for placing photos on the map, and get rid of the mandatory drag operation. I hope I have made it clear that the old interface was clearly superior in this regard.