Mac OS X Hints

Check Web-Page Designs at Various Browser Widths

Are you a Web designer, or do you do design work that winds up on Web sites? If so, you might like this handy method of testing your work at various screen sizes. Launch Safari (or your favorite browser) and create a new bookmark. Most browsers will require that you bookmark a specific site. In Safari, open a site and then choose Bookmarks: Add Bookmark. Give the bookmark a name that will help you remember the screen size, such as 800x600 or 1024x768. Next, edit the address of the bookmark—in Safari, go to Bookmarks: Show All Bookmarks and navigate to your newly created bookmark. Change the Address portion of the bookmark to

javascript:self .moveTo(0,0);self.resizeTo(800,600);
(see screenshot).

Open any page in Safari and select the bookmark. You’ll see that page in an 800-by-600-pixel browser window. You can then duplicate this bookmark and create other sizes as needed; just change the name and the relevant code. When you’re done, move your new bookmarks to a convenient location; then click on them when you want to test your pages at different resolutions.

Banish the Dock without Killing It

Are you one of the many people who think that one of the worst parts about OS X is the Dock? You can kill the Dock for good with relative ease, but if you do so, you’ll lose a number of other services, such as Exposé, the Command-tab application switcher, changeable desktop pictures, and Dock notification of new Mail messages.

A much better solution is to make the Dock basically invisible but keep it around. You can do this by positioning the Dock at the top of the screen (yes, the top) and then hiding it. But how do you move the Dock to the top, since the Dock pane lets you position it only on the left, bottom, or right? If you’d like to take the easy way, download a copy of the free TinkerTool, which can handle the task. Of course, you’d rather know how to do this using Terminal.

To start, make sure the Dock isn’t hidden (Apple menu: Dock: Turn Hiding Off); then launch Terminal and type

defaults write com.apple.Dock orientation -string top
.

When you press enter, nothing seems to happen. Although you’ve changed a hidden preference setting, you need to restart the Dock in order to actually move it to its new home. To do so, open Activity Monitor (in Utilities) and click once on the Dock entry in the Process Name column. Click on the red Quit Process button, and then click on Quit in the resulting dialog box. When you do, you should see the Dock vanish and then reappear at the top of the screen (the Dock autorestarts when quit). The last step is to enable Dock hiding again via the Apple menu.

And that’s it—you’re done. The Dock is now “hiding” above your menu bar, and you’ll find that it’s nearly impossible to accidentally activate the Dock with the mouse. To do so, you have to hover in a very thin region just below the menu bar—or you can do it easily, by pressing Command-option-D to unhide the Dock. If you ever want the Dock back in one of its usual positions, just choose one from the Apple menu’s Dock option—the Dock will return to the chosen location without requiring that you restart it.

Avoid a Bug in the Finder’s Find Window

Macs are known for consistency of design. Things just work as you expect them to, nearly all the time. Here’s one case where they don’t work as expected, and the results could be disastrous. If you use the Finder’s Find window and search in Specific Places, you need to be aware of this gotcha.

Being the good Mac user that you are, you’re probably quite accustomed to drag and drop. With Specific Places selected, you can drag items into the window to add them to the list. You may think this means you can also drag them out, but that doesn’t appear to be the case—drag an item out and drop it on the Finder, and it just springs back into the box.

With a little work, you might discover that you can remove items by dragging and dropping them onto the Dock’s Trash icon. “Perfect,” you think—but not so fast. What you’ve just done is to drag your original folder (or disk volume) into the real, actual Trash. Empty it now, and you could be in real, actual trouble.

The moral of the story: Do not drag and drop items from the Specific Places search box to the Trash. Use the Remove button.

Scroll through Directories in Cocoa Apps’ File Dialog Boxes

If you’re using a Cocoa application such as TextEdit or Mail, you can use this little trick to browse the available folders within a given folder: First, select either Open or Save As. Next, press Command-shift-G to bring up the Go To The Folder drop-down menu. Type a path, such as

