A Gentle Touch

July 24th, 2006

Anybody who packages software (or other files) for distribution on the Mac is probably familiar with the tedious process of setting up the icons “just right” in the Finder so that when your customer opens the folder for your app, they see things neatly organized the way you left them.

I don’t know how many times I’ve longed for a “nudge” keyboard shortcut in the Finder. If I could just move that icon one pixel to the left, it would be perfect. Inevitably I click and drag just a little bit too far. It’s hard to get right on the first try!

But today my worries came to an end. My NudgeFinderSelection scripts simply ask the Finder to move all the selected icons in a given direction. Since the behavior is is 99% identical for whichever direction the nudge should be, I just wrote a single script and copied it 3 times. The script examines its own name and determines its functionality accordingly.

Note: Because of this “self-determination,” you can customize your own version to go above and beyond the current behavior. Try making a copy and naming it “NudgeDownRight” for instance, and you’ve got yourself a nice little diagonal nudger.

I hooked up all four of these as Finder-specific shortcuts with FastScripts. Now when I’m tweaking icon layout in the Finder, a nudge is just a short cmd-opt-arrow-key away.

Note: my “clever hack” here begs the question, why doesn’t FastScripts respect symbolic links? It would be much cleaner to have a single copy of the file with multiple references to it. Yes, it’s a grievous shortcoming, and hopefully situations like this will inspire me to remedy it soon.

And since you’ve read this far, I think you deserve a little treat. Ever thought that the icons in a window would look best arranged in sine wave formation? Well, you were probably wrong, but SinusInfection will guide you to forming a permanent opinion. Unfortunately, there’s no undo, so don’t run this with an important Finder window front-most!

It’s not a very polished script, and may take some tweaking to work right on your system. C’est la vie! In particular make sure you have an open window with a substantial number of items in it. And turn off any automatic “keep organized” settings in the Finder view options. I’ve also noticed that Finder can sort of freak out while you’re doing this, apparently because so much is changing out from under it. The sine wave tends to get broken and re-originates at a slightly different window offset.

12 Responses to “A Gentle Touch”

  1. ken Says:

    For a low-tech solution, try mouse keys!

    System Preferences > Universal Access > Mouse & Trackpad > Mouse Keys

    With mouse keys on, the numeric keypad controls the mouse.  8 is up, 2 is down, 4 is left, 6 is right (etc. for 1,3,7,9).  Holding down 5 while hitting one of the movement keys is a drag.

    So, select the icons, position the mouse over one of the selected icons, hold down 5 and hit 6.  That’s mouse keys for ‘move one unit to the right”.

    I leave mouse keys on all the time for just this sort of reason.  This is also a good way to do fine positioning of windows for screenshots.

  2. ken Says:

    Hmm, the way I have Finder configured right now, there’s a drag hysteresis to overcome.  So the real sequence for a one unit drag to the right is
    hold 5
    hit 6 six times
    hit 4 five times

  3. Daniel Jalkut Says:

    Ken, what a great idea! I would not have thought of that.

    Yeah I think that 5-pixel threshold is a deal-breaker for me. I don’t see that there’s any way to change that? The nudging script I came up with is instantaneous so I’ll probably keep it.

    But the Mouse Keys are definitely a cool feature and I might leave it on and see if I miss the numeric keypad :) It’s really cool for nudging a window. Thanks for sharing!

  4. Conor Dearden Says:

    Do it once and never do it again, that is my solution. Before I used to drag and drop over the disk image; this way the application gets replaced and the icon stays in the exact same position. Now I use automator, so I barely see the disc image as is flashes by when automator mounts, copies and ejects and then goes on to upload the dmg.

  5. Brian Christmas Says:

    Try this rough one to align & evenly disperse a column of icons

    [Editor copied long AppleScript to Script Editor and uploaded to link shown in next comment]

  6. Brian Christmas Says:

    Thanks, but the link needs the %22’s stripped off, It reads…

    http://%22www.red-sweater.com/blog/downloads/BrianChristmasColumn.zip///%22

    When it should be….

    http://www.red-sweater.com/blog/downloads/BrianChristmasColumn.zip

    Regards

    Santa

  7. Daniel Jalkut Says:

    Ugh – there is something incredibly broken with my WP installation when *editing existing comments*. Thanks for noticing the broken URL – and for sharing the script!

  8. Stripes Says:

    why doesn”™t FastScripts respect symbolic links? It would be much cleaner to have a single copy of the file with multiple references to it.

    I donno about the symlinks, but did you try normal hard links?

  9. Daniel Jalkut Says:

    Hey! Hard links do in fact work. Thanks for reminding me to try that. Much easier to make changes that way.

  10. Brian Christmas Says:

    G’day from Oz

    I’ve been mucking about writing a script to organize a block of icons, and have it right apart from getting the spacing automatic.

    I can’t get the size of the desktop icons right. I’ve tried…

    tell application “Finder”
    set spacingDistance to (icon size of icon view options of window of desktop)
    display dialog spacingDistance
    end tell

    but it constantly returns 16 regardless of the icons size.

    Could you advise me please of what is the correct wording?

    Regards

    Santa

  11. Daniel Jalkut Says:

    Brian: Interesting – it sounds like a bug. But on my machine it always returns 36! Maybe it’s an issue of convincing the Finder to somehow reset that value. I can’t think of how, though. Even relaunching the Finder seems to keep it stuck on 36 for me.

    Sorry I couldn’t help!

  12. Brian Kerr | “FTFF” means “Fix the Fucking Finder” Says:

    […] Finder, with icons arranged in a sine wave; or […]

Comments are Closed.

Follow the Conversation

Stay up-to-date by subscribing to the Comments RSS Feed for this entry.