7

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 '14 at 5:21
5

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
#endif

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

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.)

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

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:

#!/bin/sh
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).

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.