Defaults

Well, I haven’t given up on the mission to determine how to capture a screenshot of the login screen in Mac OS X. Read more here. In fact, I’ve been able to create a popup login window with a user name and capture a screenshot, however, it’s not exactly what I’m looking for. More to come…

In the meantime, I want to share a tip if you tire of email messages in iMail where the body of the message has been created in rich text. I’ve got a trick for you to turn email that looks like:

to email that looks like this:

Ah yes, good old plain text. Here’s the trick, from a terminal type the following:

defaults write com.apple.mail PreferPlainText -bool TRUE

That’s all there is to it. And of course, if you change the TRUE to FALSE, you’ll be back in the world of colorful, formatted messages.

Over here I wrote about how to change the path where screenshots are stored. Another potentially handy option is to specify what file format you prefer for your screenshots. There is a surprisingly large number of choices: png, pdf, tiff, pict, jpg, bmp, gif, psd (PhotoShop), sgi (Silicon Graphics) and tga (Truevision targa).

You can change the file type by running the following defaults command from a terminal, where ‘format’ is one of the options above:

defaults write com.apple.screencapture type format

Logout/login for the new file type to take effect. As an alternative, you can run the following command from a terminal, however, I had problems getting this to work on a consistent basis:

killall SystemUIServer

You can also use the Property List Editor to set the your screencapture preferences. The file you need to open is located here: ~/Library/Preferences/com.apple.screencapture.plist (use Finder to locate the file and double click to open).

No question, screenshots are your friend. There is a wealth of options for capturing screenshots on a Mac, with the two most common being Shift-Command-3 (entire screen) and Shift-Command-4 (area you specify with mouse). I like to have all images I capture/edit in a specific directory, the same directory that my ftp client points to upon startup.

Here is a defaults command (run from a terminal) that you can use to specify the location where to store screenshots:

defaults write com.apple.screencapture location path

The path setting must truly be the full path, that is, you cannot reference ~ for your home directory. If you would like to place screenshots in reference to your home directory, simply use the full path, such as /Users/John/Desktop/screenshots.

For the new path to take effect your best bet is to logout/login. I’ve seen references to the following command as an alternative, however, this didn’t work consistently for me:

killall SystemUIServer

You can also use the Property List Editor to set the your screencapture preferences. The file you need to edit is located here: ~/Library/Preferences/com.apple.screencapture.plist (use Finder to locate the file and double click to open).

Most all web developers, most certainly those who work with Firefox, are familiar with Firebug. This tools nevers ceases to amaze me, the ability to change information (for example style attributes) on a webpage as your are viewing the page, is amazingly useful. Version 3.x of Safari now includes the option to enable a Firebug like debugging tool called Web Inspector…

You won’t find access to Web Inspector in your default installation of Safari. However, making the necessary configuration changes is as easy as running the following command from a Terminal:

defaults write com.apple.Safari WebKitDeveloperExtras -bool true

If you prefer, you can use the Property List Editor to set the WebKitDeveloperExtras property in the Safari property file, which is located here: ~/Library/Preferences/com.apple.Safai.plist (use Finder to locate the file and double click to open). You’ll need to restart Safari after making the changes to enable Web Inspector.

To open the Web Inspector, right click and choose Inspect Element as shown in the figure below:

With Web Inspector running, you have access to a goodly amount of information. Take a look at the screenshot below which shows content from the Google homepage.

While poking around on Web Inspector, I clicked on icon in the lower left corner (the little arrow-in-a-box) and a popup menu appeared showing options for Network and Console. I selected Network and information about document and image transfers appeared (see the figure below). The Console option in this same menu resulted in a blank page appearing, so it seems I still have some exploring to do to figure what this option is all about. If you click on the icon just to the right of the arrow-in-a-box, the Web Inspector will be shown in a split window view versus a popup window.

I haven’t found an option for editing “on-the-fly” as in Firebug, however, Web Inspector is a good start for a built in tool and I have no doubt it will continue to evolve….

The followings two tips are for those who spend any amount of time in terminal windows. The first tip shows how to configure focus follows mouse, which is handy when you jump between multiple terminals. The second tip demonstrates how to configure the default window settings so when inside a terminal and you create a new terminal (in either a tab or window) the window settings match your preferred look and feel.
To configure focus follows mouse, enter the following in a terminal. You will need to close and re-open all open terminals:

defaults write com.apple.Terminal FocusFollowsMouse -string YES

You can give this effect a try by opening two terminals and moving the mouse between them. Note, this only applies to two separate terminal windows, not two terminals in separate tabs within one terminal window.

The next tip will set the default window settings for each new terminal window that is opened (from within a terminal):

defaults write com.apple.Terminal "Default Window Settings" -string Novel

Novel is my preferred (configured) setting for a terminal. To see what I am referring to, from a terminal enter the Preferences dialog and look at the Startup setting, which is shown below:

This is a little confusing, let me clarify. If you look closely at the text in the dialog above, it states On startup, open:… which translates to…when I startup a terminal window, use the Novel window settings. However, if you are in a terminal already and open a new terminal (cmd-N or cmd-T), the default window setting is Basic. So, the tip above tells the system when I am in a terminal, and I open another terminal, using the window settings I specified (not Basic).

Both of the above configurations can be set by editing the terminal property list file located here: ~/Library/Preferences/com.apple.Terminal.plist. If you double click on this file, the Property List Editor will open the file and you’ll see the two properties mentioned in the tips above, near the top of the list:

And while you have the property editor open, go ahead and take a few minutes to tweak a few other options. I think you’ll agree there, is an an odd sense of satisfaction in customizing your system. You may need to restart any open terminals to see changes take effect.

One of the joys of working on a Unix system is the ability to tweak various system settings, even better when you can do so from a command-line shell (terminal). The means to get there on Mac OS X is the defaults command. Using defaults you can read, write and delete various application and system preferences.

Read more »