Difference between revisions of "HiDPI"

From ArchWiki
Jump to navigation Jump to search
(Clarify that this is specifically to fix an issue of font garbling, not just font size. Hopefully this will help people searching for a solution to the issue of unreadable (corrupted) fonts)
m (→‎Spotify: The config file may not exist by default.)
 
(158 intermediate revisions by 76 users not shown)
Line 1: Line 1:
 
[[Category:Graphics]]
 
[[Category:Graphics]]
 
[[ja:HiDPI]]
 
[[ja:HiDPI]]
 +
[[zh-hans:HiDPI]]
 
{{Related articles start}}
 
{{Related articles start}}
 
{{Related|Font configuration}}
 
{{Related|Font configuration}}
Line 11: Line 12:
  
 
=== GNOME ===
 
=== GNOME ===
 +
To enable HiDPI, ''Settings > Devices > Displays'',or use gsettings:
  
To enable HiDPI, use gsettings:
+
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "[{'Gdk/WindowScalingFactor', <2>}]"
 +
$ gsettings set org.gnome.desktop.interface scaling-factor 2
  
gsettings set org.gnome.desktop.interface scaling-factor 2
+
{{Note|1=GNOME only allows integer scaling numbers to be set. 1 = 100%, 2 = 200%, etc.}}
  
{{Note|1={{ic|scaling-factor}} only allows whole numbers to be set. 1 = 100%, 2 = 200%, etc...}}
+
==== Fractional Scaling ====
  
 
A setting of {{ic|2, 3, etc}}, which is all you can do with {{ic|scaling-factor}}, may not be ideal for certain HiDPI displays and smaller screens (e.g. small tablets).   
 
A setting of {{ic|2, 3, etc}}, which is all you can do with {{ic|scaling-factor}}, may not be ideal for certain HiDPI displays and smaller screens (e.g. small tablets).   
  
Alternatively, you can achieve any non-integer scale factor by using a combination of {{ic|scaling-factor}} and {{ic|xrandr}}.  This combination keeps the TTF fonts properly scaled so that they do not become blurry if using {{ic|xrandr}} alone. You specify zoom-in factor with {{ic|gsettings}} and zoom-out factor with {{ic|xrandr}}.
+
* Wayland
  
{{Style|This is not a script, so comments belong to wikitext and not the code blocks.}}
+
Enable fractional Scaling experimental-feature:
  
Here is a method to find a comfortable scale factor for your screen:
+
$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"
  
First scale Gnome up to the minimum size which is too big.
+
then open ''Settings > Devices > Displays'' (the new options may only appear after a restart)
Usually "2" is already too big, but if "2" is still small for you, try "3", etc.
 
gsettings set org.gnome.desktop.interface scaling-factor 2
 
Now start scaling down by setting zoom-out factor with xrandr.
 
First get the output name:
 
{{hc|<nowiki>xrandr | grep -v disconnected | grep connected | cut -d' ' -f1</nowiki>|eDP1}}
 
  
Use this value to specify --output further on.
+
* Xorg
If you have two or more screens you can set their scale independently.
 
  
Now, to zoom-out 1.2 times, run the following:
+
You can achieve any non-integer scale factor by using a combination of GNOME's {{ic|scaling-factor}} and [[xrandr]]. This combination keeps the TTF fonts properly scaled so that they do not become blurry if using {{ic|xrandr}} alone. You specify zoom-in factor with {{ic|gsettings}} and zoom-out factor with [[xrandr]].
xrandr --output eDP1 --scale 1.2x1.2
 
If the UI is still too big, increase the scale:
 
xrandr --output eDP1 --scale 1.25x1.25
 
If UI becomes too small, decrease the scale factor a bit.
 
Repeat until you find a value which works best for your screen and your eyes.
 
  
Finally, you need to allow the mouse to navigate the whole screen.
+
First scale GNOME up to the minimum size which is too big. Usually "2" is already too big, otherwise try "3" etc. Then start scaling down by setting zoom-out factor with [[xrandr]]. First get the relevant output name, the examples below use {{ic|eDP1}}. Start e.g. with zoom-out 1.25 times. If the UI is still too big, increase the scale factor; if it is too small decrease the scale factor.
To do this you need to get the current scaled resolution:
 
  
{{hc|<nowiki>xrandr | grep eDP1</nowiki>|eDP1 connected primary 2304x1296+0+0 (normal left inverted right x axis y axis) 239mm x 134mm}}
+
$ xrandr --output eDP1 --scale 1.25x1.25
  
