Add fonts to the built-in Stickies widget

Apr 25, '11 07:30:00AM

Contributed by: nathanator11

The built-in Stickies dashboard widget lets you use a few Apple-selected fonts, but the selection doesn't have very many options. I wanted a way to add other fonts to the Stickies widget. By adding two lines to the code that supports the widget, you can add any font on your computer.

It may be helpful to have some knowledge of HTML and JavaScript, but the procedure is simple enough that you should be able to do it even if you don't have experience with those languages.

The first step is to make a copy of the widget so you're not working on the original. Go to /Library/Widgets and find Stickies. Copy it and paste it into ~/Library/Widgets and name it something else, like StickiesWithFonts.

Close the Stickies widget in your Dashboard; you won't be needing that version anymore.

Next, we begin modifying the code. You'll need a good text editor like TextWrangler or Fraise (both free).

Now, find the first file we're going to modify. Right click on the copy you made (StickiesWithFonts) and choose Show Package Contents. In the new window that appears, open the Stickies.js file with your editor. Next is to modify the JavaScript code.

Now, back in the Package Contents window, open Stickies.html in your editor. This is the second (and final) document we need to modify, in this one, the HTML code.

To start, find the line that goes

<select id='font-popup' class='popup' onchange='fontchanged(this);'> (should be around line 40).

Below, you'll find a few lines that are similar to each other. Each one begins with<option value.

As with the previous file, copy the last line and paste it below itself. Change the line say <option value='font name'>Font Name</option> where font name is the name of the font you added earlier.

Now, restart Dashboard by opening Terminal and typing killall Dock.

Now you're ready to install the new widget you made. Double click on your StickiesWithFonts in ~/Library/Widgets. It will open in Dashboard.

Choose a font how you normally would, and you'll notice your new font in the popup menu. Select it, and you'll be writing in your newly-added font like this.

Repeat this process whenever you want to add another font.

[crarko adds: I haven't tested this one. As advised, make sure you edit a copy of the original in case something goes awry.]

Comments (2)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20110422084416112