User:Ctag/HiDPI

From ArchWiki

HiDPI / High DPI / Retina / 4k

The notes below cover my knowledge of setting up applications to work with HiDPI.

X11 DPI

Status: works

HiDPI#X_Server

With the intel video driver (bumblebee) the screen dpi is not automatically discovered, so I set it manually (by physically measuring the screen).

$ cat /etc/X11/xorg.conf.d/10-monitor.conf
Section "Monitor"
    Identifier "eDP1"
	DisplaySize 380 210 # in mm     <-- THIS LINE
    Option "DPMS" "true"
EndSection
[...]

Restart X, and then check the configuration:

$ xdpyinfo
screen #0:
  dimensions:    3840x2160 pixels (380x210 millimeters)
  resolution:    257x261 dots per inch

Once this is configured properly several programs (such as Chromium) will automatically begin resizing properly (or at least a little better).

Xft / Xresources

Status: Holy Grail

https://keithp.com/~keithp/talks/xtc2001/xft.pdf (page 8, table 3)

https://keithp.com/~keithp/render/Xft.tutorial

Even after making sure X knows what the screen DPI is, a lot of tertiary fonts still render too small. These are things like context menus on terminals, or menus on taskbar icons. Setting the Xft DPI appears to help with most of them.

$ cat ~/.Xresources
XTerm*renderFont: true
XTerm*faceName: VeraMono
XTerm*faceSize: 10

Xft.dpi: 261            # <-- Corrects font size
Xft.autohint: 0
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault

tty / console font

Status: works

https://wiki.archlinux.org/index.php/Fonts#Console_fonts

This affects TTY virtual terminal fonts, as well as a few GUI programs (XTerm).

My config:

/etc/vconsole.conf
KEYMAP=us
FONT=ter-v32n
FONT_MAP=8859-1

i3 window manager / i3wm

Status: works

https://www.reddit.com/r/linux/comments/31d0wp/i3_and_hidpi_display_everything_is_to_tiny/cq1x33k/

https://github.com/i3/i3/issues/1198

It looks like i3 properly handles the X server DPI, but you have to set a Pango font.

$ cat ~/.i3/config
[...]

# font for window titles. ISO 10646 = Unicode
#font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 # <-- Old font
font pango: Ubuntu Mono 10 # <-- HiDPI font

[...]

LightDM (GTK)

Status: works
/etc/lightdm/lightdm-gtk-greeter.conf
[greeter]
[...]
xft-dpi=261
[...]

Blender

Status: works

http://blender.stackexchange.com/questions/27016/make-blender-usable-on-high-resolution-screen

I followed the selected answer on the above link step by step.

Chromium

Status: works

https://wiki.archlinux.org/index.php/HiDPI#Chromium_.2F_Google_Chrome

Chromium actually works out of the box once the X server DPI is properly configured. But it actually appears to over-compensate in my case, and the UI is uncomfortably large. To fix this, follow the instructions below.

Edit the desktop file to include a parameter that isn't listed in the man page. The '2' in this case can be replaced with whatever real number suites your needs (e.g. --force-device-scale-factor=1.75).

/usr/share/applications/chromium.desktop
Exec=chromium --force-device-scale-factor=2 %U

Brackets

Status: works, but is a kludge

https://github.com/adobe/brackets/issues/8059#issuecomment-182322189

Install the theme/plugin and it'll warp the window into looking OK.

Atom

Status: works

https://github.com/atom/atom/issues/3826

Set `--force-device-scale-factor=1.75` in the .desktop file.

Slack

Status: works

Worked completely out of the box.

Dunst / Send-Notify

Status: Works

Dunst doesn't automatically respect DPI, but the config file can manually specify a larger font.

~/.config/dunst/dunstrc
[global]
    #font = Monospace 10
    font = Ubuntu Mono 16
[...]

Arduino IDE

Status: Works

https://github.com/arduino/Arduino/pull/4376

As of version 1.8.0:

Go to File>Preferences>Interface Scale and set it to whatever you want.

GRUB

Status: mostly works

https://wiki.archlinux.org/index.php/HiDPI#GRUB

I followed the wiki section step for step. It works well, except that text before the Grub menu (dm-crypt prompt) and early boot (before kms?) is still small. See: https://bbs.archlinux.org/viewtopic.php?id=219426

Terminator

Status: works (with Xft configured)

With Xft (everything just works)

User:Ctag#Xft_.2F_Xresources

Without Xft (ui elements too small)

Change the font in Preferences>Profiles>General. Other UI elements are not properly resized.

Inkscape

Status: partially works (in version 0.92)

Go to Preferences>Interface and set the icons to 'Larger'. Only affects most icons, not all of them.

PCmanFM

Status: works, but looks awful

The interface just looks bad, with some text resizing appropriately, and some buttons/ui elements not resizing. Also, the largest thumbnail setting is tiny.

Evince / Document Viewer

Status: works (mostly)

With the Xft DPI workaround, UI text is properly displayed. Buttons are still too small, but it's survivable.

Gimp

Status: almost works

http://www.gimp-forum.net/Thread-GIMP-2-8-Large-size-Icons-Themes

This icon theme works, but the next time gimp is run, it segfaults until the theme is removed from ~/.gimp-2.8/gimprc

Eclipse

Status: somewhat works

Eclipse 2018.12 (Platform 4.10)+

https://www.eclipse.org/eclipse/news/4.10/platform.php#gtk2-removal

https://wiki.archlinux.org/index.php/HiDPI#GDK_3_(GTK_3)

Starting with platform 4.10, Eclipse only supports GDK3 (GTK3). With this change the general recommendations around GDK3 apply and render both fonts and icons useable.

$ export GDK_SCALE=2
$ export GDK_DPI_SCALE=0.5

Eclipse Neon

https://www.eclipse.org/eclipse/news/4.6/platform.php#swt-autoscale-tweaks

http://askubuntu.com/questions/777411/eclipse-neon-icon-size-in-ubuntu-16-04-hidpi

Eclipse Neon is touted as supporting hidpi, but it doesn't work on my system.

To fix icons

/usr/lib/eclipse/eclipse.ini
[...]
-Dswt.autoScale=200

To fix fonts

Open Window>Preferences and edit the fonts in General>Appearance>Colors and Fonts.

UI fonts

Most UI fonts resize with the User:Ctag#Xft_.2F_Xresources workaround.

Code::Blocks

Status: somewhat works

with the User:Ctag#Xft_.2F_Xresources workaround, text is displayed well in most areas of the UI. Buttons are still too small.


Qt Creator

Status: Works

Adapted fix from [Github bug report].

I copied /usr/share/applications/org.qt-project.qtcreator.desktop to ~/.local/share/applications and then edited it such that:

...
Exec=env QT_SCALE_FACTOR=1 env QT_AUTO_SCREEN_SCALE_FACTOR=0 env QT_SCREEN_SCALE_FACTORS=1.75 qtcreator %F
...

Fontconfig

Status: unknown

https://eev.ee/blog/2015/05/20/i-stared-into-the-fontconfig-and-the-fontconfig-stared-back-at-me/

https://bbs.archlinux.org/viewtopic.php?id=212533

http://www.jaysonrowe.com/2013/04/font-configuration-in-arch-linux.html

I don't know if this helps, but here's my config:

$ cat ~/.config/fontconfig/fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
	<edit name="dpi" mode="assign">
		<double>261</double>
    </edit>
</match>
<match target="font">
  
<edit mode="assign" name="rgba">
	<const>rgb</const>
</edit>
<edit mode="assign" name="hinting">
	<bool>true</bool>
</edit>
<edit mode="assign" name="hintstyle">
	<const>hintslight</const>
</edit>
<edit mode="assign" name="antialias">
	<bool>true</bool>
</edit>
<edit mode="assign" name="lcdfilter">
	<const>lcddefault</const>
</edit>

</match>
</fontconfig>

Infinality

Status: not used

Infinality

It looks like there's no progress on either Infinality or the bohoomil patches.

Spotify

Status: works (with an argument)

Running Spotify with spotify --force-device-scale-factor=2.0 should fix it. You can increase the the scale factor as needed.