HiDPI: Difference between revisions

From ArchWiki
m (→‎Firefox: extension no more works)
m (remove reference to merge request, because it is now merged)
 
(339 intermediate revisions by more than 100 users not shown)
Line 1: Line 1:
[[Category:Graphics]]
[[Category:Graphics]]
[[ja:HiDPI]]
[[ja:HiDPI]]
[[ru:HiDPI]]
[[zh-hans:HiDPI]]
{{Related articles start}}
{{Related articles start}}
{{Related|Font configuration}}
{{Related|Font configuration}}
{{Related articles end}}
{{Related articles end}}
HiDPI (High Dots Per Inch) displays, also known by Apple's "[[wikipedia:Retina Display|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.
HiDPI (High Dots Per Inch) displays, also known by Apple's "[[wikipedia:Retina Display|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.


Line 11: Line 14:


=== GNOME ===
=== GNOME ===
To enable HiDPI, Settings > Devices > Displays,or use gsettings:


To enable HiDPI, navigate to ''Settings > Devices > Displays > Scale'' and choose an appropriate value. Or, 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={{ic|scaling-factor}} only allows whole numbers to be set. 1 = 100%, 2 = 200%, etc...}}
{{Note|1=By default, GNOME only allows integer scaling numbers to be set. 1 = 100%, 2 = 200%, etc. See [[#Fractional scaling]] below.}}
 
==== 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). Fractional scaling is possible on both Wayland and Xorg, though the process differs.
 
Implementation was mainly discussed and decided in GNOME fractional scaling hackfest 2017, check [https://hackmd.io/WspOFZpRTo2qlWc8fh_zPQ] for more technical details.
 
{{Note|{{Accuracy|The information below is subject to change. For more, please see [https://www.reddit.com/r/gnome/comments/11ekj8o/comment/jah8i0b/ this online discussion].}}
 
Currently, GTK only supports fractional scaling for fonts. On the other hand, widgets, like buttons or labels, [https://discourse.gnome.org/t/fractional-scale-factor-in-gtk-again/10803 may only use integer (DPI) scaling].  As such, fractional scaling for most native GNOME applications requires first rendering at a higher resolution, then downscaling to the requested resolution. GTK utilizes this technique in both Wayland and Xorg sessions.


==== Fractional Scaling ====
For some setups [https://www.gtk.org/docs/architecture/index running GTK 3 applications], this can increase CPU and GPU usage and power usage, resulting in a less responsive experience - particularly in Xorg. If these issues are considerable in your use case, please consider using another desktop environment or deactivating 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). 
===== Wayland =====


*wayland
Enable the experimental fractional scaling feature:
Enable fractional Scaling experimental-feature:


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


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


*xorg
To enable the option for all users, create the following three files with the corresponding content


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]].
{{hc|/etc/dconf/profile/user|<nowiki>
user-db:user
system-db:local
</nowiki>}}
 
{{hc|/etc/dconf/db/local.d/00-hidpi|<nowiki>
[org/gnome/mutter]
experimental-features=['scale-monitor-framebuffer']
</nowiki>}}
 
{{hc|/etc/dconf/db/locks/hidpi|<nowiki>
/org/gnome/mutter/experimental-features
</nowiki>}}
 
Then run {{ic|dconf update}} and restart the machine. This will permanently lock the option.
 
====== XWayland ======
 
The feature of supporting clients with native scaling without scaling the Xwayland resolution to avoid Xwayland blurring (Similar to KDE Plasma  "Apply scaling themselves"  [[#Xwayland_2|Xwayland scale method]]) has already been listed on the mutter's [https://gitlab.gnome.org/GNOME/mutter/-/issues/478 Fractional Scaling Known issues and TODO List]. See also the [https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733 pull request] for upstream Xwayland.
 
===== Xorg =====
 
Ubuntu has provided a patch[https://salsa.debian.org/gnome-team/mutter/-/blob/ubuntu/master/debian/patches/ubuntu/x11-Add-support-for-fractional-scaling-using-Randr.patch] to scale with Randr in GNOME Settings. This patch is already provided by {{AUR|mutter-x11-scaling}}. After installing it, you can set:
 
$ gsettings set org.gnome.mutter experimental-features "['x11-randr-fractional-scaling']"
 
Then open ''Settings > Devices > Displays'' to set the scale.
 
You can also manually 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]].


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.
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.
  $ xrandr --output eDP1 --scale 1.25x1.25
  $ xrandr --output eDP1 --scale 1.25x1.25


{{Note|To allow the mouse to reach the whole screen, you may need to use the {{ic|--panning}} option as explained in [[#Side display]].}}
To ensure that the settings persist across reboots, you may choose to use {{Pkg|autorandr}}. Refer to [https://askubuntu.com/a/1130337 this StackOverflow] for more information.


{{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}}
{{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}}


GNOME ignores X settings due to its xsettings Plugin in Gnome Settings Daemon, where DPI setting is hard coded.
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].
There is blog entry for [http://blog.drtebi.com/2012/12/changing-dpi-setting-on-gnome-34.html recompiling Gnome Settings Daemon]{{Dead link|2022|09|18|status=domain name not resolved}}.
In the source documentation there is another way mentioned to set X settings DPI:
In the source documentation there is another way mentioned to set X settings DPI:


You can use the dconf Editor and navigate to key
You can use the gsettings, just make sure to read previous setting first and merge it. In just simply set it with this command:
 
/org/gnome/settings-daemon/plugins/xsettings/overrides
 
and complement the entry with the value


  'Xft/DPI': <153600>
  $ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Xft/DPI': <153600>}"


From README.xsettings
From README.xsettings
Line 57: Line 96:
Note also that DPI in the above example is expressed in 1024ths of an inch.
Note also that DPI in the above example is expressed in 1024ths of an inch.


=== KDE ===
==== Text Scaling ====
 
Alternatively, or in addition to changing the display scaling, you can separately scale text. This can be done by navigating to ''Fonts > Scaling Factor'' in Gnome Tweaks, or using gsettings. Note that the text scaling factor need not be limited to whole integers, for example:
 
$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.5


You can use KDE's settings to fine tune font, icon, and widget scaling. This solution affects both Qt and Gtk+ applications.
===== GTK+ vs Gnome Shell elements on Xorg =====
 
{{Out of date|Needs a partial rewrite regarding the Gnome Shell Toolkit, since it looks unmaintained since [https://gitlab.gnome.org/GNOME/gnome-shell/-/tree/shell-toolkit 2009].}}
 
Adjusting the text scaling as per the above only affects GTK+ elements of the GNOME desktop. This should cover everything on Wayland. However, those on an Xorg session may find that they need to make further adjustments on HiDPI environments, since the GNOME Shell UI (including the top bar, dock, application menus, etc.) relies separately on the [https://developer.gnome.org/st/stable/ St]{{Dead link|2021|11|11|status=404}} toolkit. Note that this is a long-standing issue to which a [https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/486 patch] has been merged and available for Gnome Shell 3.35 onward. For older releases, Xorg users can resolve most of the Gnome shell scaling problems by manually editing the shell theme that they are currently using. The relevant CSS files are normally located at {{ic|/usr/share/themes/YOUR-THEME/gnome-shell/gnome-shell.css}}. Users should increase all "font-size" elements in this file in proportion to their display scaling (doubling font sizes for 200% scaling, etc.) For example, the top of an edited CSS file for the [https://github.com/adapta-project/adapta-gtk-theme Adapta] shell theme might look like:
 
{{hc|usr/share/themes/Adapta/gnome-shell/gnome-shell.css|2=
stage { font-size: 20pt; font-family: Roboto, Noto Sans, Sans-Serif; color: #263238; }
}}
 
Once these changes have been saved, activate them by switching to another theme (for example, using {{pkg|gnome-tweaks}}) and then reverting back again. The top bar, application menus, calendar, and other shell elements should now be correctly scaled.
 
In addition to editing the relevant shell theme's CSS file, users on Xorg may also wish to increase the title bar font at the top of open applications. This can be done through the dconf editor ({{ic|org > gnome > desktop > wm > preferences :: titlebar-font}}). Note that the {{ic|title-bar-uses-system-fonts}} option should also be turned off. Alternatively, use gsettings:
 
$ gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Cantarell Bold 22' ## Change as needed
$ gsettings set org.gnome.desktop.wm.preferences titlebar-uses-system-font false
 
=== KDE Plasma ===
 
You can use Plasma's settings to fine tune font, icon, and widget scaling. This solution affects both Qt and GTK applications.
 
{{Note|Plasma 5.27 [https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2544 dropped] use of {{ic|GDK_SCALE}}/{{ic|GDK_DPI_SCALE}} variables and [https://invent.kde.org/plasma/kde-gtk-config/-/merge_requests/49 switched] to [[Xsettingsd]]. It should be installed to make scaling work for GTK apps. Or you can set this variables manually as described in [[#GDK 3 (GTK 3)]].}}


To adjust font, widget, and icon scaling together:
To adjust font, widget, and icon scaling together:


# System Settings →  Display and Monitor Display Configuration →  Scale Display
# ''System Settings > Display and Monitor > Display Configuration > Global Scale''
# Drag the slider to the desired size
# Drag the slider to the desired size
# Restart for the settings to take effect
# Restart for the settings to take effect
{{Note|If you are using xorg, and global scaling is set but not applied to Qt applications after reboot, please check if {{ic|xft.dpi}} is set in {{ic|~/.Xresources}} . If so, removing the variable and adjusting global scaling again may take effect.}}
However, using [[X11]] session, Plasma ignores the Qt scaling settings by default, which affects panels and other desktop elements. To make Plasma respect the Qt settings, [[Environment variables|set]] {{ic|1=PLASMA_USE_QT_SCALING=1}}.
==== Cursor size ====
To adjust cursor size:
# ''System Settings > Appearance > Cursors > Size''
==== Font scaling ====


To adjust only font scaling:
To adjust only font scaling:


# System Settings →  Fonts
# ''System Settings > Appearance > 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.
# 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.
==== Icon scaling ====


To adjust only icon scaling:
To adjust only icon scaling:


# System Settings →  Icons Advanced
# ''System Settings > Appearance > Icons > Advanced''
# Choose the desired icon size for each category listed. This should take effect immediately.
# Choose the desired icon size for each category listed. This should take effect immediately.


'''Display Scale not integer bug :'''
==== Panel scaling ====
 
When you use not integer values for Display Scale it causes font render issue in some QT application ( ex. okular ).
To adjust only panel scaling:
 
# Right click the panel, select ''Enter Edit Mode'', and manually adjust ''Panel height''.
 
==== Xwayland ====
 
As of Plasma 5.26, the Xwayland scale method can be chosen at the bottom of the ''System Settings > Display and Monitor > Display Configuration'' page.


A workaround for this is to:
In "Scaled by the system" mode, the X application will be rendered at 1x and then magnified (scaled) by KDE. This works for all applications, but causes blurriness due to the magnification.
# Set the scale value to 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 KDE
# If required tune the GTK apps using the variables GDK_SCALE/GDK_DPI_SCALE  (as described above)


==== Tray icons with fixed size ====
In "Apply scaling themselves" mode, the X application will have to render itself at the appropriate size. This will avoid blurriness, but applications which aren't HiDPI-aware will render themselves at 1x scale and therefore will appear small.


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}}.
See this [https://pointieststick.com/2022/06/17/this-week-in-kde-non-blurry-xwayland-apps/ blog post] for details.


=== 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 {{ic|<nowiki>xdpyinfo | grep resolution</nowiki>}}, and then double it.
Xfce supports HiDPI scaling which can be enabled using the settings manager:
 
# Go to ''Settings Manager > Appearance > Settings > Window Scaling'' and select 2 as the scaling factor.
# Go to ''Settings Manager > Window Manager > Style'' and select {{ic|Default-xhdpi}} theme.
 
Alternatively, it is possible to do the same from command line using ''xfconf-query'':
 
$ xfconf-query -c xsettings -p /Gdk/WindowScalingFactor -s 2
$ xfconf-query -c xfwm4 -p /general/theme -s Default-xhdpi
 
After either of the above changes, fonts in some GTK applications may still not be scaled; you may additionally do the following (see [[#GDK 3 (GTK 3)]]):
 
# Go to ''Settings Manager > Appearance > Fonts > Custom DPI setting'' and change from 96 to 192
# Set the [[environment variable]] {{ic|1=GDK_DPI_SCALE=0.5}} to un-scale some fonts that would be scaled twice.
 
The steps above would set 2x scaled resolution for Xfce and other GTK 3 applications.


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.
Scaling for Qt 5 applications should be set manually, see [[#Qt 5]]. Note that if you set a Custom DPI for fonts above, you likely need to set {{ic|1=QT_FONT_DPI=96}} to avoid double-scaling of fonts in Qt applications.


=== Cinnamon ===
=== Cinnamon ===
Line 103: Line 198:
=== 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 MacBook Pro 15" screen.
 
== X Server ==
 
Some programs use the DPI given by the X server. Examples are i3 ([https://github.com/i3/i3/blob/next/libi3/dpi.c source]) and Chromium ([https://code.google.com/p/chromium/codesearch#chromium/src/ui/views/widget/desktop_aura/desktop_screen_x11.cc source]).
 
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
== Window managers ==
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.
=== Sway ===


If the DPI displayed by xdpyinfo is not correct, see [[Xorg#Display size and DPI]] for how to fix it.
See [[Sway#HiDPI]].


== X Resources ==
== X Resources ==
Line 124: Line 210:
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]]:
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: 192
 
! These might also be useful depending on your monitor and personal preference:
Xft.autohint: 0
Xft.autohint: 0
Xft.lcdfilter:  lcddefault
Xft.lcdfilter:  lcddefault
Line 132: Line 220:
Xft.antialias: 1
Xft.antialias: 1
Xft.rgba: rgb
Xft.rgba: rgb
</nowiki>}}
}}
 
For {{ic|Xft.dpi}}, using integer multiples of 96 usually works best, e.g. 192 for 200% scaling.


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 138: Line 228:
This will make the font render properly in most toolkits and applications, it will however not affect things such as icon size!
This will make the font render properly in most toolkits and applications, it will however not affect things such as icon size!
Setting {{ic|Xft.dpi}} at the same time as toolkit scale (e.g. {{ic|GDK_SCALE}}) may cause interface elements to be much larger than intended in some programs like firefox.
Setting {{ic|Xft.dpi}} at the same time as toolkit scale (e.g. {{ic|GDK_SCALE}}) may cause interface elements to be much larger than intended in some programs like firefox.
== X Server ==
{{Accuracy|{{Pkg|libxft}} is a ''font rendering interface library'', the {{ic|Xft.dpi}} setting was not intended to be abused by other applications. On the other hand, the {{ic|xorg.conf}} value should affect everything.}}
Some programs may still interpret the DPI given by the X server (most interpret X Resources, though, directly or indirectly). Older versions of i3 (before 2017) and Chromium (before 2017) used to do this.
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:
{{hc|$ xdpyinfo {{!}} grep -B 2 resolution|
screen #0:
  dimensions:    3200x1800 pixels (423x238 millimeters)
  resolution:    192x192 dots per inch
}}
This example uses inaccurate dimensions (423mm x 238mm, 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.


== GUI toolkits ==
== GUI toolkits ==
Line 143: Line 251:
=== 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:
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]]. Qt 5.14 introduced a new environment variable {{ic|QT_ENABLE_HIGHDPI_SCALING}} which [https://doc.qt.io/qt-5/highdpi.html#high-dpi-support-in-qt replaces] the {{ic|QT_AUTO_SCREEN_SCALE_FACTOR}} variable. It is recommended to set both [[environment variable]]s for maximum compatibility:


  export QT_AUTO_SCREEN_SCALE_FACTOR=1
  $ export QT_AUTO_SCREEN_SCALE_FACTOR=1
$ export QT_ENABLE_HIGHDPI_SCALING=1


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].
If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen ({{ic|QT_SCREEN_SCALE_FACTORS}}/{{ic|QT_ENABLE_HIGHDPI_SCALING}}) 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].


{{Note|
{{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.
* If you manually set the screen factor, it is important to set {{ic|1=QT_AUTO_SCREEN_SCALE_FACTOR=0}} and {{ic|1=QT_ENABLE_HIGHDPI_SCALING=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.
* {{ic|QT_SCALE_FACTOR}} scales fonts, but {{ic|QT_SCREEN_SCALE_FACTORS}} may not scale fonts, depending on the application.
* 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 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: [[HiDPI#Side_display]] you may need to do {{ic|1=QT_SCREEN_SCALE_FACTORS="2;2"}}
* If you have multiple screens of differing DPI ie: [[#Side display]] you may need to do {{ic|1=QT_SCREEN_SCALE_FACTORS="2;2"}}
}}
}}


=== GDK 3 (GTK+ 3) ===
An [https://bugreports.qt.io/browse/QTBUG-53022 alternative] is e.g.:
 
$ QT_FONT_DPI=96 clementine
 
=== 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 (in X11, not Wayland) 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, [https://docs.gtk.org/gtk3/x11.html do the following]:
 
To scale UI elements by an integer only factor:
 
$ export GDK_SCALE=2
 
GTK3/4 does not support fractional scaling currently, so fractional factors will be ignored. This environment variable is also ignored in mutter wayland sessions.
 
{{ic|GDK_DPI_SCALE}} can be used to scale text only. To undo scaling of text, fractional scale can be used:
 
$ export GDK_DPI_SCALE=0.5


To scale UI elements by a factor of two:
Under GTK3/4 it not currently possible to scale icon sizes, unless the application explicitly implements a way to do so. See bug report [https://gitlab.gnome.org/GNOME/gtk/-/issues/4528 #4528]. If you need this feature, use Qt when possible.


export GDK_SCALE=2
=== GTK 2 ===


To undo scaling of text:
Scaling of UI elements is not supported by the toolkit itself, however it is possible to generate a theme with elements pre-scaled for HiDPI display using {{AUR|themix-full-git}}.


export GDK_DPI_SCALE=0.5
=== Electron ===


=== GTK+ 2 ===
[https://electronjs.org/ Electron] applications (e.g. {{AUR|slack-desktop}}, {{pkg|signal-desktop}}, etc.) 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/}}, and can normally be overridden on a per-user basis by copying it to {{ic|~/.local/share/applications/}}. The flag should be added to the line beginning with "Exec=". For example:


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}}.
{{hc|~/.local/share/applications/slack.desktop|2=
Exec=env LD_PRELOAD=/usr/lib/libcurl.so.3 /usr/bin/slack --force-device-scale-factor=1.5 %U
}}


=== Elementary (EFL) ===
=== Elementary (EFL) ===
Line 174: Line 303:
To scale UI elements by a factor of 1.5:
To scale UI elements by a factor of 1.5:


  export ELM_SCALE=1.5
export ELM_SCALE=1.5


For more details see https://phab.enlightenment.org/w/elementary/
For more details see https://phab.enlightenment.org/w/elementary/{{Dead link|2023|04|23|status=404}}
 
=== GNUstep ===
 
GNUstep applications that use its gui (AppKit) library accept a {{ic|GSScaleFactor}} property in their defaults (STEP preferences). To define a scaling factor of 1.5 for all applications:
 
defaults write NSGlobalDomain GSScaleFactor 1.5
 
Note that you must also disable font hinting by setting the value of {{ic|GSFontHinting}} to 17, else text rendering will look broken when rendering long lines.
 
defaults write NSGlobalDomain GSFontHinting 17
 
Some automatic detection was possible back in 2011, but the code responsible for the X11 backend was [https://github.com/gnustep/libs-back/commit/337ce46bba304732d9a7c7495a3dd245a3219660 commented out] thereafter.
 
=== FLTK ===
 
FLTK 1.3, the default FLTK version available in Arch Linux, does not support resolution scaling. Support will arrive when applications start using FLTK 1.4.


== Boot managers ==
== Boot managers ==
Line 183: Line 328:


==== Lower the framebuffer resolution ====
==== Lower the framebuffer resolution ====
Set a lower resolution for the framebuffer as explained in [[GRUB/Tips and tricks#Setting 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 ====
==== Change GRUB font size ====
Find a ttf font that you like in {{ic|/usr/share/fonts/}}.
Find a ttf font that you like in {{ic|/usr/share/fonts/}}.


Line 198: Line 345:
  GRUB_FONT="/boot/grubfont.pf2"
  GRUB_FONT="/boot/grubfont.pf2"


Update GRUB configuration by running {{ic|grub-mkconfig -o /boot/grub/grub.cfg}}
{{Note|{{ic|GRUB_THEME}} overrides {{ic|GRUB_FONT}} if it is used.}}
 
Finally [[GRUB#Generate the main configuration file|regenerate the main configuration file]].
 
{{Tip|The font size can also be changed with the GUI tool {{Pkg|grub-customizer}}.}}
 
=== systemd-boot ===
 
Set a lower resolution for the console through {{ic|console-mode}} as explained in [[systemd-boot#Loader configuration]] and {{man|5|loader.conf|OPTIONS}}.


== Applications ==
== Applications ==
If you are running a Wayland session, but application is running via Xwayland (either because it does not support Wayland natively or because it uses X11 by default), you could still get blurry fonts and interface, even if the application supports HiDPI. See [https://bugs.kde.org/show_bug.cgi?id=389191 this bug report]. See also [[Wayland#Detect Xwayland applications visually]].


=== Browsers ===
=== Browsers ===
Line 206: Line 363:
==== Firefox ====
==== Firefox ====


Firefox should use the [[#GDK 3 (GTK+ 3)]] settings. However, the suggested {{ic|GDK_SCALE}} suggestion doesn't consistently scale the entirety of Firefox, and doesn't 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.
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 doesn't 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].
To override those, open Firefox advanced preferences page ({{ic|about:config}}) and add and set parameter {{ic|ui.textScaleFactor}} to {{ic|150}} (or find the one that suits you better; {{ic|150}} is a good choice for Retina screens). You will likely also need to edit the zoom level in general preferences to e.g. 120%. This does not consistently scale the entirety of Firefox: edit {{ic|layout.css.devPixelsPerPx}} for that, but as of Firefox 103 it may not work as expected.


{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
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]. Starting from Firefox 69 the {{ic|userChrome.css}} and {{ic|userContent.css}} files are not loaded by default unless preference is set by the user. Open Firefox advanced preferences page ({{ic|about:config}}) and set parameter {{ic|toolkit.legacyUserProfileCustomizations.stylesheets}} to {{ic|True}}, then restart Firefox to apply the changes.
 
{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|<nowiki>
@namespace url("https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");


/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */
/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */
Line 221: Line 381:
     font-size: 8px !important;
     font-size: 8px !important;
}
}
}}
</nowiki>}}


{{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 the [https://addons.mozilla.org/firefox/addon/ffreszoom/ ffreszoom] add-on, which will adjust the page zoom if it detects you are using a large monitor (zoom level and threshold are configurable). Modifying the internal CSS DPI setting from an extension is currently unsupported [https://bugzilla.mozilla.org/show_bug.cgi?id=1373607].


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 Wayland, see [[Firefox#Wayland]] for instructions to enable the optional Wayland backend on {{pkg|firefox}}. This is also appicable to {{pkg|thunderbird}}.


==== Chromium / Google Chrome ====
==== Chromium / Google Chrome ====


Chromium should use the [[#GDK 3 (GTK+ 3)]] settings.
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}}.
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}}.
Line 235: Line 395:
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}}:
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}}:


{{hc|~/.config/chromium-flags.conf|2=--force-device-scale-factor=2}}
{{hc|~/.config/chromium-flags.conf|2=
--force-device-scale-factor=2
}}


To make this work for Chrome, add the same option to {{ic|~/.config/chrome-flags.conf}} instead.
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.
If using Wayland session, you should [[Chromium#Native Wayland support|enable]] native wayland support to avoid blurriness. See also [[Chromium#Incorrect HiDPI rendering]].


==== Opera ====
==== Opera ====


Opera should use the [[#GDK 3 (GTK+ 3)]] settings.
Opera should use the [[#GDK 3 (GTK 3)]] settings.
 
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 144.  Newer versions of opera will auto detect the DPI using the font DPI setting (in KDE: the force font DPI setting.)
 
=== Gimp 2.10 ===
 
To fix toolbar icon sizes, update ''Preferences > Interface > Icon Theme > Custom icon size'' to {{ic|1=huge}} or other value.
 
If menu fonts are still too small you can update an existing theme by copying it from {{ic|/usr/share/gimp/2.0/themes/}} into {{ic|~/.config/GIMP/2.10/themes/}} and changing {{ic|gtk-font-name}} and {{ic|font_name}} in {{ic|gtkrc}} into something bigger like {{ic|1=Sans 30}}. Then select the new theme from ''Preferences > Interface > Theme''. When copying make sure to rename the new directory into something different from the original name (example ''Dark > DarkHighDPI'').
 
You can also try using [https://github.com/jedireza/gimp-hidpi gimp-hidpi] (installation instructions are outdated and refer to version 2.8, in Gimp 2.10 the theme should be installed into {{ic|~/.config/GIMP/2.10/themes/}})
 
On the latest versions of {{AUR|gimp-devel}}, Wayland and HiDPI are both fully supported. Icons and text can be scaled from ''Preferences > Interface > Icon Theme''/''Display'' respectively.
 
=== Inkscape ===
 
To scale the icons to a "usable" size go to ''Preferences > Interface'' and set the icon size to Large or Larger[https://web.archive.org/web/20171118050743/http://www.inkscapeforum.com/viewtopic.php?t=18684][https://wiki.inkscape.org/wiki/index.php/HiDPI].
 
=== Java applications ===
 
==== AWT/Swing ====
 
Java applications using the ''AWT/Swing'' framework can be scaled by defining the {{ic|sun.java2d.uiScale}} VM property when invoking {{ic|java}}. The value can be an integer percentage value, or a float value. For example,
 
java -Dsun.java2d.uiScale=2 -jar ''some_swing_application''.jar
java -Dsun.java2d.uiScale=300% -jar ''some_swing_application''.jar
 
Since Java 9 the {{ic|GDK_SCALE}} environment variable is used to scale Swing applications accordingly.
 
Note that at this point, Java ''AWT/Swing'' (up to including OpenJDK 13) only effectively supports integer values. A setting of {{ic|1=-Dsun.java2d.uiScale=250%}} or {{ic|1=GDK_SCALE=2.5}} will be treated as if it were set to {{ic|1=-Dsun.java2d.uiScale=2}} resp. {{ic|1=GDK_SCALE=2}}.
 
==== JavaFX ====
 
Java applications using ''JavaFX'' can be scaled by defining the {{ic|glass.gtk.uiScale}} VM property when invoking {{ic|java}}. The value can be an integer percentage value, an integer DPI value (where {{ic|96dpi}} represents a scale factor of {{ic|100%}}, and for example {{ic|192dpi}} represents a scale factor of {{ic|200%}}), or a float value. For example,
 
java -Dglass.gtk.uiScale=200% -jar ''some_jfx_application''.jar
java -Dglass.gtk.uiScale=192dpi -jar ''some_jfx_application''.jar
java -Dglass.gtk.uiScale=2.0 -jar ''some_jfx_application''.jar


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 144.  Newer versions of opera will auto detect the DPI using the font DPI setting (in KDE: the force font DPI setting.)
''JavaFX'' perfectly well supports fractions. Using values like {{ic|1=-Dglass.gtk.uiScale=250%}} or {{ic|1=-Dglass.gtk.uiScale=2.5}} will deliver the expected result.


=== Thunderbird ===
==== Mixed AWT/Swing and JavaFX ====
 
Some Java applications mix ''JavaFX'' and ''AWT/Swing'' (via {{ic|javafx.embed.swing.JFXPanel}}). In that case, the settings for ''AWT/Swing'' will also affect ''JavaFX'', and setting {{ic|-Dglass.gtk.uiScale}} will have no effect.
 
==== JetBrains IDEs ====
 
JetBrains products (IntelliJ IDEA and other IDEs) support two HiDPI modes (JRE-managed and IDE-managed). The sequence for determining system scale factor is well documented at [https://intellij-support.jetbrains.com/hc/en-us/articles/360007994999-HiDPI-configuration]:
 
# Java property – {{ic|-Dsun.java2d.uiScale}}
# {{man|1|gsettings}} – {{ic|ubuntu.user-interface/scale-factor}} or {{ic|org.gnome.desktop.interface/scaling-factor}}
# {{ic|GDK_SCALE}} and {{ic|GDK_DPI_SCALE}}
# [[Xresources]] – {{ic|Xft.dpi}}
# 1.0
 
For troubleshooting, consult the "Show HiDPI Info" dialog via [https://www.jetbrains.com/help/idea/searching-everywhere.html search everywhere "Shift Shift"].
 
When using per-monitor scaling, an issue might occur where IntelliJ fails to recognize the real, original monitor resolution.
To remediate this problem some people have success by adding the {{ic|1=-Dsun.java2d.uiScale.enabled=true}} option to the {{ic|''ide_name''.vmoptions}} file (''Help > Edit custom VM options'').
 
If this does not work, the experimental GTK option {{ic|scale-monitor-framebuffer}} might be enabled on Wayland ([[#Wayland|see above]]). Currently JetBrains products run on Xwayland and thus [https://youtrack.jetbrains.com/issue/IDEA-228070 have no native Wayland support yet]. This makes the rendering in JetBrains products incompatible with the monitor scaling framebuffer. Disabling the framebuffer thus might solve blurry font/rendering issues for JB products, but alas results in disabled fractional scaling.


See [[#Firefox]]. To access {{ic|about:config}}, go to Edit → Preferences → Advanced → Config editor.
==== Maple ====


=== Wine applications ===
Maple can be scaled for HiDPI monitors using the AWT/Swing solution. But it has to be added inside your Maple installation directory to {{ic|''maple-directory''/bin/maple}} to the {{ic|JVM_OPTIONS}}:


Run
{{hc|''maple-directory''/bin/maple|2=
$ winecfg
...
and change the "dpi" setting found in the "Graphics" tab. This only affects the font size.
JVM_OPTIONS="-Dsun.java2d.uiScale=2 ..."
...
}}


=== Skype ===
Alternatively, the {{ic|GDK_SCALE}} environment variable can be used to start the application scaled:


Skype for Linux ({{AUR|skypeforlinux-stable-bin}} package) uses [[#GDK 3 (GTK+ 3)]].
$ GDK_SCALE=2 ''maple-directory''/bin/xmaple %f


=== Spotify ===
=== LibreOffice ===


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}}:
{{Remove|1=The bug seems [https://bugs.documentfoundation.org/show_bug.cgi?id=137924 fixed].}}


{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|<nowiki>
[[LibreOffice]] on all VCL backends take setting from there respective toolkits. There is a bug where the {{ic|kf5}} backend on Wayland does not scale [https://bugs.documentfoundation.org/show_bug.cgi?id=137924]. Use the {{ic|gtk3}} VCL backend instead. See [[LibreOffice#Theme]].
app.browser.zoom-level=100
</nowiki>}}


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
=== MATLAB ===
$ spotify --force-device-scale-factor=1.5


=== Zathura document viewer ===
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]:


No modifications required for document viewing.
>> s = settings;s.matlab.desktop.DisplayScaleFactor
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2


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]):
The settings take effect after MATLAB is restarted.


set font "monospace normal 20"
This can become tedious if you need to change the scaling frequently. To simplify this, consider using the following script:


=== Sublime Text 3 ===
{{hc|~/bin/matlab-scale|2=
Sublime Text 3 has full support for display scaling. Go to Preferences > Settings > User Settings and add {{ic|"dpi_scale": 2.0}} to your settings [http://blog.wxm.be/2014/08/30/sublime-text-3-and-high-dpi-on-linux.html (source)].
#!/bin/sh
exec matlab -r "s = settings;s.matlab.desktop.DisplayScaleFactor.PersonalValue=$1;quit" -nodesktop -nosplash
}}


=== IntelliJ IDEA ===
To change the display scaling to 3:


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:
$ matlab-scale 3


:''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/35/35870/bug.html]{{Dead link|2023|04|23|status=domain name not resolved}}, Mono applications should be scalable like [[#GDK 3 (GTK 3)|GTK 3]] applications. The precise method depends on the GUI library: GtkSharp obviouslys points back to Gtk, while the usual Windows Forms (libgdiplus) simply detects Xft settings.


=== NetBeans ===
=== NetBeans ===


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.[https://web.archive.org/web/20210117211145/http://wiki.netbeans.org/FaqFontSize]
 
The editor fontsize can be controlled from ''Tools > Option > Fonts & Colors''.
 
The output window fontsize can be controlled from ''Tools > Options > Miscelaneous > Output''
 
=== OBS Studio ===
 
OBS 29 supports HiDPI setups without any extra configuration.
 
For older versions of OBS, the recommendation was to set the environment variable {{ic|1=QT_AUTO_SCREEN_SCALE_FACTOR=0}} to disable [https://doc.qt.io/qt-5/highdpi.html#migrate-existing-applications Qt’s hi-dpi migration mode] and install the Yami theme. Do not use the Yami theme with OBS 29 or newer, as it is not necessary anymore and will cause buggy behavior.
 
=== Rofi ===
 
Rofi defaults to 96 DPI and relies on its own configuration only
{{hc|~/.config/rofi/config.rasi|2=
configuration {
    …
    dpi: 150;
    …
}
}}


The editor fontsize can be controlled from Tools → Option → Fonts & Colors.
=== Skype ===
 
Skype for Linux ({{AUR|skypeforlinux-bin}} package) uses [[#GDK 3 (GTK 3)]].
 
=== Spotify ===


The output window fontsize can be controlled from Tools → Options → Miscelaneous → Output
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:


=== Gimp 2.8 ===
{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|2=
app.browser.zoom-level=100
}}


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}}.)
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


There is also the [https://github.com/jedireza/gimp-hidpi gimp-hidpi].
$ spotify --force-device-scale-factor=1.5


=== Steam ===
=== Steam ===


==== Official HiDPI support ====
==== 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.
* 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)
* ''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.
* If it is not automatically detected, use {{ic|1=GDK_SCALE=2}} to set the desired scale factor.
* If the above fails, use {{ic|1=steam -forcedesktopscaling 2}} or set {{ic|1=STEAM_FORCE_DESKTOPUI_SCALING=2.0}}. [https://github.com/ValveSoftware/steam-for-linux/issues/9209#issuecomment-1594505259] As of the June 2023 UI overhaul, this parameter also supports non-integer scale factors, such as {{ic|1.25}}.


==== Unofficial ====
==== 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 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}}.}}
{{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.
[https://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.}}


=== Java applications ===
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.
 
$ QT_SCALE_FACTOR=0.5 VirtualBoxVM --startvm ''vm-name''
 
=== VMware ===
 
Text in the VMware application is rendered at an appropriate size following the system configuration, but icons are small and UI elements have little padding between them.
 
As described in [[#GDK 3 (GTK 3)]], you can use {{ic|GDK_SCALE}} to further scale up the entire UI (including icons & padding) and then use {{ic|GDK_DPI_SCALE}} to scale only the text back down to a reasonable size.


Java applications using the AWT/Swing framework can be scaled by defining the sun.java2d.uiScale variable when invoking java. For example,
For example, to get a final 2x scale factor:


  java -Dsun.java2d.uiScale=2 -jar some_application.jar
  $ GDK_SCALE=2 GDK_DPI_SCALE=0.5 vmware


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


=== Mono applications ===
Run


According to [https://bugzilla.xamarin.com/show_bug.cgi?id=35870], Mono applications should be scalable like [[#GDK 3 (GTK+ 3)|GTK3]] applications.
$ winecfg


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


Recent versions (R2017b) of [[Matlab]] allow to set the scale factor:
=== Zathura document viewer ===
>> s = settings;s.matlab.desktop.DisplayScaleFactor
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2
The settings take effect after MATLAB is restarted.


=== VirtualBox ===
No modifications required for document viewing.


{{Note|This ony applies to KDE with scaling enabled.}}
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]):
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.
  set font "monospace normal 20"
  $ QT_SCALE_FACTOR=0.5 VirtualBox --startvm vm-name


=== Zoom ===
=== Zoom ===


Zoom can be started with a proper scaling by overriding the {{ic|1=QT_SCALE_FACTOR}} environment variable.
Set the {{ic|scaleFactor}} variable in {{ic|~/.config/zoomus.conf}}.
 
For the Flatpak version, set the environment variable {{ic|QT_SCALE_FACTOR}} (e.g. to 0.5 [https://old.reddit.com/r/Zoom/comments/hat5af/linux_client_ui_elements_too_large_after_update/]). This can be easily done with [https://flathub.org/apps/details/com.github.tchx84.Flatseal Flatseal], if using a GUI tool is preferred.
 
=== Gazebo ===
 
Gazebo only renders an upper left of a view instead of the whole view. To fix this a Qt enviorment variable must be set.
 
To run Gazebo:
 
$ QT_SCREEN_SCALE_FACTORS=[1.0] gazebo
 
To run a ROS simulation:
 
$ TURTLEBOT3_MODEL=burger QT_SCREEN_SCALE_FACTORS=[1.0] roslaunch turtlebot3_gazebo turtlebot3_world.launch


$ QT_SCALE_FACTOR=2 zoom
Making an alias such as {{ic|1=gazebo="QT_SCREEN_SCALE_FACTORS=[1.0] gazebo"}} works for the first case but not for the second.


=== Unsupported applications ===
=== Fcitx ===


{{AUR|run_scaled-git}} can be used to scale applications (which uses {{Pkg|xpra}} internally).
Fcitx preedit {{ic|FontSize}} can be changed in {{ic|~/.config/fcitx/conf/fcitx-classic-ui.config}}.


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}}.
For Fcitx5, set {{ic|Font}} with a size inside double quotes in {{ic|~/.config/fcitx5/conf/classicui.conf}}.


[[x11vnc]] has an experimental option {{ic|-appshare}}, which opens one viewer per application window. Perhaps something could be hacked up with that.
=== Unsupported applications, via a network layer ===


== Multiple displays ==
{{Pkg|xpra}} includes a [https://github.com/Xpra-org/xpra/blob/4d73c3644d6692bd51376296ed913f18a809f1a9/docs/CHANGELOG.md#41-2021-02-26 run_scaled] script which can be used to scale applications.
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 ===
Another approach is to run the application full screen and without decoration in its own VNC desktop. Then scale the viewer. With {{AUR|vncdesk-git}} you can set up a desktop per application, then start server and client with a simple command such as {{ic|vncdesk 2}}.
{{Out of date|1=The bug with the mouse unable to reach the whole screen should be [https://bugs.freedesktop.org/show_bug.cgi?id=39949#c80 fixed in xorg 1.20].}}


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:
[[x11vnc]] has an experimental option {{ic|-appshare}}, which opens one viewer per application window. Perhaps something could be hacked up with that.


xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1
=== Unsupported applications, via Weston ===


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].
There is a no-network, potentially GPU-accelerated solution to scale old/unsupported applications via Weston. The basic example goes as:


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).
$ weston --xwayland --socket=testscale --scale=2
$ DISPLAY=:1 WAYLAND_DISPLAY=testscale ''your_app''


An example of the panning syntax for a 4k laptop with an external 1920x1080 monitor to the right:
Note 1: You can make it look nicer. Create a dedicated {{ic|weston.ini}} and use it with {{ic|weston --config}}:


  xrandr --output eDP-1 --auto --output HDMI-1 --auto --panning 3840x2160+3840+0 --scale 2x2 --right-of eDP-1
  [core]
idle-time=0
[shell]
panel-position=none
locking=false


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:
Note 2: Adjust your {{ic|DISPLAY}} according to your system, {{ic|:1}} is simply the default that comes after the main {{ic|:0}}. Check files created in {{ic|/tmp/.X11-unix}} to do that.


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
Note 3: If you want a separate window per each scaled app, adjust the {{ic|--socket}} parameter to weston and {{ic|WAYLAND_DISPLAY}} + {{ic|DISPLAY}} for each started app. Scripting that is not easy because Xorg display has to be a small-ish integer, but you can create a semi-safe script to infer it.


If panning is not a solution for you it may be better to set position of monitors and fix manually the total display screen.
Note 4: It is not fully tested yet whether weston and xwayland truly off-board the heavy parts to the GPU. At least {{ic|weston}} advertises to do so, but no tests on that were done yet. Please edit if you make the GPU usage tests.


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:
== Multiple displays ==


xrandr --output eDP-1 --auto --pos 0x1458 --output HDMI-1 --scale 1.35x1.35 --auto --pos 0x0 --fb 2592x2898
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]].


The total screen size (--fb) and positioning (--pos) are to be calculated taking into account the scaling factor.
=== 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 {{ic|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 {{ic|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|1=<nowiki/>
* 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].
* 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 ===
=== 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.
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
  $ 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.
In addition, when you downscale the HiDPI display, the font on the HiDPI display will be slightly blurry, but it is 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 411: Line 700:
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=2)
For UHD to 1080p (3840/1920=2 2160/1080=2)


  xrandr --output HDMI --scale 2x2
  $ xrandr --output HDMI --scale 2x2
 
You may adjust the {{ic|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 (tty) ==
 
=== In-kernel fonts ===
 
The [[Linux console]] changes the font to {{ic|TER16x32}} (based on {{ic|ter-i32b}} from {{Pkg|terminus-font}}[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ac8b6f148fc97e9e10b48bd337ef571b1d1136aa]) based on the vertical and horizontal pixel count of the display[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dfd19a5004eff03755967086aa04254c3d91b8ec] regardless of its physical size. If your monitor is not recognised as HiDPI, the default font can be changed. In that case, specify {{ic|1=fbcon=font:TER16x32}} in the [[kernel command line]]. 32pixel fonts are the maximum supported by the Linux kernel, in some cases this may not be enough.
 
=== Fonts outside the kernel (tty) ===
 
The largest fonts present in the {{Pkg|kbd}} package are {{ic|latarcyrheb-sun32}} and {{ic|solar24x32}}. 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 and [[Linux console#Persistent configuration]] in particular for applying the font setting during the early userspace boot sequence.


You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.
After changing the font, it is often garbled and unreadable when changing to other virtual consoles ({{ic|tty2}}–{{ic|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. Using small resolutions will make the text look bigger, but also pixelated.


== Linux console ==
Users booting though [[UEFI]] may experience the console and [[boot loader]] being constrained to a low resolution despite correct [[KMS]] settings being set. This can be caused by legacy/BIOS boot being enabled in UEFI settings. Disabling legacy boot to bypass the compatibility layer should allow the system to boot at the correct resolution.


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.
=== Modern HiDPI support (kmscon) ===


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.
For real HiDPI support, see [[KMSCON]] instead of changing the font size in the tty.


== See also ==
== See also ==


* [http://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)
* [https://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]
* [https://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 09:01, 20 March 2024

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, navigate to Settings > Devices > Displays > Scale and choose an appropriate value. 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: By default, GNOME only allows integer scaling numbers to be set. 1 = 100%, 2 = 200%, etc. See #Fractional scaling below.

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). Fractional scaling is possible on both Wayland and Xorg, though the process differs.

Implementation was mainly discussed and decided in GNOME fractional scaling hackfest 2017, check [1] for more technical details.

Note:

The factual accuracy of this article or section is disputed.

Reason: The information below is subject to change. For more, please see this online discussion. (Discuss in Talk:HiDPI)

Currently, GTK only supports fractional scaling for fonts. On the other hand, widgets, like buttons or labels, may only use integer (DPI) scaling. As such, fractional scaling for most native GNOME applications requires first rendering at a higher resolution, then downscaling to the requested resolution. GTK utilizes this technique in both Wayland and Xorg sessions.

For some setups running GTK 3 applications, this can increase CPU and GPU usage and power usage, resulting in a less responsive experience - particularly in Xorg. If these issues are considerable in your use case, please consider using another desktop environment or deactivating fractional scaling.
Wayland

Enable the experimental fractional scaling 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).

To enable the option for all users, create the following three files with the corresponding content

/etc/dconf/profile/user
user-db:user
system-db:local
/etc/dconf/db/local.d/00-hidpi
[org/gnome/mutter]
experimental-features=['scale-monitor-framebuffer']
/etc/dconf/db/locks/hidpi
/org/gnome/mutter/experimental-features

Then run dconf update and restart the machine. This will permanently lock the option.

XWayland

The feature of supporting clients with native scaling without scaling the Xwayland resolution to avoid Xwayland blurring (Similar to KDE Plasma "Apply scaling themselves" Xwayland scale method) has already been listed on the mutter's Fractional Scaling Known issues and TODO List. See also the pull request for upstream Xwayland.

Xorg

Ubuntu has provided a patch[2] to scale with Randr in GNOME Settings. This patch is already provided by mutter-x11-scalingAUR. After installing it, you can set:

$ gsettings set org.gnome.mutter experimental-features "['x11-randr-fractional-scaling']"

Then open Settings > Devices > Displays to set the scale.

You can also manually 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

To ensure that the settings persist across reboots, you may choose to use autorandr. Refer to this StackOverflow for more information.

The factual accuracy of this article or section is disputed.

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[dead link 2022-09-18 ⓘ]. In the source documentation there is another way mentioned to set X settings DPI:

You can use the gsettings, just make sure to read previous setting first and merge it. In just simply set it with this command:

$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'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 in addition to changing the display scaling, you can separately scale text. This can be done by navigating to Fonts > Scaling Factor in Gnome Tweaks, or using gsettings. Note that the text scaling factor need not be limited to whole integers, for example:

$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.5
GTK+ vs Gnome Shell elements on Xorg

This article or section is out of date.

Reason: Needs a partial rewrite regarding the Gnome Shell Toolkit, since it looks unmaintained since 2009. (Discuss in Talk:HiDPI)

Adjusting the text scaling as per the above only affects GTK+ elements of the GNOME desktop. This should cover everything on Wayland. However, those on an Xorg session may find that they need to make further adjustments on HiDPI environments, since the GNOME Shell UI (including the top bar, dock, application menus, etc.) relies separately on the St[dead link 2021-11-11 ⓘ] toolkit. Note that this is a long-standing issue to which a patch has been merged and available for Gnome Shell 3.35 onward. For older releases, Xorg users can resolve most of the Gnome shell scaling problems by manually editing the shell theme that they are currently using. The relevant CSS files are normally located at /usr/share/themes/YOUR-THEME/gnome-shell/gnome-shell.css. Users should increase all "font-size" elements in this file in proportion to their display scaling (doubling font sizes for 200% scaling, etc.) For example, the top of an edited CSS file for the Adapta shell theme might look like:

usr/share/themes/Adapta/gnome-shell/gnome-shell.css
stage { font-size: 20pt; font-family: Roboto, Noto Sans, Sans-Serif; color: #263238; }

Once these changes have been saved, activate them by switching to another theme (for example, using gnome-tweaks) and then reverting back again. The top bar, application menus, calendar, and other shell elements should now be correctly scaled.

In addition to editing the relevant shell theme's CSS file, users on Xorg may also wish to increase the title bar font at the top of open applications. This can be done through the dconf editor (org > gnome > desktop > wm > preferences :: titlebar-font). Note that the title-bar-uses-system-fonts option should also be turned off. Alternatively, use gsettings:

$ gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Cantarell Bold 22' ## Change as needed
$ gsettings set org.gnome.desktop.wm.preferences titlebar-uses-system-font false

KDE Plasma

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

Note: Plasma 5.27 dropped use of GDK_SCALE/GDK_DPI_SCALE variables and switched to Xsettingsd. It should be installed to make scaling work for GTK apps. Or you can set this variables manually as described in #GDK 3 (GTK 3).

To adjust font, widget, and icon scaling together:

  1. System Settings > Display and Monitor > Display Configuration > Global Scale
  2. Drag the slider to the desired size
  3. Restart for the settings to take effect
Note: If you are using xorg, and global scaling is set but not applied to Qt applications after reboot, please check if xft.dpi is set in ~/.Xresources . If so, removing the variable and adjusting global scaling again may take effect.

However, using X11 session, Plasma ignores the Qt scaling settings by default, which affects panels and other desktop elements. To make Plasma respect the Qt settings, set PLASMA_USE_QT_SCALING=1.

Cursor size

To adjust cursor size:

  1. System Settings > Appearance > Cursors > Size

Font scaling

To adjust only font scaling:

  1. System Settings > Appearance > 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.

Icon scaling

To adjust only icon scaling:

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

Panel scaling

To adjust only panel scaling:

  1. Right click the panel, select Enter Edit Mode, and manually adjust Panel height.

Xwayland

As of Plasma 5.26, the Xwayland scale method can be chosen at the bottom of the System Settings > Display and Monitor > Display Configuration page.

In "Scaled by the system" mode, the X application will be rendered at 1x and then magnified (scaled) by KDE. This works for all applications, but causes blurriness due to the magnification.

In "Apply scaling themselves" mode, the X application will have to render itself at the appropriate size. This will avoid blurriness, but applications which aren't HiDPI-aware will render themselves at 1x scale and therefore will appear small.

See this blog post for details.

Xfce

Xfce supports HiDPI scaling which can be enabled using the settings manager:

  1. Go to Settings Manager > Appearance > Settings > Window Scaling and select 2 as the scaling factor.
  2. Go to Settings Manager > Window Manager > Style and select Default-xhdpi theme.

Alternatively, it is possible to do the same from command line using xfconf-query:

$ xfconf-query -c xsettings -p /Gdk/WindowScalingFactor -s 2
$ xfconf-query -c xfwm4 -p /general/theme -s Default-xhdpi

After either of the above changes, fonts in some GTK applications may still not be scaled; you may additionally do the following (see #GDK 3 (GTK 3)):

  1. Go to Settings Manager > Appearance > Fonts > Custom DPI setting and change from 96 to 192
  2. Set the environment variable GDK_DPI_SCALE=0.5 to un-scale some fonts that would be scaled twice.

The steps above would set 2x scaled resolution for Xfce and other GTK 3 applications.

Scaling for Qt 5 applications should be set manually, see #Qt 5. Note that if you set a Custom DPI for fonts above, you likely need to set QT_FONT_DPI=96 to avoid double-scaling of fonts in Qt applications.

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 MacBook Pro 15" screen.

Window managers

Sway

See Sway#HiDPI.

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: 192

! These might also be useful depending on your monitor and personal preference:
Xft.autohint: 0
Xft.lcdfilter:  lcddefault
Xft.hintstyle:  hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb

For Xft.dpi, using integer multiples of 96 usually works best, e.g. 192 for 200% scaling.

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.

X Server

The factual accuracy of this article or section is disputed.

Reason: libxft is a font rendering interface library, the Xft.dpi setting was not intended to be abused by other applications. On the other hand, the xorg.conf value should affect everything. (Discuss in Talk:HiDPI)

Some programs may still interpret the DPI given by the X server (most interpret X Resources, though, directly or indirectly). Older versions of i3 (before 2017) and Chromium (before 2017) used to do this.

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 238mm, 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.

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. Qt 5.14 introduced a new environment variable QT_ENABLE_HIGHDPI_SCALING which replaces the QT_AUTO_SCREEN_SCALE_FACTOR variable. It is recommended to set both environment variables for maximum compatibility:

$ export QT_AUTO_SCREEN_SCALE_FACTOR=1
$ export QT_ENABLE_HIGHDPI_SCALING=1

If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen (QT_SCREEN_SCALE_FACTORS/QT_ENABLE_HIGHDPI_SCALING) 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 and QT_ENABLE_HIGHDPI_SCALING=0 otherwise some applications which explicitly force high DPI enabling get scaled twice.
  • QT_SCALE_FACTOR scales fonts, but QT_SCREEN_SCALE_FACTORS may not scale fonts, depending on the application.
  • 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 clementine

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 (in X11, not Wayland) 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 an integer only factor:

$ export GDK_SCALE=2

GTK3/4 does not support fractional scaling currently, so fractional factors will be ignored. This environment variable is also ignored in mutter wayland sessions.

GDK_DPI_SCALE can be used to scale text only. To undo scaling of text, fractional scale can be used:

$ export GDK_DPI_SCALE=0.5

Under GTK3/4 it not currently possible to scale icon sizes, unless the application explicitly implements a way to do so. See bug report #4528. If you need this feature, use Qt when possible.

GTK 2

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

Electron

Electron applications (e.g. slack-desktopAUR, signal-desktop, etc.) 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/, and can normally be overridden on a per-user basis by copying it to ~/.local/share/applications/. The flag should be added to the line beginning with "Exec=". For example:

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

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/[dead link 2023-04-23 ⓘ]

GNUstep

GNUstep applications that use its gui (AppKit) library accept a GSScaleFactor property in their defaults (STEP preferences). To define a scaling factor of 1.5 for all applications:

defaults write NSGlobalDomain GSScaleFactor 1.5

Note that you must also disable font hinting by setting the value of GSFontHinting to 17, else text rendering will look broken when rendering long lines.

defaults write NSGlobalDomain GSFontHinting 17

Some automatic detection was possible back in 2011, but the code responsible for the X11 backend was commented out thereafter.

FLTK

FLTK 1.3, the default FLTK version available in Arch Linux, does not support resolution scaling. Support will arrive when applications start using FLTK 1.4.

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"
Note: GRUB_THEME overrides GRUB_FONT if it is used.

Finally regenerate the main configuration file.

Tip: The font size can also be changed with the GUI tool grub-customizer.

systemd-boot

Set a lower resolution for the console through console-mode as explained in systemd-boot#Loader configuration and loader.conf(5) § OPTIONS.

Applications

If you are running a Wayland session, but application is running via Xwayland (either because it does not support Wayland natively or because it uses X11 by default), you could still get blurry fonts and interface, even if the application supports HiDPI. See this bug report. See also Wayland#Detect Xwayland applications visually.

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 add and set parameter ui.textScaleFactor to 150 (or find the one that suits you better; 150 is a good choice for Retina screens). You will likely also need to edit the zoom level in general preferences to e.g. 120%. This does not consistently scale the entirety of Firefox: edit layout.css.devPixelsPerPx for that, but as of Firefox 103 it may not work as expected.

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. Starting from Firefox 69 the userChrome.css and userContent.css files are not loaded by default unless preference is set by the user. Open Firefox advanced preferences page (about:config) and set parameter toolkit.legacyUserProfileCustomizations.stylesheets to True, then restart Firefox to apply the changes.

~/.mozilla/firefox/<profile>/chrome/userChrome.css
@namespace url("https://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;
}

If you use a HiDPI monitor such as Retina display together with another monitor, you can use the ffreszoom add-on, which will adjust the page zoom if it detects you are using a large monitor (zoom level and threshold are configurable). Modifying the internal CSS DPI setting from an extension is currently unsupported [3].

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

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.

If using Wayland session, you should enable native wayland support to avoid blurriness. See also Chromium#Incorrect HiDPI rendering.

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.10

To fix toolbar icon sizes, update Preferences > Interface > Icon Theme > Custom icon size to huge or other value.

If menu fonts are still too small you can update an existing theme by copying it from /usr/share/gimp/2.0/themes/ into ~/.config/GIMP/2.10/themes/ and changing gtk-font-name and font_name in gtkrc into something bigger like Sans 30. Then select the new theme from Preferences > Interface > Theme. When copying make sure to rename the new directory into something different from the original name (example Dark > DarkHighDPI).

You can also try using gimp-hidpi (installation instructions are outdated and refer to version 2.8, in Gimp 2.10 the theme should be installed into ~/.config/GIMP/2.10/themes/)

On the latest versions of gimp-develAUR, Wayland and HiDPI are both fully supported. Icons and text can be scaled from Preferences > Interface > Icon Theme/Display respectively.

Inkscape

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

Java applications

AWT/Swing

Java applications using the AWT/Swing framework can be scaled by defining the sun.java2d.uiScale VM property when invoking java. The value can be an integer percentage value, or a float value. For example,

java -Dsun.java2d.uiScale=2 -jar some_swing_application.jar
java -Dsun.java2d.uiScale=300% -jar some_swing_application.jar

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

Note that at this point, Java AWT/Swing (up to including OpenJDK 13) only effectively supports integer values. A setting of -Dsun.java2d.uiScale=250% or GDK_SCALE=2.5 will be treated as if it were set to -Dsun.java2d.uiScale=2 resp. GDK_SCALE=2.

JavaFX

Java applications using JavaFX can be scaled by defining the glass.gtk.uiScale VM property when invoking java. The value can be an integer percentage value, an integer DPI value (where 96dpi represents a scale factor of 100%, and for example 192dpi represents a scale factor of 200%), or a float value. For example,

java -Dglass.gtk.uiScale=200% -jar some_jfx_application.jar
java -Dglass.gtk.uiScale=192dpi -jar some_jfx_application.jar
java -Dglass.gtk.uiScale=2.0 -jar some_jfx_application.jar

JavaFX perfectly well supports fractions. Using values like -Dglass.gtk.uiScale=250% or -Dglass.gtk.uiScale=2.5 will deliver the expected result.

Mixed AWT/Swing and JavaFX

Some Java applications mix JavaFX and AWT/Swing (via javafx.embed.swing.JFXPanel). In that case, the settings for AWT/Swing will also affect JavaFX, and setting -Dglass.gtk.uiScale will have no effect.

JetBrains IDEs

JetBrains products (IntelliJ IDEA and other IDEs) support two HiDPI modes (JRE-managed and IDE-managed). The sequence for determining system scale factor is well documented at [6]:

  1. Java property – -Dsun.java2d.uiScale
  2. gsettings(1)ubuntu.user-interface/scale-factor or org.gnome.desktop.interface/scaling-factor
  3. GDK_SCALE and GDK_DPI_SCALE
  4. XresourcesXft.dpi
  5. 1.0

For troubleshooting, consult the "Show HiDPI Info" dialog via search everywhere "Shift Shift".

When using per-monitor scaling, an issue might occur where IntelliJ fails to recognize the real, original monitor resolution. To remediate this problem some people have success by adding the -Dsun.java2d.uiScale.enabled=true option to the ide_name.vmoptions file (Help > Edit custom VM options).

If this does not work, the experimental GTK option scale-monitor-framebuffer might be enabled on Wayland (see above). Currently JetBrains products run on Xwayland and thus have no native Wayland support yet. This makes the rendering in JetBrains products incompatible with the monitor scaling framebuffer. Disabling the framebuffer thus might solve blurry font/rendering issues for JB products, but alas results in disabled fractional scaling.

Maple

Maple can be scaled for HiDPI monitors using the AWT/Swing solution. But it has to be added inside your Maple installation directory to maple-directory/bin/maple to the JVM_OPTIONS:

maple-directory/bin/maple
...
JVM_OPTIONS="-Dsun.java2d.uiScale=2 ..."
...

Alternatively, the GDK_SCALE environment variable can be used to start the application scaled:

$ GDK_SCALE=2 maple-directory/bin/xmaple %f

LibreOffice

This article or section is being considered for removal.

Reason: The bug seems fixed. (Discuss in Talk:HiDPI)

LibreOffice on all VCL backends take setting from there respective toolkits. There is a bug where the kf5 backend on Wayland does not scale [7]. Use the gtk3 VCL backend instead. See LibreOffice#Theme.

MATLAB

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

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

The settings take effect after MATLAB is restarted.

This can become tedious if you need to change the scaling frequently. To simplify this, consider using the following script:

~/bin/matlab-scale
#!/bin/sh
exec matlab -r "s = settings;s.matlab.desktop.DisplayScaleFactor.PersonalValue=$1;quit" -nodesktop -nosplash

To change the display scaling to 3:

$ matlab-scale 3

Mono applications

According to [9][dead link 2023-04-23 ⓘ], Mono applications should be scalable like GTK 3 applications. The precise method depends on the GUI library: GtkSharp obviouslys points back to Gtk, while the usual Windows Forms (libgdiplus) simply detects Xft settings.

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.[10]

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

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

OBS Studio

OBS 29 supports HiDPI setups without any extra configuration.

For older versions of OBS, the recommendation was to set the environment variable QT_AUTO_SCREEN_SCALE_FACTOR=0 to disable Qt’s hi-dpi migration mode and install the Yami theme. Do not use the Yami theme with OBS 29 or newer, as it is not necessary anymore and will cause buggy behavior.

Rofi

Rofi defaults to 96 DPI and relies on its own configuration only

~/.config/rofi/config.rasi
configuration {
    …
    dpi: 150;
    …
}

Skype

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

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 is not automatically detected, use GDK_SCALE=2 to set the desired scale factor.
  • If the above fails, use steam -forcedesktopscaling 2 or set STEAM_FORCE_DESKTOPUI_SCALING=2.0. [11] As of the June 2023 UI overhaul, this parameter also supports non-integer scale factors, such as 1.25.

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 [12]).

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 VirtualBoxVM --startvm vm-name

VMware

Text in the VMware application is rendered at an appropriate size following the system configuration, but icons are small and UI elements have little padding between them.

As described in #GDK 3 (GTK 3), you can use GDK_SCALE to further scale up the entire UI (including icons & padding) and then use GDK_DPI_SCALE to scale only the text back down to a reasonable size.

For example, to get a final 2x scale factor:

$ GDK_SCALE=2 GDK_DPI_SCALE=0.5 vmware

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

Set the scaleFactor variable in ~/.config/zoomus.conf.

For the Flatpak version, set the environment variable QT_SCALE_FACTOR (e.g. to 0.5 [13]). This can be easily done with Flatseal, if using a GUI tool is preferred.

Gazebo

Gazebo only renders an upper left of a view instead of the whole view. To fix this a Qt enviorment variable must be set.

To run Gazebo:

$ QT_SCREEN_SCALE_FACTORS=[1.0] gazebo

To run a ROS simulation:

$ TURTLEBOT3_MODEL=burger QT_SCREEN_SCALE_FACTORS=[1.0] roslaunch turtlebot3_gazebo turtlebot3_world.launch

Making an alias such as gazebo="QT_SCREEN_SCALE_FACTORS=[1.0] gazebo" works for the first case but not for the second.

Fcitx

Fcitx preedit FontSize can be changed in ~/.config/fcitx/conf/fcitx-classic-ui.config.

For Fcitx5, set Font with a size inside double quotes in ~/.config/fcitx5/conf/classicui.conf.

Unsupported applications, via a network layer

xpra includes a run_scaled script which can be used to scale applications.

Another approach is to run the application full screen and without decoration in its own VNC desktop. Then scale the viewer. With vncdesk-gitAUR 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.

Unsupported applications, via Weston

There is a no-network, potentially GPU-accelerated solution to scale old/unsupported applications via Weston. The basic example goes as:

$ weston --xwayland --socket=testscale --scale=2
$ DISPLAY=:1 WAYLAND_DISPLAY=testscale your_app

Note 1: You can make it look nicer. Create a dedicated weston.ini and use it with weston --config:

[core]
idle-time=0
[shell]
panel-position=none
locking=false

Note 2: Adjust your DISPLAY according to your system, :1 is simply the default that comes after the main :0. Check files created in /tmp/.X11-unix to do that.

Note 3: If you want a separate window per each scaled app, adjust the --socket parameter to weston and WAYLAND_DISPLAY + DISPLAY for each started app. Scripting that is not easy because Xorg display has to be a small-ish integer, but you can create a semi-safe script to infer it.

Note 4: It is not fully tested yet whether weston and xwayland truly off-board the heavy parts to the GPU. At least weston advertises to do so, but no tests on that were done yet. Please edit if you make the GPU usage tests.

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. [14] A potential workaround exists with configuring ForceFullCompositionPipeline=On on the CurrentMetaMode via nvidia-settings. For more info see [15].
  • 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 is 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 (tty)

In-kernel fonts

The Linux console changes the font to TER16x32 (based on ter-i32b from terminus-font[16]) based on the vertical and horizontal pixel count of the display[17] regardless of its physical size. If your monitor is not recognised as HiDPI, the default font can be changed. In that case, specify fbcon=font:TER16x32 in the kernel command line. 32pixel fonts are the maximum supported by the Linux kernel, in some cases this may not be enough.

Fonts outside the kernel (tty)

The largest fonts present in the kbd package are latarcyrheb-sun32 and solar24x32. Other packages like terminus-font contain further alternatives, such as ter-132n (normal) and ter-132b (bold). See Linux console#Fonts for configuration details and 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 (tty26). 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. Using small resolutions will make the text look bigger, but also pixelated.

Users booting though UEFI may experience the console and boot loader being constrained to a low resolution despite correct KMS settings being set. This can be caused by legacy/BIOS boot being enabled in UEFI settings. Disabling legacy boot to bypass the compatibility layer should allow the system to boot at the correct resolution.

Modern HiDPI support (kmscon)

For real HiDPI support, see KMSCON instead of changing the font size in the tty.

See also