Set DPI of individual applications in Linux

2

In order to test a Qt application I'm working on I need to run it with various DPI settings to see how it looks. I can change the DPI settings globally in a couple of ways (Appearance->Fonts or putting "Xft.dpi: NNN" in ~/.Xresources), but this is a pain.

Is there a simple way to do change the DPI setting only for a specific application instead of globally (affecting the entire desktop)?

troth

Posted 2013-01-28T18:02:31.253

Reputation: 21

Answers

1

The DPI is set within X (on a per monitor basis), and, I believe, not available to be set on an application basis. So, no.

Nick

Posted 2013-01-28T18:02:31.253

Reputation: 568

0

A bit late to the party, but yes, you could do it with a trick.

#!/usr/bin/bash                                                 
OLDDPI=$(xrdb -query | awk '/Xft.dpi/ {print $2}')
xrdb -merge <(echo "Xft.dpi: 108")
$* & disown
sleep 3
xrdb -merge <(echo "Xft.dpi: $OLDDPI")

You can save this as a script, and whenever you need to change DPI of an application

Nenad Stojanovikj

Posted 2013-01-28T18:02:31.253

Reputation: 1