~/
for your Home directory, and then press option-escape. The Go To The Folder window will then populate with the first available folder within that directory. Each press of option-escape after that takes you to the next folder. To move backward through the list, press shift-option-escape (which is much easier to do if you press the shift key on the right side of the keyboard with your right hand).

Colorize the Finder’s Sidebar

The sidebar in OS X 10.3’s Finder makes navigation quick and easy, and it always gives you a visual reference to exactly which volume or folder you’re in. But it’s also amazingly boring. It’s white, and you can’t jazz it up with pictures or color, as you can an icon-view folder. Or can you? Although you can’t add an image, you can colorize the sidebar in OS X 10.3.5 or later—if, that is, you’re willing to get your hands dirty under the Finder’s hood.

But before you go any further, keep in mind that this type of hacking has the potential to destroy your Finder. So proceed with caution, and follow these directions carefully.

Navigate to System: Library: CoreServices: Finder; then control-click on Finder and select Show Package Contents. In the new window that opens, drill down to Contents: MacOS. You’ll find just one file, called Finder. Option-drag the file to copy it to your desktop as a backup, and rename it Finder Backup to be sure you know what it is. Now option-drag the original Finder file again to create another copy. Name this one Finder Modified. Leave the original Finder package window open; you’ll need it later.

For the next step, you’ll need the free HexEdit. Download and launch HexEdit and then open the Finder Modified file. Your screen will fill with what looks like a bunch of gobbledygook, but what you’re actually looking at is the Finder’s executable code. Select Find: Go To Address, enter

0029EB10
, and then click on the Go button. Your screen will jump, and the cursor will start blinking just before a series of six FF character sets. These six positions control the color of the Finder’s sidebar, and six FF pairs indicates white.

Your next task is to find a color you like. The easiest way to do this is with the DigitalColor Meter (in Applications: Utilities). Set the pop-up menu to RGB As Hex Value, 16-Bit and start moving your mouse over icons, desktop pictures, or anything else with a color you might like (leaving DigitalColor Meter as the active application). When you see one you like, press Command-shift-H to lock the color, and then write down the 12 characters that appear next to the R, G, and B letters. For instance, if you picked a light red as your color, you might see C2C2 next to R, E2E2 next to G, and E4E4 next to B.

Switch back to HexEdit and highlight all six of the FF pairs—but no more than that. Now just start typing your new color string; in this example, that would be

C2 C2 E2 E2 E4 E4
. Replace only those six pairs of FF letters. When you’re done, save the file and quit HexEdit—and make sure you have a copy of Terminal in the Dock (I’ll explain why in a minute).

The last step is the scariest. First, drag the original, unmodified Finder from its home in the Finder’s MacOS folder to the Trash. Type your admin password when prompted. Next, rename your Finder Modified file as Finder, and then move the renamed file into the MacOS folder (select Authenticate if prompted; then enter your admin password again). That’s it. To activate the changes, you can either log out and back in, or restart the Finder either by using Activity Viewer or by typing

sudo killall Finder
in Terminal.

If all went well, the Finder will relaunch, and you will see your new, nicely colored sidebar. If things didn’t go well, you probably don’t have a Finder at all. But have no fear—just click on the Terminal icon in the Dock (without a Finder, you won’t be able to open it any other way) and move to the folder containing the Finder Backup file you cre-ated (

cd Desktop
, since you put it on the desktop). Now type these two commands, pressing return after each:

sudo rm /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder

sudo cp "Finder Backup" /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder

The first command will remove the bad Finder, and the second will copy the good original back to its proper spot. Click on the Finder icon in the Dock, and you should once again have a happy and healthy Finder.

[ Contributing Editor Rob Griffiths is the author of the recently released Mac OS X Power Hound, Panther Edition (O’Reilly, 2004). He also runs the Mac OS X Hints Web Site. ]

A simple JavaScript bookmark can resize your browser window to any size you want, anytime. Now testing your latest Web-site design in a small browser window is just a click away.Plain white sidebars are so boring—go ahead and colorize yours (as long as you’re comfortable editing files and working in Terminal).
1 2 3 Page 1
Shop Tech Products at Amazon