Monday, February 18, 2008

Alternative Window Managers and Dots Per Inch

I'm currently experimenting with different window managers. I'd like to ditch GNOME for something better suited for my old laptop. I'm also an Ion3 refugee (that's a tiling X window manager that I use at work). So I'm looking for a keyboard centric, low on resources, window manager that can also handle floating windows.

If it weren't for the floating windows bit, I would probably use ratpoison (I would actually go for stumpwm, but it's too slow on my box). I've narrowed it down to wmii, awesome and xmonad. But enough about that - I'll post here as soon as the dust settles down.

What I found out so far was that my X server was not configured properly. Under any of these window managers, fonts look too small when compared to GNOME. At first I attributed it to the fact that the GNOME settings daemon was not running.

I found out that I couldn't just run gnome-settings-daemon - it complained that gnome-session wan't running, so I launched it. This did seem to solve the font size problem, but created a new one - it automatically launched all the GNOME cruft with it: panels, desktop/nautilus, etc.

I fiddled a bit with ~/.gnome2/session, trying to setup a minimal session, without losing the original default session. No luck. GNOME is a stubborn beast. Sigh.

Applying Google thinking to the problem hinted that this was a DPI issue. On GNOME I found out (through the oh-so-obvious System->Preferences->Appearance->Fonts->Details...) that it was configured as if 96 pixels spanned one inch. The X server, on the other hand, decided that 75 dots per inch is the correct value (I checked this with the oh-so-toolkit-approach xdpyinfo | grep dots ).

Turns out that both values are incorrect. I used a measuring tape and Google Calculator to calculate the actual DPI: 90x90 (1024x768 pixels, 289x217 mm physical size). X was not detecting the screen size (it was set to 0x0 mm), so it picked 75 DPI. GNOME was not following suit for some reason (I may have modified the value manually at some point, but I'm not sure).

The solution was to force the X server to 90 DPI:
  1. In GNOME: System->Administration->Login Window
    or, from the GDM login screen: Actions->Configure the login manager (tick, press OK)
    or, from a terminal
    gksu -u root gdmsetup
  2. go to Security->Configure X Server...->Command
  3. add -dpi 90 (or whatever value matches your setup), to get:
    /usr/bin/X -audit 0 -dpi 90
  4. logout
  5. restart GDM:
    invoke-rc.d gdm restart
  6. login again
Make sure you configure GNOME to use the same DPI.

With the DPI set correctly you should be able to clearly read text rendered with a 10pt font, as long as your (assisted) eyesight is 20/20.

[6 Mar. 2008] UPDATE: even after solving this issue I got huge fonts showing up in OpenOffice.org menus. The fonts were OK in GNOME.

While trying to resolve the issue I launched gnome-settings-daemon by mistake under ratpoison, and, contrary to my previous attempt (see text above), it just worked - the fonts in OOo are OK now. A recent upgrade of gnome-control-center must have fixed the behavior of gnome-settings-daemon.

So I now launch gnome-settings-daemon when ratpoison is launched, with this line in ~/.ratpoisonrc:
exec gnome-settings-daemon
This also has a nice side effect - the GNOME control center can be used to control stuff: screensaver, keyboard shortcuts, mouse handedness, background image, themes, etc. Doing these manually using xscreensaver, xmodmap, xsetroot, etc. can be quite a PITA.

It's interesting to note that if it weren't for my problem to launch gnome-settings-daemon, I wouldn't have hit the DPI problem.

[15 Mar. 2008] UPDATE #2: well, guess what? my DPI troubles continue... Let's just say that you need to put the following line in ~/.Xresources for correct font rendering (got this from a nice article about X Server DPI):
Xft.dpi: 90
(replace 90 with the correct DPI settings).

No comments:

Post a Comment