However, my monitors are no longer a perfectly-matched pair. Trusty old Dell is plodding along at 1280x1024, and new ASUS on the block is showing off at a mind-expanding 1920x1080. Most of the time this is not an issue, since the Dell displays browsers almost all the of time, while almost everything else (i.e. emacs) happens on ASUS. For terminals on the Dell I have always used a 10-point font, but at higher resolution I need 12-point (I'm not getting any younger, I'd like to continue to see, and you kids get off my lawn).
Rather than using Xinerama or Twinview (I have an Nvidia card), I fire up a separate X screen on each monitor (
:0.0 and :0.1). Since I use a tiling window manager (dwm) I never want to share windows across monitors, and this way I can switch desktops (tags) on one monitor without affecting the other. There is just one X server, however, so how to have different font sizes on different screens?For reference, my window managers are started as follows from
~/.xinitrc:
DISPLAY=:0.1 dwm &
DISPLAY=:0.0 dwm
I set fonts in
~/.Xdefaults. Resources are loaded by xrdb, which preprocesses Xdefaults using the C pre-processor cpp. Using the pre-loaded symbol WIDTH we can test resolution and set font accordingly:
#if WIDTH >= 1600
#define FONT -b&h-lucidatypewriter-medium-r-normal-sans-12-*-*-*-*-*-*-*
#else
#define FONT -b&h-lucidatypewriter-medium-r-normal-sans-10-*-*-*-*-*-*-*
#endif
XTerm*font: FONT
Emacs*font: FONT
We could also test on the symbol
SCREEN_NUM (see xrdb -symbols for all pre-loaded pre-processor symbols), but the above is more portable.Finally, reload resources:
xrdb -load ~/.Xdefaults
No comments:
Post a Comment