Posted on Categories Computers, Public Service Article, TutorialsTags ,

Enhance OSX Finder

I tend to prefer command line Linux and full window OSX for my work. The development and data handling tool chain is a bit better in Linux and the user interface reliability of the complete vertical stack is a bit better in OSX. I repeat here a couple of tips I found to improve the OSX finder.

A key feature missing from the OSX finder is a convenient “open another finder in the current directory.” The finder does have the “open a new finder on each folder-click option” but that litters your desktop with many useless intermediate finders. You can also right click on a folder in the Finder pathbar (which defaults to not visible) to get a menu up allowing a new finder to launch via “Open Enclosing Folder.” For me (even with the path bar on) nether of these methods really flow.

Fortunately Apple does supply the user with incredibly powerful tools such as AppleScript. This will allow us to add an always present single click (no control or right-click and no menu) action to our Finder toolbar.

Finder

To add the ability to open a new finder as a click all one has to do is the following (we are not distributing this as finished code as it is not our work and we don’t wan’t to encourage people to download and use unexamined code).

  1. Open the AppleScript Editor
  2. Select File->New
  3. Paste the the following into the AppleScript Editor (from: dtomasch (Daniel T) on Macword Mac OSX hints

    -- From: http://hints.macworld.com/article.php?story=20080108144434753
    try
    	tell application "Finder"
    		activate
    		set this_folder to (the target of the front window) as alias
    		set {x1, y1} to position of front window
    		make new Finder window to this_folder
    		set position of front window to {(x1 + 50), (y1 + 150)} --This offsets the new window more than the average Finder tiling does
    	end tell
    end try
    

  4. Press the compile hammer.
  5. Select File->Save As, choose file format Applicaton and save as “OpenFinder.app”.
  6. (optional, for a nice icon)
    With a finder right click on the new application and select Show Package Contents. Then replace Contents/Resources/applet.icns with Pieter Stroink’ finder icon NewImage (the file Finder_without_Bag.icns from the downloadable zip file Finder_Icon_by_eggy.zip).
  7. On a Finder right click on some blank space in the upper toolbar and select Customize Toolbar. Drop the new application in the toolbar.

Now all of your finders show the new application as an icon in the upper toolbar. When you click on this icon you get a new finder in the current context.

But you can do more, you can repeat this pattern with other applications. In my case I really like being able to open the command line terminal in the current finder directory. One of the really cool things about OSX is it has a good command line terminal. If you already are a terminal user you will like the following.

You can get the terminal in on this game by using TomWoozle (Tom Anthony)’s Macword Mac OSX hint in the same pattern as above to create a button that open a new terminal shell at the current finder location. You just use this block of AppleScript code:

-- from: http://hints.macworld.com/article.php?story=20020426093503563
on run
	tell application "Finder"
		try
			activate
			set frontWin to folder of front window as string
			set frontWinPath to (get POSIX path of frontWin)
			tell application "Terminal"
				activate
				do script with command "cd \"" & frontWinPath & "\""
			end tell
		on error error_message
			beep
			display dialog error_message buttons ¬
				{"OK"} default button 1
		end try
	end tell
end run

and get the icons from /Applications/Utilities/Terminal.app/Contents/Resources/Terminal.icns.

TerminalThe absolute icing on the cake is OSX’s built in "open" command. You can open a Finder pointing to the current terminal’s working directory by typing "open ." in the terminal (completing the circle).

Note: we have seen the open terminal app “stutter” or sometimes open two terminals.

7 thoughts on “Enhance OSX Finder”

  1. Thanks, that looks promising. I’m about to configure my OS X installation again after a disk failure. And for a development environment these hints are more than welcome. I’m more on the command line too myself, and hate it to type the path over and over again.

  2. As for opening a folder in a new Finder window, have you tried Command-Clicking a folder? This appears to do what you seek.

  3. These are some great customizations.. however I have found that using Total Finder (http://totalfinder.binaryage.com/) alleviates many of the problems you list. Also I really enjoy setting the finder to a keyboard shortcut ( mine is : option + tab ) so then its there whenever you need it.

    Additionally, total finder adds tabs to your finder windows. The tabs are styled very similar to chrome and work in a similar fashion.

    Another sweet customization I use is total termianal ( same ppl as total finder : http://totalterminal.binaryage.com/)

    This allows you to put your terminal on a hotkey for easy access ( i use the hotkey: option + ~ ).

    Anyhow give them a try, I really like having my two most used os x utilities ( finder + terminal ) available on a hotkey. Total terminal was 10$ when I bought a licence and total terminal is free.

  4. Or just install cocoatech’s “path finder”, and get that feature along with a few hundred others like tabs, a drop stack for moving files around, a terminal drawer that opens to the current directory, etc…

  5. Here’s a script that will work with iterm2. It also will switch ALL the way down the path currently selected.

    NOTE: I am an AppleScript n00b, so you’ll see some repeated code. If you don’t have an active session in iTerm, the code above the “on error” throws an error.

    on run
    tell application “Finder”
    try
    activate
    set frontWin to (get selection)
    set frontWinPath to (get POSIX path of (frontWin as text))
    tell application “iTerm”
    set t to (make new terminal)
    tell the current terminal
    activate current session
    launch session “Default Session”
    tell the last session
    write text “cd \”” & frontWinPath & “\””
    end tell
    end tell
    end tell
    on error error_message
    tell application “iTerm”
    set t to (make new terminal)
    tell t
    activate current session
    launch session “Default Session”
    tell the last session
    write text “cd \”” & frontWinPath & “\””
    end tell
    end tell
    end tell
    end try
    end tell
    end run

  6. Another golden terminal command “open -n -a WHATEVER.app”. This allows you to open a second copy of monolithic “one workbench only” applications (like Eclipse).

Comments are closed.