Is there a way to have different fontconfig settings per screen ?

I have two 1080p monitors, however one is 13" and the other 27". I would like antialiased fonts on the small monitor, and non-antialiased fonts on the big monitor.

  • Interesting question. I can imagine this would be useful for different subpixel rendering too, e.g. if one is RGB and the other is BGR.
    – Sparhawk
    Aug 16, 2014 at 5:21

2 Answers 2


xrdb uses the C preprocessor (because of course it does), so it supports conditions. Here's a snippet from my .Xresources:

#if SCREEN_NUM == 0
Xft.dpi: 157

#if SCREEN_NUM == 1
Xft.dpi:  96
Xft.antialias: 0

Now xrdb -merge will do the right thing on each monitor, and when you log in, assuming one of the myriad X initialization scripts bothers to look at your .Xresources, it will also be set correctly.

(Note: the Arch Linux Font Configuration page has more examples, but in the interest of preserving this for posterity, I have included the relevant example above.)

  • wow, that's great ! finally a way ! Mar 26, 2018 at 5:47
  • 1
    looks like Xft.dpi is case sensitive, only Xft.dpi works for me
    – vvolkov
    Apr 23, 2018 at 19:02
  • @vvolkov is right. I have fixed the explanation above.
    – Ben Stern
    Apr 24, 2018 at 19:15
  • 1
    "because of course it does" :)
    – Roger Dahl
    Oct 28, 2018 at 23:21

Here's how I do it:

  1. Set the config for the secondary monitor in .Xresources and run xrdb
  2. Start the program and place it on your secondary monitor
  3. Change the values back in .Xresources and run xrdb

Here's an example script for starting intellij Idea on secondary tilted monitor:

sed -i 's/.*Xft.rgba:\s*rgb.*/Xft.rgba: vrgb/' /home/babken/.Xresources
xrdb /home/babken/.Xresources
intellij-idea-ultimate-edition &
sed -i 's/.*Xft.rgba:\s*vrgb.*/Xft.rgba: rgb/' /home/babken/.Xresources
xrdb /home/babken/.Xresources

Though this will work if you keep that program on that monitor only (like I do).

  • As above, you don't need to run xrdb more than once, since it is multi-display aware.
    – Ben Stern
    Apr 24, 2018 at 19:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .