HiDPI - ArchWiki

# HiDPI

HiDPI (High Dots Per Inch) displays, also known by Apple's "Retina Display" marketing name, are screens with a high resolution in a relatively small format. They are mostly found in Apple products or high-end "ultrabooks", as well as in 4K (Ultra HD) or even 5K monitors.

Not all software behaves well in high-resolution mode yet. Here are listed most common tweaks which make work on a HiDPI screen more pleasant.

## Desktop environments

### GNOME

To enable HiDPI, use gsettings:

    gsettings set org.gnome.desktop.interface scaling-factor 2

### KDE

This article or section is out of date.

Reason: Needs to be updated for KDE 5. (Discuss)

KDE still has its share of HiDPI issues but HiDPI support can be improved by changing the below settings:

1. Increase font dpi (System Settings → Application Appearance → Fonts → Force font dpi, enter a number such as 125, 144 or 150 etc)
2. Increase icon sizes (System Settings → Application Appearance → Icons → Advanced, here choose a higher icon size for all icons, eg. just increase each icon type by one step)

### Xfce

Go to Settings Editor (you can find it in Settings Manager), and change the DPI parameter in `xsettings` → `Xft`. The value of 180 seems to work well on Retina screens.

To enlarge icons in system tray, right-click on it (aim for empty space / top pixels / bottom pixels, so that you will not activate icons themselves) → “Properties” → set “Maximum icon size” to 32, 48 or 64.

### Cinnamon

Supports HiDPI since 2.2. Even without rebuilding GTK3, the support is pretty good (e.g. window borders are correctly sized, which isn't the case under Xfce).

### Enlightenment

For E18, go to the E Setting panel. In Look → Scaling, you can control the UI scaling ratios. A ratio of 1.2 seems to work well for the native resolution of the MBPr 15" screen.

## X Server

Some programs use the physical width to detect the DPI. Examples are i3 (source) and Chromium (source).

To verify that the X Server has properly detected the physical dimensions of your monitor, run:

    $ xdpyinfo | grep -B 2 resolution
    screen #0:
      dimensions:    3840x2160 pixels (536x301 millimeters)
      resolution:    182x182 dots per inch

This examples uses slightly inaccurate dimensions (536mm x 301mm, even though the Dell UP2414Q has 527mm x 296mm) to have a clean multiple of 96 dpi, in this case 182 dpi. This tends to work better than using the correct DPI — Pango renders fonts crisper in i3 for example.

If the DPI displayed by xdpyinfo is not correct, see Xorg#Display_size_and_DPI for how to fix it.

## X Resources

If you are not using a desktop environment such as GNOME, KDE, Xfce, or other that manipulates the X settings for you, you can set the desired Xft DPI setting manually in `~/.Xresources`:

    ~/.Xresources

    Xft.dpi: 180
    Xft.autohint: 0
    Xft.lcdfilter:  lcddefault
    Xft.hintstyle:  hintfull
    Xft.hinting: 1
    Xft.antialias: 1
    Xft.rgba: rgb

Make sure the settings are loaded properly when X starts, for instance in your `~/.xinitrc`` with `xrdb -merge ~/.Xresources` (see Xresources for more information).

This will make the font render properly in most toolkits and applications, it will however not affect things such as icon size!

## Browsers

### Firefox

Open Firefox advanced preferences page (`about:config`) and set parameter `layout.css.devPixelsPerPx` to `2` (or find the one that suits you better; `2` is a good choice for Retina screens).

If you use a HiDPI monitor such as Retina display together with another monitor, you can use AutoHiDPI add-on in order to automatically adjust `layout.css.devPixelsPerPx` setting for the active screen.

From Firefox version 38 onwards, your system (GTK+ 3.10) settings should be taken into account.[1]

### Chromium / Google Chrome

No official support yet. Watch the bug report. In the meantime try setting default page zoom level to 200% (although it is not the most elegant solution).

For more adventurous users, Chromium can be recompiled using the `-Denable_hidpi=1` flag to use experimental HiDPI scaling. Use the ABS to download the chromium package source, then edit the PKGBUILD file to add the flag. Note that this option will partially break context menus, but will optimize the interface and all webpages.

Additionally, using current Chrome packages from AUR, and possibly chromium packages as well (not tested) the browser can be launched with the command line flag `--force-device-scale-factor` and a scaling value. This will scale all content and ui, including tab and font size. For example:

    google-chrome --force-device-scale-factor=2

Using this option, a scaling factor of 1 would be normal scaling. Floating point values can be used. Note that this currently (as of chrome 39) breaks the UI somewhat in terms of menus and forms. A bug report has been filed for the issue.

### Opera

Since version 24 one can alter Opera's DPI by starting it with the `--alt-high-dpi-setting=X` command line option, where X is the desired DPI. For example, with `--alt-high-dpi-setting=144` Opera will assume that DPI is 144. Newer versions of opera will auto detect the DPI using the font DPI setting (in KDE: the force font DPI setting.)

Generally speaking, Opera's HiDPI support is excellent. Since it is also built using Chrome's blink renderer, and has an extension which runs most Chrome extensions, it's a very viable alternative to Chrome with much better HiDPI support.

## Mail clients

### Thunderbird

See Firefox. To access `about:config`, go to Edit → Preferences → Advanced → Config editor.

## Skype

Skype is a Qt program, and needs to be configured separately. You cannot change the DPI setting for it, but at least you can change font size. Install qt4 and run `qtconfig-qt4` to do it.

## GUI Toolkits

### Qt 5

Qt5 applications can often be run at higher dpi by setting the QT_DEVICE_PIXEL_RATIO environment variable. Note that the variable has to be set to a whole integer, so setting it to 1.5 won't work.

This can for instance be enabled by creating a file `/etc/profile.d/qt-hidpi.sh`

    export QT_DEVICE_PIXEL_RATIO=2

And set the executable bit on it.

## External displays

The HiDPI setting is desktop-wide so that non-HiDPI external displays show everything too large. One workaround is to using xrandr's scale option. To have a non-HiDPI monitor (on DP1) right of an internal HiDPI display (eDP1), one could run:

    xrandr --output eDP1 --auto --output DP1 --auto --scale 2x2 --right-of eDP1

When extending above the internal display, you may see part of the internal display on the external monitor. In that case, specify the position manually, e.g. using this script.

You may run into problems with your mouse not being able to reach the whole screen. That's a known bug with an xserver-org patch (or try the panning option, but that might cause other problems).

## Console

The default console font will be very small on hidpi displays, the largest font is `sun12x22`, to enable it (temporarily):

    $ setfont sun12x22

See Fonts#Console_fonts for more.

## See also

- Ultra HD 4K Linux Graphics Card Testing (Nov 2013)
- Font_configuration

Category:

- Graphics