So you have a shiny new HiDPI screen, and you want to use it with Linux. The bad news is there isn’t a one-size-fits-all solution. Each desktop environment handles scaling differently. The good news is there is a way to handle HiDPI displays on each of the major Linux desktop environments.
Unity handles HiDPI displays fairly well, and it’s easy to implement. Open up the Unity “Settings.” It’s one of the default favorite applications. If you changed it, you’ll be able to search for it easily enough.
Once you have “Settings” open, click on “Displays.” These are all of Unity’s display-related settings. If you haven’t already, you can set Unity to match your monitor’s resolution and refresh rate here, unless you have the proprietary NVIDIA drivers installed. It’s better to set those settings through the drivers then.
Towards the bottom of the window is a slider that allows you to scale the interface. By scaling it above “1,” you can increase the size of the display to a point where it fits your display. When you’re happy with your settings, save it.
KDE also handles HiDPI screens well out of the box. Open up KDE’s “Settings.” Like Unity, it should be one of your default favorites. If you changed your favorites, you can still find it under “All Applications” followed by “Settings.” The application that you’re looking for is “System Settings.”
Find “Monitor and Display”. This is the window where you can change your monitor’s resolution and refresh rate. If you’re not running the proprietary NVIDIA drivers, and you haven’t already done so, change these settings to match your monitor.
At the bottom of the window is a button labeled “Scale Display.” Click on it. At the top of the window that will open is a slider. Sliding it over a value of “1” will increase the size of everything in the interface. The window also provides a convenient preview of what your scaled interface will look like. When you have everything the way you want, click “OK,” then apply your changes.
Move one level up back to to “All Settings.” This time, click on “Fonts.” At the bottom of the “Fonts” window is a checkbox that you can check to force the font DPI. Check the box and set the font DPI to match your monitor. If you don’t know what it is, just experiment until you get something that looks good. Once again, save your changes.
After you have everything the way you want, log out and log back in. Depending on your system, it might require a full system reboot to take effect.
The best way to handle setting GNOME up for HiDPI screens is to use GNOME Tweak Tool. If you’re on Ubuntu, it’s already installed. Other distributions have it readily available in their repositories.
Open Tweak Tool. Look on the side bar for “Windows”and click on it. At the bottom of the window you’ll find a section for HiDPI. It allows you to scale GNOME’s windows. Increase the value for larger scaling. It will change in real time, so you can see how it’s working.
Note: Gnome only allows you to set an integer value for the scaling factor. This means that you won’t be able to scale up/down proportionately.
Next, find “Fonts” on the side. Click on that one, too. In that window you can set the DPI of the GNOME’s fonts. When you’re done, save your changes.
GNOME is known to have some scaling issues with the above method. There isn’t any other solution built directly into the GNOME desktop at this time. If you are experiencing poor scaling because of the lack of more fine-grained support, check out the window manager section of this article.
GNOME users who have tried the methods detailed in the window manager section have experienced better results than using GNOME directly. This is because those solutions interact directly with the underlying X server instead of the more complicated GNOME shell. Since GNOME receives its information from X, it will still ultimately affect GNOME.
You might also want to consider saving the options that you arrive at in either the “.xinitrc” file or “/etc/X11/xorg.conf.” This will make them permanent. Chances are you’re running a full-featured desktop for convenience, and you don’t necessarily like having to manually configure everything, especially not at each boot.
XFCE is easily the worst when it comes to HiDPI support. If you use XFCE, consider changing environments, seriously.
To increase the font DPI in XFCE, open the applications menu and find “Settings.” Click “Appearance.” There’s a “Font” tab in that window. You can set the font DPI there.
Next, right click on your panels and select “Panel” at the bottom. Find and click “Panel Preferences” in the resulting menu. That will open up the panel controls. Increase the width of the panel, and the icons on that panel will scale with it.
You can also change the size of the tray icons by clicking the blank space around them and clicking on “Properties” on the menu that opens up. In that “Properties” menu you can change the size of the tray icons.
For everything else in XFCE, you might want to consider following the same steps as the window managers.
Window managers like i3 can be tricky. They don’t have fancy graphical configurations that you can use to set the display resolution or to scale the display. For that you’re going to have to work directly with the X server.
The first thing that you need to do is set the DPI of the fonts. You can do this through the “.Xresources” file. Add the following block to tell programs that load from “.Xresources” how to handle fonts.
Xft.dpi: 180 Xft.autohint: 0 Xft.lcdfilter: lcddefault Xft.hintstyle: hintfull Xft.hinting: 1 Xft.antialias: 1 Xft.rgba: rgb
Obviously, set the DPI to match your monitor.
Now, the best way to set the DPI for the X server is
xrandr. Just run the command with the
--dpi flag followed by the DPI of your screen.
xrandr --dpi 180
If you don’t want to run that command every time you boot up your computer, you can add it into your window manager’s configuration to run at startup or even the “.xinitrc” file. Running it in front of i3 in “.xinitrc” would look like the example below.
[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources & xrandr --dpi 180 exec i3
Adding the line to i3’s configuration file would look like this:
exec xrandr --dpi 180
Either way should work. If it still doesn’t, you may need to specify your monitor’s resolution and dimensions in “/etc/X11/xorg.conf” so the X server can accurately determine how to scale everything.
None of these solutions are universal. Different applications calculate DPI differently and get their information from different sources. You may have to address applications individually. If you’re having issues with a number of programs, consider following the steps outlined for window managers. Since they directly impact the X server and a lot of programs get their information from the X server, changing those settings might solve a number of problems at once.
Our latest tutorials delivered straight to your inbox