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

Hennes
  • 65,804
  • 7
  • 115
  • 169
troth
  • 21

3 Answers3

1

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

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
  • 688
0

There are several solutions:

  1. Modify the .desktop file usually located in /usr/share/applications/ and add --force-device-scale-factor=1.5 option in the Exec command line.
  2. Some applications like Zoom create a .conf file in ~/.config where you can specify a scale parameter: ScaleFactor.

If this was not sufficient, you'll probably find a solution here:

https://wiki.archlinux.org/title/HiDPI (Most solutions listed in this wiki are not Arch specific and work for various Desktop Environment)

https://superuser.com/a/1500746/1016302

TioneB
  • 101