Some Safari 6 stuff

Last night I upgraded Safari on my MacBook Air to version 6 and today I did the same on my iMac. Both are still running Lion. I had a couple of problems with the way the new Safari ran, but they were both solved quickly by friendly people on Twitter.

First, Apple has removed the Appearance preference pane from Safari 6. This is the pane that allowed you to set your default fonts and default font sizes.

Safari 5 Appearance preference pane

In its place is… nothing. I’ve read, in a discussion on MacInTouch, about some defaults write commands that supposedly do the work of the old Appearances pane, but they didn’t work for me.

These preferences are a big deal to me. As you can tell from the settings, I like a big standard font to accommodate

  1. my middle-aged presbyopia;
  2. the decreasing pixel size of Mac screens; and
  3. the infuriating habit of shit-for-brains web designers to stick font-size: .8em, or worse, in their CSS files because bigger text offends their delicate sensibilities.

So I needed a replacement for my old preferences if I was going to stick with Safari.1 I tried setting up a style sheet to do the magnification, but things like

css:
body {
  font-size: 1.2em;
}

didn’t work consistently on all sites, probably because of what the shit-for-brains were doing in their style sheets.

So I asked for help on Twitter and got this response from Kristian Freeman:

@drdrang Got it. Custom CSS with gist.github.com/3203651
  — Kristian Freeman (@imkmf) Sun Jul 29 2012 9:45 PM CDT

Follow the link to his gist and you’ll see a very simple solution using the zoom property. For emphasis, Kristian goes overboard with the magnification in his gist. The style sheet I went with, called drang.css, is

css:
html {
  zoom: 1.125;
}

which effectively bumps up the font size from 16 points2 to 18 points, just as my old Appearance preference did. I used the Advanced preference pane to have this style applied to all web pages.

Safari 6 Advanced preference pane

Without the style sheet, Safari looked like this when compared with Chrome (which still honors my 18-point preference):

Safari 6 v. Chrome before style

With the style sheet, they look the same:

Safari 6 v. Chrome after style

Update 7/31/12
OK, I’m not sure what I did wrong yesterday, but the defaults write settings shown on MacInTouch do work on Lion. After reading Lauri Ranta’s comment below, I decided to give them another try and now my fonts are the size I want without a style sheet. Here are the commands I used:

bash:
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFontSize 18
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2StandardFontFamily Georgia
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2FixedFontFamily 'DejaVu Sans Mono'
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFixedFontSize 15

Note that if you want to use a font with a multi-word name you need to put the name in quotes.

Don’t get me wrong: I’m still pissed at Apple for forcing us to use the Terminal to get functionality that ought to be handled in the GUI. This is especially true for these settings, as they are most valuable to older users who are less likely to feel comfortable with the command line.

I’m thinking of writing a little program that would allow users to pick the fonts and sizes through a GUI and would then run the appropriate defaults write commands. Is there a way to get the list of installed fonts through a scripting language?


The next problem I had was with Safari’s new omnibar. When I’d type in a search query, it’d take me directly to Google’s top hit rather than to the page of search results—basically, it was working as if I were hitting the “I’m Feeling Lucky” button. This didn’t happen on my MacBook Air but did on my iMac.

Again, a call for help on Twitter got me an answer. Several answers, and all of them were correct. The first was from Jason Foreman:

@drdrang Do you have the Safari Keyword Search extension installed? That’s what was doing it for me.
  — Jason Foreman (@threeve) Mon Jul 30 2012 2:49 PM CDT

I did, in fact, have the Safari Keyword Search extension installed on the iMac, and it was the source of my trouble. I must have installed the extension after hearing good things about it, but I never used it after the first day or so of testing. Because I always used the search field for doing searches in Safari 5, Safari Keyword Search’s hijacking of the default behavior of the address field never got in my way.

Safari Keyword Search can still be used with the omnibar—delete the Default expansion—but I just disabled it. I don’t use specialized searches often enough to remember the prefix abbreviations.

Safari Keyword Search settings


Despite these two success stories, there are still some problems. The default fixed-width font is Courier, which I hate. This is an inexplicable choice by Apple, given that they have the very pleasant Menlo installed on every Lion machine. To try to fix this, I’ve added

css:
code, tt {
  font-family: Menlo;
  font-size: 90%;
}

to my drang.css file. The 90% part is there because Menlo is fairly large for its point size. I have a nagging suspicion this won’t handle every case, so I’m presenting it here only as a tentative solution.

Another problem I’ve noticed is that my popup footnotes don’t work reliably anymore. Sometimes the footnote pops up far from the footnote marker, sometimes it doesn’t appear at all. I’ll have to dig into the JavaScript to see what’s wrong.

Update 8/1/12
Removing the style sheet and changing the default fonts and sizes via defaults write (see earlier update above) eliminated the problems I was having with popup footnotes.

I should also mention that the font size warning messages from various Google sites, discussed by jcburns and me in the comments, have gone away. Everything seems much more normal now.


  1. I’m not going to get into how Apple, which prides itself on accessibility, has just made Safari distinctly less useful for older users. Nor will I mention that being able to set your default fonts and font sizes has been a part of every browser I’ve used for the past 15+ years—going all the way back to a time before I needed the increased font size. And I won’t point out that this isn’t just some aesthetic preference where Apple can claim superior taste; it’s an important usability issue. My purpose here—unlike Apple’s—is to help those who need bigger fonts to continue to use Safari. 

  2. The out-of-the-box default font size for all browsers (the default default) is 16 points.