Now use the acquired resolution value to set correct panning:
+
{{Note|To allow the mouse to reach the whole screen, you may need to use the {{ic|--panning}} option as explained in [[#Side display]].}}
xrandr --output eDP1 --panning 2304x1296
 
  
=== KDE ===
+
{{Accuracy|The following was initially added under [[#X Resources]]. Clarify how it integrates with the info there or that above for GNOME.|section=GNOME ignores X settings}}
  
KDE plasma 5 provides decent support for HiDPI screens.
+
GNOME ignores X settings due to its xsettings Plugin in Gnome Settings Daemon, where DPI setting is hard coded.
 +
There is blog entry for [http://blog.drtebi.com/2012/12/changing-dpi-setting-on-gnome-34.html recompiling Gnome Settings Daemon].
 +
In the source documentation there is another way mentioned to set X settings DPI:
  
Please follow these guidelines for HiDPI support in KDE plasma 5
+
You can use the dconf Editor and navigate to key
  
# System Settings →  Display and Monitor Display Configuration →  Scale Display
+
/org/gnome/settings-daemon/plugins/xsettings/overrides
# Then drag the slider to 2
+
 
# Log out and back in for all applications to take the new setting into account
+
and complement the entry with the value
 +
 
 +
'Xft/DPI': <153600>
 +
 
 +
From README.xsettings
 +
 
 +
Noting that variants must be specified in the usual way (wrapped in <>).
 +
 
 +
Note also that DPI in the above example is expressed in 1024ths of an inch.
 +
 
 +
==== Text Scaling ====
 +
 
 +
Alternatively or additionally to above solution, you can scale only text by factor not limited by whole numbers, for example:
 +
 
 +
$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.5
 +
 
 +
=== KDE Plasma ===
 +
 
 +
You can use Plasma's settings to fine tune font, icon, and widget scaling. This solution affects both Qt and GTK applications.
 +
 
 +
To adjust font, widget, and icon scaling together:
 +
 
 +
# ''System Settings > Display and Monitor > Display Configuration > Scale Display''
 +
# Drag the slider to the desired size
 +
# Restart for the settings to take effect
 +
 
 +
To adjust only font scaling:
 +
 
 +
# ''System Settings > Fonts''
 +
# Check "Force fonts DPI" and adjust the DPI level to the desired value. This setting should take effect immediately for newly started applications. You will have to logout and login for it to take effect on Plasma desktop.
 +
 
 +
To adjust only icon scaling:
 +
 
 +
# ''System Settings > Icons > Advanced''
 +
# Choose the desired icon size for each category listed. This should take effect immediately.
 +
 
 +
'''Display Scale not integer bug'''
 +
{{Accuracy|This doesn't seem to be necessary any more, only do it if you encounter this issue.}}
 +
When using not integer values for Display Scale it may causes font render issue in some Qt application. A workaround for this is to:
 +
 
 +
# Set the scale value to {{ic|1}}
 +
# Adjust your font and icons and use the "Force fonts DPI" ( this affects all apps, also GTK but not create issue with the fonts )
 +
# Restart Plasma
 +
# If required tune the GTK apps using the variables {{ic|GDK_SCALE}}/{{ic|GDK_DPI_SCALE}} (as described above)
  
 
==== Tray icons with fixed size ====
 
==== Tray icons with fixed size ====
If the tray icons are not scaled with the rest of the desktop, the size can be set editing the default value for ''iconSize'' in {{ic|/usr/share/plasma/plasmoids/org.kde.plasma.private.systemtray/contents/config/main.xml}} (e.g. the value 2 may be fine):
+
 
{{hc|/usr/share/plasma/plasmoids/org.kde.plasma.private.systemtray/contents/config/main.xml|<nowiki>
+
The tray icons are not scaled with the rest of the desktop, since Plasma ignores the Qt scaling settings by default. To make Plasma respect the Qt settings, set {{ic|PLASMA_USE_QT_SCALING}} to {{ic|1}}.
<entry name="iconSize" type="Int">
 
    <label>Default icon size for the systray icons, it's an enum which values mean,
 
          Small, SmallMedium, Medium, Large, Huge, Enormous respectively. On low
 
          DPI systems they correspond to 16, 22, 32, 48, 64, 128 pixels. On high
 
          DPI systems those values would be scaled up, depending on the DPI.</label>                   
 
    <default></nowiki>'''2'''<nowiki></default>
 
</entry>
 
</nowiki>}}
 
  
 
=== Xfce ===
 
=== Xfce ===
  
Go to Settings Manager Appearance Fonts, and change the DPI parameter. The value of 180 or 192 seems to work well on Retina screens. To get a more precise number, you can use <code>xdpyinfo | grep resolution</code>, and then double it.
+
Xfce uses the DPI given by the X server. There is an option to override Font DPI (''Settings Manager > Appearance > Fonts > DPI > Custom DPI setting'') but it's better to adjust X server DPI instead. See [[Xorg#Display size and DPI]] for how to fix it.
  
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.
+
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.
 +
 
 +
Xfwm comes with two hidpi themes: Default-hdpi and Default-xhdpi. You can set them under ''Settings Manager > Window Manager > Style > Theme''.
 +
 
 +
You can set the default icon sizes of gtk2 menus, buttons and so on under ''Settings Manager > Settings Editor > xsettings > Gtk > IconSizes'', with a line like this: {{ic|1=gtk-large-toolbar=96,96:gtk-small-toolbar=64,64:gtk-menu=64,64:gtk-dialog=96,96:gtk-button=64,64:gtk-dnd=64,64}}. "gtk-dnd" is for the icons during drag'n'drop, the others are quite self-explanatory. You can use any value your icon theme supports.
  
 
=== Cinnamon ===
 
=== Cinnamon ===
  
Supports HiDPI since 2.2. The support is pretty good (e.g. window borders are correctly sized, which is not the case under Xfce).
+
Has good support out of the box.
  
 
=== Enlightenment ===
 
=== 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.
+
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 ==
 
== X Server ==
Line 93: Line 124:
 
To verify that the X Server has properly detected the physical dimensions of your monitor, use the ''xdpyinfo'' utility from the {{Pkg|xorg-xdpyinfo}} package:
 
To verify that the X Server has properly detected the physical dimensions of your monitor, use the ''xdpyinfo'' utility from the {{Pkg|xorg-xdpyinfo}} package:
  
$ xdpyinfo | grep -B 2 resolution
+
{{hc|$ xdpyinfo {{!}} grep -B 2 resolution|
screen #0:
+
screen #0:
  dimensions:    3200x1800 pixels (423x238 millimeters)
+
  dimensions:    3200x1800 pixels (423x238 millimeters)
  resolution:    192x192 dots per inch
+
  resolution:    192x192 dots per inch
 +
}}
  
This examples uses inaccurate dimensions (423mm x 328mm, even though the Dell XPS 9530 has 346mm x 194mm) to have a clean multiple of 96 dpi, in this case 192 dpi. This tends to work better than using the correct DPI — Pango renders fonts crisper in i3 for example.
+
This example uses inaccurate dimensions (423mm x 328mm, even though the Dell XPS 9530 has 346mm x 194mm) to have a clean multiple of 96 dpi, in this case 192 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.
 
If the DPI displayed by xdpyinfo is not correct, see [[Xorg#Display size and DPI]] for how to fix it.
Line 104: Line 136:
 
== X Resources ==
 
== 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 DPI setting manually via the {{ic|Xft.dpi}} variable in {{ic|~/.Xresources}}:
+
If you are not using a desktop environment such as KDE, Xfce, or other that manipulates the X settings for you, you can set the desired DPI setting manually via the {{ic|Xft.dpi}} variable in [[Xresources]]:
  
{{hc|~/.Xresources|<nowiki>
+
{{hc|~/.Xresources|2=
 
Xft.dpi: 180
 
Xft.dpi: 180
 
Xft.autohint: 0
 
Xft.autohint: 0
Line 114: Line 146:
 
Xft.antialias: 1
 
Xft.antialias: 1
 
Xft.rgba: rgb
 
Xft.rgba: rgb
</nowiki>}}
+
}}
  
 
Make sure the settings are loaded properly when X starts, for instance in your {{ic|~/.xinitrc}} with {{ic|xrdb -merge ~/.Xresources}} (see [[Xresources]] for more information).
 
Make sure the settings are loaded properly when X starts, for instance in your {{ic|~/.xinitrc}} with {{ic|xrdb -merge ~/.Xresources}} (see [[Xresources]] for more information).
Line 125: Line 157:
 
=== Qt 5 ===
 
=== Qt 5 ===
  
Since Qt 5.6, Qt 5 applications can be instructed to honor screen DPI by setting the {{ic|QT_AUTO_SCREEN_SCALE_FACTOR}} environment variable, for example by creating a file {{ic|/etc/profile.d/qt-hidpi.sh}}
+
Since Qt 5.6, Qt 5 applications can be instructed to honor screen DPI by setting the {{ic|QT_AUTO_SCREEN_SCALE_FACTOR}} environment variable:
  
 
  export QT_AUTO_SCREEN_SCALE_FACTOR=1
 
  export QT_AUTO_SCREEN_SCALE_FACTOR=1
  
And set the executable bit on it.
+
If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen ({{ic|QT_SCREEN_SCALE_FACTORS}}) or globally ({{ic|QT_SCALE_FACTOR}}). For more details see the [https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/ Qt blog post] or [https://doc.qt.io/qt-5/highdpi.html Qt developer documentation].
  
If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen ({{ic|QT_SCREEN_SCALE_FACTORS}}) or globally ({{ic|QT_SCALE_FACTOR}}). For more details see the [https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/ Qt blog post].
+
{{Note|
 +
* If you manually set the screen factor, it is important to set {{ic|1=QT_AUTO_SCREEN_SCALE_FACTOR=0}} otherwise some applications which explicitly force high DPI enabling get scaled twice.
 +
* {{ic|QT_SCALE_FACTOR}} scales fonts, but {{ic|QT_SCREEN_SCALE_FACTORS}} does not scale fonts.
 +
* If you also set the font DPI manually in ''xrdb'' to support other toolkits, {{ic|QT_SCALE_FACTORS}} will give you huge fonts.
 +
* If you have multiple screens of differing DPI ie: [[#Side display]] you may need to do {{ic|1=QT_SCREEN_SCALE_FACTORS="2;2"}}
 +
}}
  
Note if you manually set the screen factor, it's important to set QT_AUTO_SCREEN_SCALE_FACTOR=0 otherwise some applications which explicitly force high DPI enabling get scaled twice.
+
An [https://bugreports.qt.io/browse/QTBUG-53022 alternative] is e.g.:
  
QT_SCALE_FACTOR will scale fonts
+
QT_FONT_DPI=96 vym
QT_SCREEN_SCALE_FACTORS will *not* scale fonts
 
  
If you also set the font DPI manually in xrdb to support other toolkits - QT_SCALE_FACTORS will give you a huge fonts.
+
=== GDK 3 (GTK 3) ===
  
=== GDK 3 (GTK+ 3) ===
+
{{Note|As stated in the [[#X Resources]] section, if you have xft.dpi set to a larger dpi, it will make other scales larger than usual, including GDK.}}
 +
 
 +
Setting the GDK scale will scale the UI, however it will not scale icons. If you are using a minimal window manager where you are setting the dpi via Xft.dpi, GDK should scale perfectly fine with it. In other cases, do the following:
  
 
To scale UI elements by a factor of two:
 
To scale UI elements by a factor of two:
Line 150: Line 188:
 
  export GDK_DPI_SCALE=0.5
 
  export GDK_DPI_SCALE=0.5
  
=== GTK+ 2 ===
+
=== GTK 2 ===
  
 
Scaling of UI elements is not supported by the toolkit itself, however it's possible to generate a theme with elements pre-scaled for HiDPI display using {{AUR|oomox-git}}.
 
Scaling of UI elements is not supported by the toolkit itself, however it's possible to generate a theme with elements pre-scaled for HiDPI display using {{AUR|oomox-git}}.
Line 162: Line 200:
 
For more details see https://phab.enlightenment.org/w/elementary/
 
For more details see https://phab.enlightenment.org/w/elementary/
  
== Display managers ==
+
== Boot managers ==
 +
 
 +
=== GRUB ===
  
=== SDDM ===
+
==== Lower the framebuffer resolution ====
  
{{Accuracy|General issue, see [[HiDPI#X_Server]]}}
+
Set a lower resolution for the framebuffer as explained in [[GRUB/Tips and tricks#Setting the framebuffer resolution]].
  
To scale SDDM you have to change the following properties in {{ic|/etc/sddm.conf}}.
+
==== Change GRUB font size ====
It is recommended to make a backup of your config before editing it.
 
  
[XDisplay]
+
Find a ttf font that you like in {{ic|/usr/share/fonts/}}.
# X server arguments
 
ServerArguments=-nolisten tcp -dpi 144
 
  
==== Alternative way using Xrandr ====
+
Convert the font to a format that GRUB can utilize:
  
If setting ServerArguments fails, it is possible to directly change the DPI setting via xrandr.
+
# grub-mkfont -s 30 -o /boot/grubfont.pf2 /usr/share/fonts/FontFamily/FontName.ttf
Modify {{ic|/etc/sddm.conf}} and add the following section into file:
 
  
[XDisplay]
+
{{Note|Change the {{ic|-s 30}} parameter to modify the font size}}
# script to execute when starting the display server
 
# default to /usr/share/sddm/scripts/Xsetup
 
DisplayCommand=/etc/sddm/Xsetup
 
  
Then copy {{ic|/usr/share/sddm/scripts/Xsetup}} into {{ic|/etc/sddm/Xsetup}} with the following
+
Edit {{ic|/etc/default/grub}} to set the new font as shown in [[GRUB/Tips and tricks#Background image and bitmap fonts]]:
lines:
 
  
  #!/bin/sh
+
  GRUB_FONT="/boot/grubfont.pf2"
# Xsetup - run as root before the login dialog appears
 
/usr/bin/xrandr --dpi 144
 
  
Please read {{ic|sddm.conf(5)}} for detailed configuration parameters.
+
Update GRUB configuration by running {{ic|grub-mkconfig -o /boot/grub/grub.cfg}}
  
== Boot managers ==
+
=== systemd-boot ===
  
=== GRUB ===
+
Adding the following line and running {{ic|bootctl update}} increases font-size in the [[systemd-boot#Loader_configuration|systemd-boot]] menu:
  
A possible solution is to use a big size font. Generate a GRUB font of custom size, e.g. using the font DejaVu Sans Mono and size 36:
+
{{hc|/boot/loader/loader.conf|2=
 +
console-mode 1
 +
}}
  
# grub-mkfont --output=/boot/grub/fonts/DejaVuSansMono36.pf2 --size=36 /usr/share/fonts/TTF/DejaVuSansMono.ttf
+
== Applications ==
  
then set GRUB to use it, adding the {{ic|1=GRUB_FONT}} line to {{ic|1=/etc/default/grub}}
+
{{Accuracy|{{ic|--force-device-scale-factor}} only works on Chromium based (including Electron) applications.}}
  
{{hc|1=/etc/default/grub|2=GRUB_FONT=/boot/grub/fonts/DejaVuSansMono36.pf2}}
+
As a general rule, applications can be launched with a custom scaling value, e.g. {{ic|1=$ atom --force-device-scale-factor=2}}. A more permanent solution is to add this scaling factor as a flag to the relevant .conf or .desktop file (normally located at {{ic|/usr/share/applications/}}). In the latter instance, the flag should be added to the line beginning with "Exec=", e.g. {{ic|1=Exec=/usr/bin/atom --force-device-scale-factor=2 %F}}. The next section provides more details on implementing this for specific applications.
  
and finally update GRUB configuration with
+
=== Atom ===
  
# grub-mkconfig -o /boot/grub/grub.cfg
+
Add {{ic|1=--force-device-scale-factor=2}} as a flag to the atom.desktop file:
  
== Applications ==
+
{{hc|/usr/share/applications/atom.desktop|2=
 +
Exec=/usr/bin/atom --force-device-scale-factor=2 %F
 +
}}
  
 
=== Browsers ===
 
=== Browsers ===
Line 216: Line 250:
 
==== Firefox ====
 
==== Firefox ====
  
Open Firefox advanced preferences page ({{ic|about:config}}) and set parameter {{ic|layout.css.devPixelsPerPx}} to {{ic|2}} (or find the one that suits you better; {{ic|2}} is a good choice for Retina screens).
+
Firefox should use the [[#GDK 3 (GTK 3)]] settings. However, the suggested {{ic|GDK_SCALE}} suggestion does not consistently scale the entirety of Firefox, and does not work for fractional values (e.g., a factor of 158DPI/96DPI = 1.65 for a 1080p 14" laptop). You may want to use {{ic|GDK_DPI_SCALE}} instead. Another option, which will avoid Firefox-specific settings in many setups is to use the settings in [[#X Resources]] as Firefox should respect the  {{ic|Xft.dpi}} value defined there.
 +
 
 +
To override those, open Firefox advanced preferences page ({{ic|about:config}}) and set parameter {{ic|layout.css.devPixelsPerPx}} to {{ic|2}} (or find the one that suits you better; {{ic|2}} is a good choice for Retina screens), but it also does not consistently scale the entirety of Firefox. If Firefox is not scaling fonts, you may want to create {{ic|userChrome.css}} and add appropriate styles to it. More information about {{ic|userChrome.css}} at [http://kb.mozillazine.org/index.php?title=UserChrome.css mozillaZine].
 +
 
 +
{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|
 +
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 +
 
 +
/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */
 +
* {
 +
    font-size: 15px !important;
 +
}
 +
 
 +
/* exception for badge on adblocker */
 +
.toolbarbutton-badge {
 +
    font-size: 8px !important;
 +
}
 +
}}
 +
 
 +
{{Warning|The following extension is not compatible with Firefox Quantum (version 57 and above).}}
 +
 
 +
If you use a HiDPI monitor such as Retina display together with another monitor, you can use [https://addons.mozilla.org/en-US/firefox/addon/autohidpi/ AutoHiDPI] add-on in order to automatically adjust {{ic|layout.css.devPixelsPerPx}} setting for the active screen. Also, since Firefox version 49, it auto-scales based on your screen resolution, making it easier to deal with 2 or more screens.
  
If you use a HiDPI monitor such as Retina display together with another monitor, you can use [https://addons.mozilla.org/en-US/firefox/addon/autohidpi/ AutoHiDPI] add-on in order to automatically adjust {{ic|layout.css.devPixelsPerPx}} setting for the active screen.
+
If you use Wayland, see [[Firefox#Wayland]] for instructions to enable the optional Wayland backend on {{pkg|firefox}}. This is also appicable to {{pkg|thunderbird}}.
  
From Firefox version 38 onwards, your system (GTK+ 3.10) settings should be taken into account.[https://bugzilla.mozilla.org/show_bug.cgi?id=975919]
+
You can also use the Wayland-enabled packages of Firefox from the AUR: {{AUR|firefox-wayland}} (compiles from source) or {{AUR|fedora-firefox-wayland-bin}} (binary from Fedora). You might experience some minor visual glitches with these packages.
  
 
==== Chromium / Google Chrome ====
 
==== Chromium / Google Chrome ====
  
Full out of the box HiDPI support is available in {{Pkg|chromium}} and {{AUR|google-chrome}} as tested (with google-chrome) on Gnome and Cinnamon. Additionally, for environments where out of the box support does not work, the browser can be launched with the command line flag {{ic|--force-device-scale-factor}} and a scaling value. This will scale all content and ui, including tab and font size. For example:
+
Chromium should use the [[#GDK 3 (GTK 3)]] settings.
 +
 
 +
To override those, use the {{ic|1=--force-device-scale-factor}} flag with a scaling value. This will scale all content and ui, including tab and font size. For example {{ic|1=chromium --force-device-scale-factor=2}}.
 +
 
 +
Using this option, a scaling factor of 1 would be normal scaling. Floating point values can be used. To make the change permanent, for Chromium, you can add it to {{ic|~/.config/chromium-flags.conf}}:
  
{{bc|1=chromium --force-device-scale-factor=2}}
+
{{hc|~/.config/chromium-flags.conf|2=
 +
--force-device-scale-factor=2
 +
}}
  
Using this option, a scaling factor of 1 would be normal scaling. Floating point values can be used.
+
To make this work for Chrome, add the same option to {{ic|~/.config/chrome-flags.conf}} instead.
  
 
If you use a HiDPI monitor such as Retina display together with another monitor, you can use the [https://chrome.google.com/webstore/detail/resolution-zoom/enjjhajnmggdgofagbokhmifgnaophmh reszoom] extension in order to automatically adjust the zoom level for the active screen.
 
If you use a HiDPI monitor such as Retina display together with another monitor, you can use the [https://chrome.google.com/webstore/detail/resolution-zoom/enjjhajnmggdgofagbokhmifgnaophmh reszoom] extension in order to automatically adjust the zoom level for the active screen.
Line 234: Line 294:
 
==== Opera ====
 
==== Opera ====
  
Since version 24 one can alter Opera's DPI by starting it with the {{ic|1=--alt-high-dpi-setting=X}} command line option, where X is the desired DPI. For example, with {{ic|1=--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.)
+
Opera should use the [[#GDK 3 (GTK 3)]] settings.
  
Generally speaking, Opera's HiDPI support is excellentSince it is also built using Chromium's blink renderer, and has an extension which runs most Chrome extensions, it is a very viable alternative to Chromium/Chrome.
+
To override those, use the {{ic|1=--alt-high-dpi-setting=X}} command line option, where X is the desired DPI. For example, with {{ic|1=--alt-high-dpi-setting=144}} Opera will assume that DPI is 144Newer versions of opera will auto detect the DPI using the font DPI setting (in KDE: the force font DPI setting.)
  
=== Thunderbird ===
+
=== Gimp 2.8 ===
 +
 
 +
Use a high DPI theme, or adjust {{ic|1=gtkrc}} of an existing theme. (Change all occurrences of the size {{ic|1=button}} to {{ic|1=dialog}}, for example {{ic|1=GimpToolPalette::tool-icon-size}}.)
 +
 
 +
There is also the [https://github.com/jedireza/gimp-hidpi gimp-hidpi].
 +
 
 +
=== Inkscape ===
  
See [[#Firefox]]. To access {{ic|about:config}}, go to Edit → Preferences → Advanced → Config editor.
+
To scale the icons to a "usable" size go to ''Preferences > Interface'' and set the icon size to Large or Larger[http://www.inkscapeforum.com/viewtopic.php?t=18684][http://wiki.inkscape.org/wiki/index.php/HiDPI].
  
=== Wine applications ===
+
=== IntelliJ IDEA ===
  
Run
+
IntelliJ IDEA 15 and above should include HiDPI support.[http://blog.jetbrains.com/idea/2015/07/intellij-idea-15-eap-comes-with-true-hidpi-support-for-windows-and-linux/] If it does not work, the most convenient way to fix the problem in this case seems to be changing the Override Default Fonts setting:
$ winecfg
 
and change the "dpi" setting found in the "Graphics" tab. This only affects the font size.
 
  
=== Skype ===
+
:''File > Settings > Behaviour & Appearance > Appearance''
  
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 {{Pkg|qt4}} and run {{ic|qtconfig-qt4}} to do it.
+
The addition of {{ic|1=-Dhidpi=true}} to the vmoptions file in either {{ic|$HOME/.IdeaC14/}} or {{ic|/usr/share/intelligj-idea-ultimate-edition/bin/}} of [https://youtrack.jetbrains.com/issue/IDEA-114944 release 14] should not be required anymore.
  
=== Spotify ===
+
=== Java applications ===
  
Spotify can be launched with a custom scaling factor, for example
+
Java applications using the AWT/Swing framework can be scaled by defining the sun.java2d.uiScale variable when invoking java. For example,
$ spotify --force-device-scale-factor=1.5
 
  
=== Zathura document viewer ===
+
java -Dsun.java2d.uiScale=2 -jar some_application.jar
  
No modifications required for document viewing.
+
Since Java 9 the GDK_SCALE environment variable is used to scale Swing applications accordingly.
  
UI text scaling is specified via [https://pwmt.org/projects/zathura/documentation/ configuration file] (note that "font" is a [https://pwmt.org/projects/girara/options/ girara option]):
+
=== MATLAB ===
  
set font "monospace normal 20"
+
Recent versions (R2017b) of [[MATLAB]] allow to set the scale factor[https://www.mathworks.com/matlabcentral/answers/406956-does-matlab-support-high-dpi-screens-on-linux]:
  
=== IntelliJ IDEA ===
+
>> s = settings;s.matlab.desktop.DisplayScaleFactor
 +
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2
  
IntelliJ IDEA 15 and above should include HiDPI support.[http://blog.jetbrains.com/idea/2015/07/intellij-idea-15-eap-comes-with-true-hidpi-support-for-windows-and-linux/] If it does not work, the most convenient way to fix the problem in this case seems to be changing the Override Default Fonts setting:
+
The settings take effect after MATLAB is restarted.
  
:''File -> Settings -> Behaviour & Appearance -> Appearance''
+
=== Mono applications ===
  
The addition of {{ic|1=-Dhidpi=true}} to the vmoptions file in either {{ic|$HOME/.IdeaC14/}} or {{ic|/usr/share/intelligj-idea-ultimate-edition/bin/}} of [https://youtrack.jetbrains.com/issue/IDEA-114944 release 14] should not be required anymore.
+
According to [https://bugzilla.xamarin.com/show_bug.cgi?id=35870], Mono applications should be scalable like [[#GDK 3 (GTK 3)|GTK 3]] applications.
  
 
=== NetBeans ===
 
=== NetBeans ===
Line 277: Line 341:
 
NetBeans allows the font size of its interface to be controlled using the {{ic|1=--fontsize}} parameter during startup. To make this change permanent edit the {{ic|1=/usr/share/netbeans/etc/netbeans.conf}} file and append the {{ic|1=--fontsize}} parameter to the {{ic|1=netbeans_default_options}} property.[http://wiki.netbeans.org/FaqFontSize]
 
NetBeans allows the font size of its interface to be controlled using the {{ic|1=--fontsize}} parameter during startup. To make this change permanent edit the {{ic|1=/usr/share/netbeans/etc/netbeans.conf}} file and append the {{ic|1=--fontsize}} parameter to the {{ic|1=netbeans_default_options}} property.[http://wiki.netbeans.org/FaqFontSize]
  
The editor fontsize can be controlled from Tools Option Fonts & Colors.
+
The editor fontsize can be controlled from ''Tools > Option > Fonts & Colors''.
 +
 
 +
The output window fontsize can be controlled from ''Tools > Options > Miscelaneous > Output''
 +
 
 +
=== Skype ===
 +
 
 +
Skype for Linux ({{AUR|skypeforlinux-stable-bin}} package) uses [[#GDK 3 (GTK 3)]].
 +
 
 +
=== Slack ===
  
The output window fontsize can be controlled from Tools → Options → Miscelaneous → Output
+
Slack ({{AUR|slack-desktop}}), like all [https://electronjs.org/ Electron] apps, can be configured to use a custom scaling value by adding a {{ic|1=--force-device-scale-factor}} flag to the .desktop file. This is normally located at {{ic|/usr/share/applications/}}. The flag should be added to the line beginning with "Exec=". For example:
  
=== Gimp 2.8 ===
+
{{hc|/usr/share/applications/slack.desktop|2=
 +
Exec=env LD_PRELOAD=/usr/lib/libcurl.so.3 /usr/bin/slack --force-device-scale-factor=1.5 %U
 +
}}
 +
 
 +
=== Spotify ===
  
Use a high DPI theme, or [http://gimpforums.com/thread-increase-all-icons-on-hidpi-screen?pid=39113#pid39113 adjust] {{ic|1=gtkrc}} of an existing theme. (Change all occurrences of the size {{ic|1=button}} to {{ic|1=dialog}}, for example {{ic|1=GimpToolPalette::tool-icon-size}}.)
+
You can change scale factor by simple {{ic|Ctrl++}} for zoom in, {{ic|Ctrl+-}} for zoom out and {{ic|Ctrl+0}} for default scale. Scaling setting will be saved in {{ic|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs}}, you may have to create this file by yourself:
  
There's also the [https://github.com/jedireza/gimp-hidpi gimp-hidpi].
+
{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|2=
 +
app.browser.zoom-level=100
 +
}}
  
=== VLC ===
+
Also Spotify can be launched with a custom scaling factor which will be multiplied with setting specified in {{ic|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs}}, for example
  
As of May 2015, the git version {{AUR|vlc-git}} seems to solve some of the problems.
+
$ spotify --force-device-scale-factor=1.5
  
 
=== Steam ===
 
=== Steam ===
 +
 +
==== Official HiDPI support ====
 +
 +
* Starting on 25 of January 2018 in the beta program there is actual support for HiDPI and it should be automatically detected.
 +
* ''Steam > Settings > Interface'', check "Enlarge text and icons based on monitor size" (restart required)
 +
* If it not automatically detected use {{ic|1=GDK_SCALE=2}} to set the desired scale factor.
 +
 +
==== Unofficial ====
  
 
The [https://github.com/MoriTanosuke/HiDPI-Steam-Skin HiDPI-Steam-Skin] can be installed to increase the font size of the interface. While not perfect, it does improve usability.  
 
The [https://github.com/MoriTanosuke/HiDPI-Steam-Skin HiDPI-Steam-Skin] can be installed to increase the font size of the interface. While not perfect, it does improve usability.  
  
{{Note|The skin must be downloaded to {{ic|1=~/.local/share/Steam/skins}}, not {{ic|1=~/.steam/skins/}} as the README says.}}
+
{{Note|The README for the HiDPI skin lists several possible locations for where to place the skin. The correct folder out of these can be identified by the presence of a file named {{ic|1=skins_readme.txt}}.}}
 +
 
 +
[http://steamcommunity.com/groups/metroskin/discussions/0/517142253861033946/ MetroSkin Unofficial Patch] also helps with HiDPI on Steam with Linux.
 +
 
 +
=== Sublime Text 3 ===
 +
 
 +
Sublime Text 3 has full support for display scaling. Go to ''Preferences > Settings > User Settings'' and add {{ic|"ui_scale": 2.0}} to your settings.
 +
 
 +
=== Thunderbird ===
 +
 
 +
See [[#Firefox]]. To access {{ic|about:config}}, go to ''Edit > Preferences > Advanced >Config editor''.
 +
 
 +
=== VirtualBox ===
 +
 
 +
{{Note|This only applies to KDE with scaling enabled.}}
 +
 
 +
VirtualBox also applies the system-wide scaling to the virtual monitor, which reduces the maximum resolution inside VMs by your scaling factor (see [https://www.virtualbox.org/ticket/16604]).
 +
 
 +
This can be worked around by calculating the inverse of your scaling factor and manually setting this new scaling factor for the VirtualBox execution, e.g.
  
=== Unsupported applications ===
+
$ QT_SCALE_FACTOR=0.5 VirtualBox --startvm vm-name
  
One approach is to run the application full screen and without decoration in its own VNC desktop. Then scale the viewer. With Vncdesk ({{AUR|vncdesk-git}} from the [[AUR]]) you can set up a desktop per application, then start server and client with a simple command such as {{ic|vncdesk 2}}.
+
=== Wine applications ===
  
[[x11vnc]] has an experimental option {{ic|-appshare}}, which opens one viewer per application window. Perhaps something could be hacked up with that.
+
Run
  
== Multiple displays ==
+
$ winecfg
The HiDPI setting applies to the whole desktop, so non-HiDPI external displays show everything too large.
 
  
=== Side display ===
+
and change the "dpi" setting found in the "Graphics" tab. This only affects the font size.
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 eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1
+
=== Zathura document viewer ===
  
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 [https://gist.github.com/wvengen/178642bbc8236c1bdb67 this script].
+
No modifications required for document viewing.
  
You may run into problems with your mouse not being able to reach the whole screen. That is a [https://bugs.freedesktop.org/show_bug.cgi?id=39949 known bug] with an xserver-org patch (or try the panning option, but that might cause other problems).
+
UI text scaling is specified via [https://pwmt.org/projects/zathura/documentation/ configuration file] (note that "font" is a [https://pwmt.org/projects/girara/options/ girara option]):
  
An example of the panning syntax for a 4k laptop with an external 1920x1080 monitor to the right:
+
set font "monospace normal 20"
  
xrandr --output eDP-1 --auto --output HDMI-1 --auto --panning 3840x2160+3840+0 --scale 2x2 --right-of eDP-1
+
=== Zoom ===
  
Generically if your HiDPI monitor is AxB pixels and your regular monitor is CxD and you are scaling by [ExF], the commandline for right-of is:
+
Zoom can be started with a proper scaling by overriding the {{ic|1=QT_SCALE_FACTOR}} environment variable.
  
  xrandr --output eDP-1 --auto --output HDMI-1 --auto --panning [C*E]x[D*F]+[A]+0 --scale [E]x[F] --right-of eDP-1
+
  $ QT_SCALE_FACTOR=2 zoom
  
 +
=== Unsupported applications ===
  
If panning is not a solution for you it may be better to set position of monitors and fix manually the total display screen.
+
{{AUR|run_scaled-git}} can be used to scale applications (which uses {{Pkg|xpra}} internally).
  
An example of the syntax for a 2560x1440 WQHD 210 DPI laptop monitor (eDP1) using native resolution placed below a 1920x1080 FHD 96 DPI external monitor (HDMI) scaled to match global DPI settings:
+
Another approach is to run the application full screen and without decoration in its own VNC desktop. Then scale the viewer. With Vncdesk ({{AUR|vncdesk-git}} from the [[AUR]]) you can set up a desktop per application, then start server and client with a simple command such as {{ic|vncdesk 2}}.
  
xrandr --output eDP-1 --auto --pos 0x1458 --output HDMI-1 --scale 1.35x1.35 --auto --pos 0x0 --fb 2592x2898
+
[[x11vnc]] has an experimental option {{ic|-appshare}}, which opens one viewer per application window. Perhaps something could be hacked up with that.
  
The total screen size (--fb) and positioning (--pos) are to be calculated taking into account the scaling factor.
+
== Multiple displays ==
 +
 
 +
The HiDPI setting applies to the whole desktop, so non-HiDPI external displays show everything too large. However, note that setting different scaling factors for different monitors is already supported in [[Wayland]].
 +
 
 +
=== Side display ===
  
In this case laptop monitor (eDP1) has no scaling and uses native mode for resolution so it will total 2560x1440, but external monitor (HDMI) is scaled and it has to be considered a larger screen so (1920*1.35)x(1080*1.35) from where the eDP1 Y position came 1080*1.35=1458 and the total screen size: since one on top of the other X=(greater between eDP1 and HDMI, so 1920*1.35=2592) and Y=(sum of the calculated heights of eDP1 and HDMI, so 1440+(1080*1.35)=2898).
+
One workaround is to use [[xrandr]]'s scale option. To have a non-HiDPI monitor (on DP1) right of an internal HiDPI display (eDP1), one could run:
  
Generically if your hidpi monitor is AxB pixels and your regular monitor is CxD and you are scaling by [ExF] and hidpi is placed below regular one, the commandline for right-of is:
+
$ xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1
  
xrandr --output eDP-1 --auto --pos 0x(DxF) --output HDMI-1 --auto --scale [E]x[F] --pos 0x0 --fb [greater between A and (C*E)]x[B+(D*F)]
+
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.
  
 
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.
 
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.
 +
 +
{{Note|1=Above solution with {{ic|--scale 2x2}} does not work on some Nvidia cards. No solution is currently available. [https://bbs.archlinux.org/viewtopic.php?pid=1670840] A potential workaround exists with configuring {{ic|1=ForceFullCompositionPipeline=On}} on the {{ic|CurrentMetaMode}} via {{ic|nvidia-settings}}. For more info see [https://askubuntu.com/a/979551/763549].}}
 +
 +
{{Note|If you are using the {{ic|modesetting}} driver you will get mouse flickering. This can be solved by scaling your non-scaled screen by 0.9999x0.9999.}}
 +
 +
=== Multiple external monitors ===
 +
 +
There might be some problems in scaling more than one external monitors which have lower dpi than the built-in HiDPI display. In that case, you may want to try downscaling the HiDPI display instead, with e.g.
 +
 +
$ xrandr --output eDP1 --scale 0.5x0.5 --output DP2 --right-of eDP1 --output HDMI1 --right-of DP2
 +
 +
In addition, when you downscale the HiDPI display, the font on the HiDPI display will be slightly blurry, but it's a different kind of bluriness compared with the one introduced by upscaling the external displays. You may compare and see which kind of bluriness is less problematic for you.
  
 
=== Mirroring ===
 
=== Mirroring ===
Line 344: Line 463:
 
If all you want is to mirror ("unify") displays, this is easy as well:
 
If all you want is to mirror ("unify") displays, this is easy as well:
  
With AxB your native HiDPI resolution (for ex 3200x1800) and CxD your external screen resolution (for ex 1920x1200)
+
With AxB your native HiDPI resolution (for ex 3200x1800) and CxD your external screen resolution (e.g. 1920x1200)
  
  xrandr --output HDMI --scale [A/C]x[B/D]
+
  $ xrandr --output HDMI --scale [A/C]x[B/D]
  
 
In this example which is QHD (3200/1920 = 1.66 and 1800/1200 = 1.5)
 
In this example which is QHD (3200/1920 = 1.66 and 1800/1200 = 1.5)
  
  xrandr --output HDMI --scale 1.66x1.5
+
  $ xrandr --output HDMI --scale 1.66x1.5
  
For UHD to 1080p (3840/1920=2 2160/1080=1.98)
+
For UHD to 1080p (3840/1920=2 2160/1080=2)
  
  xrandr --output HDMI --scale 2x1.98
+
  $ xrandr --output HDMI --scale 2x2
  
 
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.
 
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.
 +
 +
=== Tools ===
 +
 +
There are several tools which automate the commands described above.
 +
 +
* [https://gist.github.com/wvengen/178642bbc8236c1bdb67 This script] extend a non-HiDPI external display above a HiDPI internal display.
 +
* [https://github.com/ashwinvis/xrandr-extend xrandr-extend].
 +
* {{AUR|xlayoutdisplay}} is a CLI front end for xrandr which detects and sets correct DPI: [https://github.com/alex-courtis/xlayoutdisplay README]
  
 
== Linux console ==
 
== Linux console ==
  
The default [[w:Linux console|Linux console]] font will be very small on hidpi displays, the largest font present in the {{Pkg|kbd}} package is {{ic|latarcyrheb-sun32}} and other packages like {{Pkg|terminus-font}} contain further alternatives, such as {{ic|ter-132n}}(normal) and {{ic|ter-132b}}(bold). See [[Fonts#Console fonts]] for configuration details.
+
The default [[w:Linux console|Linux console]] font will be very small on HiDPI displays, the largest font present in the {{Pkg|kbd}} package is {{ic|latarcyrheb-sun32}} and other packages like {{Pkg|terminus-font}} contain further alternatives, such as {{ic|ter-132n}}(normal) and {{ic|ter-132b}}(bold). See [[Linux console#Fonts]] for configuration details. Also see [[Linux console#Persistent configuration]] in particular for applying the font setting during the early userspace boot sequence.
  
 
After changing the font, it is often garbled and unreadable when changing to other virtual consoles ({{ic|tty2-6}}). To fix this you can [[Kernel_mode_setting#Forcing_modes_and_EDID|force specific mode]] for KMS, such as {{ic|1=video=2560x1600@60}} (substitute in the native resolution of your HiDPI display), and reboot.
 
After changing the font, it is often garbled and unreadable when changing to other virtual consoles ({{ic|tty2-6}}). To fix this you can [[Kernel_mode_setting#Forcing_modes_and_EDID|force specific mode]] for KMS, such as {{ic|1=video=2560x1600@60}} (substitute in the native resolution of your HiDPI display), and reboot.
Line 368: Line 495:
 
* [http://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)
 
* [http://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)
 
* [http://www.eizo.com/library/basics/pixel_density_4k/ Understanding pixel density]
 
* [http://www.eizo.com/library/basics/pixel_density_4k/ Understanding pixel density]
 +
* [http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/ Mixed DPI and the X Window System]

Latest revision as of 19:12, 19 September 2019

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 high-end laptops and 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, Settings > Devices > Displays,or use gsettings:

$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "[{'Gdk/WindowScalingFactor', <2>}]"
$ gsettings set org.gnome.desktop.interface scaling-factor 2
Note: GNOME only allows integer scaling numbers to be set. 1 = 100%, 2 = 200%, etc.

Fractional Scaling

A setting of 2, 3, etc, which is all you can do with scaling-factor, may not be ideal for certain HiDPI displays and smaller screens (e.g. small tablets).

  • Wayland

Enable fractional Scaling experimental-feature:

$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

then open Settings > Devices > Displays (the new options may only appear after a restart)

  • Xorg

You can achieve any non-integer scale factor by using a combination of GNOME's scaling-factor and xrandr. This combination keeps the TTF fonts properly scaled so that they do not become blurry if using xrandr alone. You specify zoom-in factor with gsettings and zoom-out factor with xrandr.

First scale GNOME up to the minimum size which is too big. Usually "2" is already too big, otherwise try "3" etc. Then start scaling down by setting zoom-out factor with xrandr. First get the relevant output name, the examples below use eDP1. Start e.g. with zoom-out 1.25 times. If the UI is still too big, increase the scale factor; if it is too small decrease the scale factor.

$ xrandr --output eDP1 --scale 1.25x1.25
Note: To allow the mouse to reach the whole screen, you may need to use the --panning option as explained in #Side display.

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: The following was initially added under #X Resources. Clarify how it integrates with the info there or that above for GNOME. (Discuss in Talk:HiDPI#GNOME ignores X settings)

GNOME ignores X settings due to its xsettings Plugin in Gnome Settings Daemon, where DPI setting is hard coded. There is blog entry for recompiling Gnome Settings Daemon. In the source documentation there is another way mentioned to set X settings DPI:

You can use the dconf Editor and navigate to key

/org/gnome/settings-daemon/plugins/xsettings/overrides

and complement the entry with the value

'Xft/DPI': <153600>

From README.xsettings

Noting that variants must be specified in the usual way (wrapped in <>).

Note also that DPI in the above example is expressed in 1024ths of an inch.

Text Scaling

Alternatively or additionally to above solution, you can scale only text by factor not limited by whole numbers, for example:

$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.5

KDE Plasma

You can use Plasma's settings to fine tune font, icon, and widget scaling. This solution affects both Qt and GTK applications.

To adjust font, widget, and icon scaling together:

  1. System Settings > Display and Monitor > Display Configuration > Scale Display
  2. Drag the slider to the desired size
  3. Restart for the settings to take effect

To adjust only font scaling:

  1. System Settings > Fonts
  2. Check "Force fonts DPI" and adjust the DPI level to the desired value. This setting should take effect immediately for newly started applications. You will have to logout and login for it to take effect on Plasma desktop.

To adjust only icon scaling:

  1. System Settings > Icons > Advanced
  2. Choose the desired icon size for each category listed. This should take effect immediately.

Display Scale not integer bug

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: This doesn't seem to be necessary any more, only do it if you encounter this issue. (Discuss in Talk:HiDPI#)

When using not integer values for Display Scale it may causes font render issue in some Qt application. A workaround for this is to:

  1. Set the scale value to 1
  2. Adjust your font and icons and use the "Force fonts DPI" ( this affects all apps, also GTK but not create issue with the fonts )
  3. Restart Plasma
  4. If required tune the GTK apps using the variables GDK_SCALE/GDK_DPI_SCALE (as described above)

Tray icons with fixed size

The tray icons are not scaled with the rest of the desktop, since Plasma ignores the Qt scaling settings by default. To make Plasma respect the Qt settings, set PLASMA_USE_QT_SCALING to 1.

Xfce

Xfce uses the DPI given by the X server. There is an option to override Font DPI (Settings Manager > Appearance > Fonts > DPI > Custom DPI setting) but it's better to adjust X server DPI instead. See Xorg#Display size and DPI for how to fix it.

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.

Xfwm comes with two hidpi themes: Default-hdpi and Default-xhdpi. You can set them under Settings Manager > Window Manager > Style > Theme.

You can set the default icon sizes of gtk2 menus, buttons and so on under Settings Manager > Settings Editor > xsettings > Gtk > IconSizes, with a line like this: gtk-large-toolbar=96,96:gtk-small-toolbar=64,64:gtk-menu=64,64:gtk-dialog=96,96:gtk-button=64,64:gtk-dnd=64,64. "gtk-dnd" is for the icons during drag'n'drop, the others are quite self-explanatory. You can use any value your icon theme supports.

Cinnamon

Has good support out of the box.

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 DPI given by the X server. Examples are i3 (source) and Chromium (source).

To verify that the X Server has properly detected the physical dimensions of your monitor, use the xdpyinfo utility from the xorg-xdpyinfo package:

$ xdpyinfo | grep -B 2 resolution
screen #0:
  dimensions:    3200x1800 pixels (423x238 millimeters)
  resolution:    192x192 dots per inch

This example uses inaccurate dimensions (423mm x 328mm, even though the Dell XPS 9530 has 346mm x 194mm) to have a clean multiple of 96 dpi, in this case 192 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 KDE, Xfce, or other that manipulates the X settings for you, you can set the desired DPI setting manually via the Xft.dpi variable 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! Setting Xft.dpi at the same time as toolkit scale (e.g. GDK_SCALE) may cause interface elements to be much larger than intended in some programs like firefox.

GUI toolkits

Qt 5

Since Qt 5.6, Qt 5 applications can be instructed to honor screen DPI by setting the QT_AUTO_SCREEN_SCALE_FACTOR environment variable:

export QT_AUTO_SCREEN_SCALE_FACTOR=1

If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen (QT_SCREEN_SCALE_FACTORS) or globally (QT_SCALE_FACTOR). For more details see the Qt blog post or Qt developer documentation.

Note:
  • If you manually set the screen factor, it is important to set QT_AUTO_SCREEN_SCALE_FACTOR=0 otherwise some applications which explicitly force high DPI enabling get scaled twice.
  • QT_SCALE_FACTOR scales fonts, but QT_SCREEN_SCALE_FACTORS does not scale fonts.
  • If you also set the font DPI manually in xrdb to support other toolkits, QT_SCALE_FACTORS will give you huge fonts.
  • If you have multiple screens of differing DPI ie: #Side display you may need to do QT_SCREEN_SCALE_FACTORS="2;2"

An alternative is e.g.:

QT_FONT_DPI=96 vym

GDK 3 (GTK 3)

Note: As stated in the #X Resources section, if you have xft.dpi set to a larger dpi, it will make other scales larger than usual, including GDK.

Setting the GDK scale will scale the UI, however it will not scale icons. If you are using a minimal window manager where you are setting the dpi via Xft.dpi, GDK should scale perfectly fine with it. In other cases, do the following:

To scale UI elements by a factor of two:

export GDK_SCALE=2

To undo scaling of text:

export GDK_DPI_SCALE=0.5

GTK 2

Scaling of UI elements is not supported by the toolkit itself, however it's possible to generate a theme with elements pre-scaled for HiDPI display using oomox-gitAUR.

Elementary (EFL)

To scale UI elements by a factor of 1.5:

 export ELM_SCALE=1.5

For more details see https://phab.enlightenment.org/w/elementary/

Boot managers

GRUB

Lower the framebuffer resolution

Set a lower resolution for the framebuffer as explained in GRUB/Tips and tricks#Setting the framebuffer resolution.

Change GRUB font size

Find a ttf font that you like in /usr/share/fonts/.

Convert the font to a format that GRUB can utilize:

# grub-mkfont -s 30 -o /boot/grubfont.pf2 /usr/share/fonts/FontFamily/FontName.ttf
Note: Change the -s 30 parameter to modify the font size

Edit /etc/default/grub to set the new font as shown in GRUB/Tips and tricks#Background image and bitmap fonts:

GRUB_FONT="/boot/grubfont.pf2"

Update GRUB configuration by running grub-mkconfig -o /boot/grub/grub.cfg

systemd-boot

Adding the following line and running bootctl update increases font-size in the systemd-boot menu:

/boot/loader/loader.conf
console-mode 1

Applications

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: --force-device-scale-factor only works on Chromium based (including Electron) applications. (Discuss in Talk:HiDPI#)

As a general rule, applications can be launched with a custom scaling value, e.g. $ atom --force-device-scale-factor=2. A more permanent solution is to add this scaling factor as a flag to the relevant .conf or .desktop file (normally located at /usr/share/applications/). In the latter instance, the flag should be added to the line beginning with "Exec=", e.g. Exec=/usr/bin/atom --force-device-scale-factor=2 %F. The next section provides more details on implementing this for specific applications.

Atom

Add --force-device-scale-factor=2 as a flag to the atom.desktop file:

/usr/share/applications/atom.desktop
Exec=/usr/bin/atom --force-device-scale-factor=2 %F

Browsers

Firefox

Firefox should use the #GDK 3 (GTK 3) settings. However, the suggested GDK_SCALE suggestion does not consistently scale the entirety of Firefox, and does not work for fractional values (e.g., a factor of 158DPI/96DPI = 1.65 for a 1080p 14" laptop). You may want to use GDK_DPI_SCALE instead. Another option, which will avoid Firefox-specific settings in many setups is to use the settings in #X Resources as Firefox should respect the Xft.dpi value defined there.

To override those, 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), but it also does not consistently scale the entirety of Firefox. If Firefox is not scaling fonts, you may want to create userChrome.css and add appropriate styles to it. More information about userChrome.css at mozillaZine.

~/.mozilla/firefox/<profile>/chrome/userChrome.css
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */
* {
    font-size: 15px !important;
}

/* exception for badge on adblocker */
.toolbarbutton-badge {
    font-size: 8px !important;
}
Warning: The following extension is not compatible with Firefox Quantum (version 57 and above).

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. Also, since Firefox version 49, it auto-scales based on your screen resolution, making it easier to deal with 2 or more screens.

If you use Wayland, see Firefox#Wayland for instructions to enable the optional Wayland backend on firefox. This is also appicable to thunderbird.

You can also use the Wayland-enabled packages of Firefox from the AUR: firefox-waylandAUR (compiles from source) or fedora-firefox-wayland-binAUR (binary from Fedora). You might experience some minor visual glitches with these packages.

Chromium / Google Chrome

Chromium should use the #GDK 3 (GTK 3) settings.

To override those, use the --force-device-scale-factor flag with a scaling value. This will scale all content and ui, including tab and font size. For example chromium --force-device-scale-factor=2.

Using this option, a scaling factor of 1 would be normal scaling. Floating point values can be used. To make the change permanent, for Chromium, you can add it to ~/.config/chromium-flags.conf:

~/.config/chromium-flags.conf
--force-device-scale-factor=2

To make this work for Chrome, add the same option to ~/.config/chrome-flags.conf instead.

If you use a HiDPI monitor such as Retina display together with another monitor, you can use the reszoom extension in order to automatically adjust the zoom level for the active screen.

Opera

Opera should use the #GDK 3 (GTK 3) settings.

To override those, use 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.)

Gimp 2.8

Use a high DPI theme, or adjust gtkrc of an existing theme. (Change all occurrences of the size button to dialog, for example GimpToolPalette::tool-icon-size.)

There is also the gimp-hidpi.

Inkscape

To scale the icons to a "usable" size go to Preferences > Interface and set the icon size to Large or Larger[1][2].

IntelliJ IDEA

IntelliJ IDEA 15 and above should include HiDPI support.[3] If it does not work, the most convenient way to fix the problem in this case seems to be changing the Override Default Fonts setting:

File > Settings > Behaviour & Appearance > Appearance

The addition of -Dhidpi=true to the vmoptions file in either $HOME/.IdeaC14/ or /usr/share/intelligj-idea-ultimate-edition/bin/ of release 14 should not be required anymore.

Java applications

Java applications using the AWT/Swing framework can be scaled by defining the sun.java2d.uiScale variable when invoking java. For example,

java -Dsun.java2d.uiScale=2 -jar some_application.jar

Since Java 9 the GDK_SCALE environment variable is used to scale Swing applications accordingly.

MATLAB

Recent versions (R2017b) of MATLAB allow to set the scale factor[4]:

>> s = settings;s.matlab.desktop.DisplayScaleFactor
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2

The settings take effect after MATLAB is restarted.

Mono applications

According to [5], Mono applications should be scalable like GTK 3 applications.

NetBeans

NetBeans allows the font size of its interface to be controlled using the --fontsize parameter during startup. To make this change permanent edit the /usr/share/netbeans/etc/netbeans.conf file and append the --fontsize parameter to the netbeans_default_options property.[6]

The editor fontsize can be controlled from Tools > Option > Fonts & Colors.

The output window fontsize can be controlled from Tools > Options > Miscelaneous > Output

Skype

Skype for Linux (skypeforlinux-stable-binAUR package) uses #GDK 3 (GTK 3).

Slack

Slack (slack-desktopAUR), like all Electron apps, can be configured to use a custom scaling value by adding a --force-device-scale-factor flag to the .desktop file. This is normally located at /usr/share/applications/. The flag should be added to the line beginning with "Exec=". For example:

/usr/share/applications/slack.desktop
Exec=env LD_PRELOAD=/usr/lib/libcurl.so.3 /usr/bin/slack --force-device-scale-factor=1.5 %U

Spotify

You can change scale factor by simple Ctrl++ for zoom in, Ctrl+- for zoom out and Ctrl+0 for default scale. Scaling setting will be saved in ~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs, you may have to create this file by yourself:

~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs
app.browser.zoom-level=100

Also Spotify can be launched with a custom scaling factor which will be multiplied with setting specified in ~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs, for example

$ spotify --force-device-scale-factor=1.5

Steam

Official HiDPI support

  • Starting on 25 of January 2018 in the beta program there is actual support for HiDPI and it should be automatically detected.
  • Steam > Settings > Interface, check "Enlarge text and icons based on monitor size" (restart required)
  • If it not automatically detected use GDK_SCALE=2 to set the desired scale factor.

Unofficial

The HiDPI-Steam-Skin can be installed to increase the font size of the interface. While not perfect, it does improve usability.

Note: The README for the HiDPI skin lists several possible locations for where to place the skin. The correct folder out of these can be identified by the presence of a file named skins_readme.txt.

MetroSkin Unofficial Patch also helps with HiDPI on Steam with Linux.

Sublime Text 3

Sublime Text 3 has full support for display scaling. Go to Preferences > Settings > User Settings and add "ui_scale": 2.0 to your settings.

Thunderbird

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

VirtualBox

Note: This only applies to KDE with scaling enabled.

VirtualBox also applies the system-wide scaling to the virtual monitor, which reduces the maximum resolution inside VMs by your scaling factor (see [7]).

This can be worked around by calculating the inverse of your scaling factor and manually setting this new scaling factor for the VirtualBox execution, e.g.

$ QT_SCALE_FACTOR=0.5 VirtualBox --startvm vm-name

Wine applications

Run

$ winecfg

and change the "dpi" setting found in the "Graphics" tab. This only affects the font size.

Zathura document viewer

No modifications required for document viewing.

UI text scaling is specified via configuration file (note that "font" is a girara option):

set font "monospace normal 20"

Zoom

Zoom can be started with a proper scaling by overriding the QT_SCALE_FACTOR environment variable.

$ QT_SCALE_FACTOR=2 zoom

Unsupported applications

run_scaled-gitAUR can be used to scale applications (which uses xpra internally).

Another approach is to run the application full screen and without decoration in its own VNC desktop. Then scale the viewer. With Vncdesk (vncdesk-gitAUR from the AUR) you can set up a desktop per application, then start server and client with a simple command such as vncdesk 2.

x11vnc has an experimental option -appshare, which opens one viewer per application window. Perhaps something could be hacked up with that.

Multiple displays

The HiDPI setting applies to the whole desktop, so non-HiDPI external displays show everything too large. However, note that setting different scaling factors for different monitors is already supported in Wayland.

Side display

One workaround is to use xrandr's scale option. To have a non-HiDPI monitor (on DP1) right of an internal HiDPI display (eDP1), one could run:

$ xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1

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.

You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.

Note: Above solution with --scale 2x2 does not work on some Nvidia cards. No solution is currently available. [8] A potential workaround exists with configuring ForceFullCompositionPipeline=On on the CurrentMetaMode via nvidia-settings. For more info see [9].
Note: If you are using the modesetting driver you will get mouse flickering. This can be solved by scaling your non-scaled screen by 0.9999x0.9999.

Multiple external monitors

There might be some problems in scaling more than one external monitors which have lower dpi than the built-in HiDPI display. In that case, you may want to try downscaling the HiDPI display instead, with e.g.

$ xrandr --output eDP1 --scale 0.5x0.5 --output DP2 --right-of eDP1 --output HDMI1 --right-of DP2

In addition, when you downscale the HiDPI display, the font on the HiDPI display will be slightly blurry, but it's a different kind of bluriness compared with the one introduced by upscaling the external displays. You may compare and see which kind of bluriness is less problematic for you.

Mirroring

If all you want is to mirror ("unify") displays, this is easy as well:

With AxB your native HiDPI resolution (for ex 3200x1800) and CxD your external screen resolution (e.g. 1920x1200)

$ xrandr --output HDMI --scale [A/C]x[B/D]

In this example which is QHD (3200/1920 = 1.66 and 1800/1200 = 1.5)

$ xrandr --output HDMI --scale 1.66x1.5

For UHD to 1080p (3840/1920=2 2160/1080=2)

$ xrandr --output HDMI --scale 2x2

You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.

Tools

There are several tools which automate the commands described above.

Linux console

The default Linux console font will be very small on HiDPI displays, the largest font present in the kbd package is latarcyrheb-sun32 and other packages like terminus-font contain further alternatives, such as ter-132n(normal) and ter-132b(bold). See Linux console#Fonts for configuration details. Also see Linux console#Persistent configuration in particular for applying the font setting during the early userspace boot sequence.

After changing the font, it is often garbled and unreadable when changing to other virtual consoles (tty2-6). To fix this you can force specific mode for KMS, such as video=2560x1600@60 (substitute in the native resolution of your HiDPI display), and reboot.

See also