https://wiki.archlinux.org/api.php?action=feedcontributions&user=SECuRE&feedformat=atomArchWiki - User contributions [en]2024-03-28T19:39:42ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=HiDPI&diff=767418HiDPI2023-02-12T09:04:04Z<p>SECuRE: OBS Studio in version 29 and newer does not require extra steps. Leave a note regarding the Yami theme so that people with older installations know about the path forward.</p>
<hr />
<div>[[Category:Graphics]]<br />
[[ja:HiDPI]]<br />
[[zh-hans:HiDPI]]<br />
{{Related articles start}}<br />
{{Related|Font configuration}}<br />
{{Related articles end}}<br />
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.<br />
<br />
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.<br />
<br />
== Desktop environments ==<br />
<br />
=== GNOME ===<br />
<br />
To enable HiDPI, navigate to ''Settings > Devices > Displays > Scale'' and choose an appropriate value. Or, use gsettings:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "[{'Gdk/WindowScalingFactor', <2>}]"<br />
$ gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
{{Note|1=GNOME only allows integer scaling numbers to be set. 1 = 100%, 2 = 200%, etc. See [[#Fractional scaling]] below.}}<br />
<br />
==== Fractional scaling ====<br />
<br />
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.<br />
<br />
Implementation was mainly discussed and decided in GNOME fractional scaling hackfest 2017, check [https://hackmd.io/WspOFZpRTo2qlWc8fh_zPQ] for more technical details.<br />
<br />
{{Note|GTK does not and has no plans to support DPI scaling on all elements except fonts. Therefore, fractional scaling on gnome uses oversampling, which means rendering at a higher resolution, then scaling down with integer scaling, and is true for both wayland and xorg sessions. This brings higher GPU and CPU (since GTK is not fully hardware accelerated) usage, more power consumption, and in some cases significantly slower responsiveness, particularly noticeable in xorg. If it's necessary to avoid these problems, consider switching to a Qt based desktop environment.}}<br />
<br />
===== Wayland =====<br />
<br />
Enable the experimental fractional scaling feature:<br />
<br />
$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"<br />
<br />
then open ''Settings > Devices > Displays'' (the new options may only appear after a restart).<br />
<br />
{{Note|Enabling fractional scaling can result in blur for legacy applications using XWayland, ''even if only integer scales are used'', because the rendering method changes.}}<br />
<br />
To enable the option for all users, create the following three files with the corresponding content<br />
<br />
{{hc|/etc/dconf/profile/user|<nowiki><br />
user-db:user<br />
system-db:local<br />
</nowiki>}}<br />
<br />
{{hc|/etc/dconf/db/local.d/00-hidpi|<nowiki><br />
[org/gnome/mutter]<br />
experimental-features=['scale-monitor-framebuffer']<br />
</nowiki>}}<br />
<br />
{{hc|/etc/dconf/db/locks/hidpi|<nowiki><br />
/org/gnome/mutter/experimental-features<br />
</nowiki>}}<br />
<br />
Then run {{ic|dconf update}} and restart the machine. This will permanently lock the option.<br />
<br />
===== Xorg =====<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.mutter experimental-features "['x11-randr-fractional-scaling']"<br />
<br />
Then open ''Settings > Devices > Displays'' to set the scale.<br />
<br />
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]].<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 1.25x1.25<br />
<br />
{{Note|To allow the mouse to reach the whole screen, you may need to use the {{ic|--panning}} option as explained in [[#Side display]].}}<br />
<br />
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.<br />
<br />
{{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}}<br />
<br />
GNOME ignores X settings due to its xsettings Plugin in Gnome Settings Daemon, where DPI setting is hard coded.<br />
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}}.<br />
In the source documentation there is another way mentioned to set X settings DPI:<br />
<br />
You can use the gsettings, just make sure to read previous setting first and merge it. In just simply set it with this command:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Xft/DPI': <153600>}"<br />
<br />
From README.xsettings<br />
<br />
Noting that variants must be specified in the usual way (wrapped in <>).<br />
<br />
Note also that DPI in the above example is expressed in 1024ths of an inch.<br />
<br />
==== Text Scaling ====<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.5<br />
<br />
===== GTK+ vs Gnome Shell elements on Xorg =====<br />
<br />
{{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].}}<br />
<br />
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:<br />
<br />
{{hc|usr/share/themes/Adapta/gnome-shell/gnome-shell.css|2=<br />
stage { font-size: 20pt; font-family: Roboto, Noto Sans, Sans-Serif; color: #263238; }<br />
}}<br />
<br />
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.<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Cantarell Bold 22' ## Change as needed<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-uses-system-font false<br />
<br />
=== KDE Plasma ===<br />
<br />
You can use Plasma's settings to fine tune font, icon, and widget scaling. This solution affects both Qt and GTK applications.<br />
<br />
To adjust font, widget, and icon scaling together:<br />
<br />
# ''System Settings > Display and Monitor > Display Configuration > Global Scale''<br />
# Drag the slider to the desired size<br />
# Restart for the settings to take effect<br />
<br />
{{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.}}<br />
<br />
===== Cursor size =====<br />
<br />
To adjust cursor size:<br />
<br />
# ''System Settings > Appearance > Cursors > Size''<br />
<br />
===== Font scaling =====<br />
<br />
To adjust only font scaling:<br />
<br />
# ''System Settings > Appearance > Fonts''<br />
# 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.<br />
<br />
===== Icon scaling =====<br />
<br />
To adjust only icon scaling:<br />
<br />
# ''System Settings > Appearance > Icons > Advanced''<br />
# Choose the desired icon size for each category listed. This should take effect immediately.<br />
<br />
==== Tray icons with fixed size ====<br />
<br />
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, [[Environment variables|set]] {{ic|1=PLASMA_USE_QT_SCALING=1}}.<br />
<br />
==== XWayland ====<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
<br />
See this [https://pointieststick.com/2022/06/17/this-week-in-kde-non-blurry-xwayland-apps/ blog post] for details.<br />
<br />
=== Xfce ===<br />
<br />
Xfce supports HiDPI scaling which can be enabled using the settings manager:<br />
<br />
# Go to ''Settings Manager > Appearance > Settings > Window Scaling'' and select 2 as the scaling factor.<br />
# Go to ''Settings Manager > Window Manager > Style'' and select {{ic|Default-xhdpi}} theme.<br />
<br />
Alternatively, it is possible to do the same from command line using {{ic|xfconf-query}}:<br />
<br />
xfconf-query -c xsettings -p /Gdk/WindowScalingFactor -s 2<br />
xfconf-query -c xfwm4 -p /general/theme -s Default-xhdpi<br />
<br />
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)]]):<br />
<br />
# Go to ''Settings Manager > Appearance > Fonts > Custom DPI setting'' and change from 96 to 192<br />
# Set the [[environment variable]] {{ic|1=GDK_DPI_SCALE=0.5}} to un-scale some fonts that would be scaled twice.<br />
<br />
The steps above would set 2x scaled resolution for Xfce and other GTK 3 applications.<br />
<br />
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.<br />
<br />
=== Cinnamon ===<br />
<br />
Has good support out of the box.<br />
<br />
=== Enlightenment ===<br />
<br />
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.<br />
<br />
== X Resources ==<br />
<br />
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]]:<br />
<br />
{{hc|~/.Xresources|2=<br />
Xft.dpi: 192<br />
<br />
! These might also be useful depending on your monitor and personal preference:<br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintfull<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
}}<br />
<br />
For {{ic|Xft.dpi}}, using integer multiples of 96 usually works best, e.g. 192 for 200% scaling.<br />
<br />
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).<br />
<br />
This will make the font render properly in most toolkits and applications, it will however not affect things such as icon size!<br />
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.<br />
<br />
== X Server ==<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
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:<br />
<br />
{{hc|$ xdpyinfo {{!}} grep -B 2 resolution|<br />
screen #0:<br />
dimensions: 3200x1800 pixels (423x238 millimeters)<br />
resolution: 192x192 dots per inch<br />
}}<br />
<br />
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.<br />
<br />
If the DPI displayed by xdpyinfo is not correct, see [[Xorg#Display size and DPI]] for how to fix it.<br />
<br />
== GUI toolkits ==<br />
<br />
=== Qt 5 ===<br />
<br />
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]]:<br />
<br />
export QT_AUTO_SCREEN_SCALE_FACTOR=1<br />
<br />
If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen ({{ic|QT_SCREEN_SCALE_FACTORS}}) or globally ({{ic|QT_SCALE_FACTOR}}). For more details see the [https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/ Qt blog post] or [https://doc.qt.io/qt-5/highdpi.html Qt developer documentation].<br />
<br />
{{Note|<br />
* 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.<br />
* {{ic|QT_SCALE_FACTOR}} scales fonts, but {{ic|QT_SCREEN_SCALE_FACTORS}} does not scale fonts.<br />
* If you also set the font DPI manually in ''xrdb'' to support other toolkits, {{ic|QT_SCALE_FACTORS}} will give you huge fonts.<br />
* If you have multiple screens of differing DPI ie: [[#Side display]] you may need to do {{ic|1=QT_SCREEN_SCALE_FACTORS="2;2"}}<br />
}}<br />
<br />
An [https://bugreports.qt.io/browse/QTBUG-53022 alternative] is e.g.:<br />
<br />
QT_FONT_DPI=96 clementine<br />
<br />
=== GDK 3 (GTK 3) ===<br />
<br />
{{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.}} <br />
<br />
Setting the GDK scale will scale the UI, however it will not scale icons. If you are using a minimal window manager where you are setting the dpi via Xft.dpi, GDK should scale perfectly fine with it. In other cases, [https://docs.gtk.org/gtk3/x11.html do the following]:<br />
<br />
To scale UI elements by an integer only factor:<br />
<br />
$ export GDK_SCALE=2<br />
<br />
GTK3/4 does not support fractional scaling currently, so fractional factors will be ignored. This environment variable is also ignored in mutter wayland sessions.<br />
<br />
{{ic|GDK_DPI_SCALE}} can be used to scale text only. To undo scaling of text, fractional scale can be used:<br />
<br />
$ export GDK_DPI_SCALE=0.5<br />
<br />
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.<br />
<br />
=== GTK 2 ===<br />
<br />
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}}.<br />
<br />
=== Electron ===<br />
<br />
[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:<br />
<br />
{{hc|/usr/share/applications/slack.desktop|2=<br />
Exec=env LD_PRELOAD=/usr/lib/libcurl.so.3 /usr/bin/slack --force-device-scale-factor=1.5 %U<br />
}}<br />
<br />
=== Elementary (EFL) ===<br />
<br />
To scale UI elements by a factor of 1.5:<br />
<br />
export ELM_SCALE=1.5<br />
<br />
For more details see https://phab.enlightenment.org/w/elementary/<br />
<br />
=== GNUstep ===<br />
<br />
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:<br />
<br />
defaults write NSGlobalDomain GSScaleFactor 1.5<br />
<br />
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.<br />
<br />
defaults write NSGlobalDomain GSFontHinting 17<br />
<br />
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.<br />
<br />
== Boot managers ==<br />
<br />
=== GRUB ===<br />
<br />
==== Lower the framebuffer resolution ====<br />
<br />
Set a lower resolution for the framebuffer as explained in [[GRUB/Tips and tricks#Setting the framebuffer resolution]].<br />
<br />
==== Change GRUB font size ====<br />
<br />
Find a ttf font that you like in {{ic|/usr/share/fonts/}}.<br />
<br />
Convert the font to a format that GRUB can utilize:<br />
<br />
# grub-mkfont -s 30 -o /boot/grubfont.pf2 /usr/share/fonts/FontFamily/FontName.ttf<br />
<br />
{{Note|Change the {{ic|-s 30}} parameter to modify the font size}}<br />
<br />
Edit {{ic|/etc/default/grub}} to set the new font as shown in [[GRUB/Tips and tricks#Background image and bitmap fonts]]:<br />
<br />
GRUB_FONT="/boot/grubfont.pf2"<br />
<br />
{{Note|{{ic|GRUB_THEME}} overrides {{ic|GRUB_FONT}} if it is used.}}<br />
<br />
Finally [[GRUB#Generate the main configuration file|regenerate the main configuration file]].<br />
<br />
{{Tip|The font size can also be changed with the GUI tool {{Pkg|grub-customizer}}.}}<br />
<br />
=== systemd-boot ===<br />
<br />
Adding the following line and running {{ic|bootctl update}} increases font-size in the [[systemd-boot#Loader configuration|systemd-boot]] menu:<br />
<br />
{{hc|/boot/loader/loader.conf|2=<br />
console-mode 1<br />
}}<br />
<br />
== Applications ==<br />
<br />
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]].<br />
<br />
=== Atom ===<br />
<br />
Add {{ic|1=--force-device-scale-factor=2}} as a flag to the atom.desktop file:<br />
<br />
{{hc|/usr/share/applications/atom.desktop|2=<br />
Exec=/usr/bin/atom --force-device-scale-factor=2 %F<br />
}}<br />
<br />
=== Browsers ===<br />
<br />
==== Firefox ====<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
<br />
{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|<br />
@namespace url("https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");<br />
<br />
/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */<br />
* {<br />
font-size: 15px !important;<br />
}<br />
<br />
/* exception for badge on adblocker */<br />
.toolbarbutton-badge {<br />
font-size: 8px !important;<br />
}<br />
}}<br />
<br />
{{Warning|The AutoHiDPI extension is not compatible with Firefox Quantum (version 57 and above).}}<br />
<br />
If you use a HiDPI monitor such as Retina display together with another monitor, you can use [https://github.com/ertug/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. For users of Firefox version 57 and above, the [https://addons.mozilla.org/firefox/addon/ffreszoom/ ffreszoom] add-on 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].<br />
<br />
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}}.<br />
<br />
==== Chromium / Google Chrome ====<br />
<br />
Chromium should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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}}.<br />
<br />
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}}:<br />
<br />
{{hc|~/.config/chromium-flags.conf|2=<br />
--force-device-scale-factor=2<br />
}}<br />
<br />
To make this work for Chrome, add the same option to {{ic|~/.config/chrome-flags.conf}} instead.<br />
<br />
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.<br />
<br />
If using Wayland session, you should [[Chromium#Native Wayland support|enable]] native wayland support to avoid blurriness. See also [[Chromium#Incorrect HiDPI rendering]].<br />
<br />
==== Opera ====<br />
<br />
Opera should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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.)<br />
<br />
=== Gimp 2.10 ===<br />
<br />
To fix toolbar icon sizes, update ''Preferences > Interface > Icon Theme > Custom icon size'' to {{ic|1=huge}} or other value.<br />
<br />
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'').<br />
<br />
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/}})<br />
<br />
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.<br />
<br />
=== Inkscape ===<br />
<br />
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].<br />
<br />
=== Java applications ===<br />
<br />
==== AWT/Swing ====<br />
<br />
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,<br />
<br />
java -Dsun.java2d.uiScale=2 -jar some_swing_application.jar<br />
java -Dsun.java2d.uiScale=300% -jar some_swing_application.jar<br />
<br />
Since Java 9 the {{ic|GDK_SCALE}} environment variable is used to scale Swing applications accordingly.<br />
<br />
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}}.<br />
<br />
==== JavaFX ====<br />
<br />
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,<br />
<br />
java -Dglass.gtk.uiScale=200% -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=192dpi -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=2.0 -jar some_jfx_application.jar<br />
<br />
''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.<br />
<br />
==== Mixed AWT/Swing and JavaFX ====<br />
<br />
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.<br />
<br />
==== IntelliJ IDEA ====<br />
<br />
IntelliJ IDEA supports 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]:<br />
<br />
# Java property – {{ic|-Dsun.java2d.uiScale}}<br />
# {{man|1|gsettings}} – {{ic|ubuntu.user-interface/scale-factor}} or {{ic|org.gnome.desktop.interface/scaling-factor}}<br />
# {{ic|GDK_SCALE}} and {{ic|GDK_DPI_SCALE}}<br />
# [[Xresources]] – {{ic|Xft.dpi}}<br />
# 1.0<br />
<br />
For troubleshooting, consult the "Show HiDPI Info" dialog via [https://www.jetbrains.com/help/idea/searching-everywhere.html search everywhere "Shift Shift"].<br />
<br />
When using per-monitor scaling, an issue might occur where IntelliJ fails to recognize the real, original monitor resolution. <br />
To remediate this problem some people have success by adding the {{ic|1=-Dsun.java2d.uiScale.enabled=true}} option to the {{ic|idea64.vmoptions}} file (''Help > Edit custom VM options''). <br />
<br />
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.<br />
<br />
=== LibreOffice ===<br />
<br />
[[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=138520]. Use the {{ic|gtk3}} VCL backend instead. See [[LibreOffice#Theme]].<br />
<br />
=== MATLAB ===<br />
<br />
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]:<br />
<br />
>> s = settings;s.matlab.desktop.DisplayScaleFactor<br />
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2<br />
<br />
The settings take effect after MATLAB is restarted.<br />
<br />
This can become tedious if you need to change the scaling frequently. To simplify this, consider using the following script:<br />
<br />
{{hc|~/bin/matlab-scale|2=<br />
#!/bin/sh<br />
exec matlab -r "s = settings;s.matlab.desktop.DisplayScaleFactor.PersonalValue=$1;quit" -nodesktop -nosplash<br />
}}<br />
<br />
To change the display scaling to 3:<br />
<br />
$ matlab-scale 3<br />
<br />
=== Mono applications ===<br />
<br />
According to [https://bugzilla.xamarin.com/35/35870/bug.html], 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.<br />
<br />
=== NetBeans ===<br />
<br />
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]<br />
<br />
The editor fontsize can be controlled from ''Tools > Option > Fonts & Colors''.<br />
<br />
The output window fontsize can be controlled from ''Tools > Options > Miscelaneous > Output''<br />
<br />
=== OBS Studio ===<br />
<br />
OBS 29 supports HiDPI setups without any extra configuration.<br />
<br />
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.<br />
<br />
=== Skype ===<br />
<br />
Skype for Linux ({{AUR|skypeforlinux-stable-bin}} package) uses [[#GDK 3 (GTK 3)]].<br />
<br />
=== Spotify ===<br />
<br />
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:<br />
<br />
{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|2=<br />
app.browser.zoom-level=100<br />
}}<br />
<br />
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<br />
<br />
$ spotify --force-device-scale-factor=1.5<br />
<br />
=== Steam ===<br />
<br />
==== Official HiDPI support ====<br />
<br />
* Starting on 25 of January 2018 in the beta program there is actual support for HiDPI and it should be automatically detected.<br />
* ''Steam > Settings > Interface'', check "Enlarge text and icons based on monitor size" (restart required)<br />
* If it is not automatically detected, use {{ic|1=GDK_SCALE=2}} to set the desired scale factor.<br />
<br />
==== Unofficial ====<br />
<br />
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. <br />
<br />
{{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}}.}}<br />
<br />
[https://steamcommunity.com/groups/metroskin/discussions/0/517142253861033946/ MetroSkin Unofficial Patch] also helps with HiDPI on Steam with Linux.<br />
<br />
=== Sublime Text 3 ===<br />
<br />
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.<br />
<br />
=== Thunderbird ===<br />
<br />
See [[#Firefox]]. To access {{ic|about:config}}, go to ''Edit > Preferences > Advanced >Config editor''.<br />
<br />
=== VirtualBox ===<br />
<br />
{{Note|This only applies to KDE with scaling enabled.}}<br />
<br />
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]).<br />
<br />
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.<br />
<br />
$ QT_SCALE_FACTOR=0.5 VirtualBoxVM --startvm vm-name<br />
<br />
=== VMware ===<br />
<br />
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.<br />
<br />
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.<br />
<br />
For example, to get a final 2x scale factor:<br />
<br />
$ GDK_SCALE=2 GDK_DPI_SCALE=0.5 vmware<br />
<br />
=== Wine applications ===<br />
<br />
Run<br />
<br />
$ winecfg<br />
<br />
and change the "dpi" setting found in the "Graphics" tab. This only affects the font size.<br />
<br />
=== Zathura document viewer ===<br />
<br />
No modifications required for document viewing.<br />
<br />
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]):<br />
<br />
set font "monospace normal 20"<br />
<br />
=== Zoom ===<br />
<br />
Set the {{ic|scaleFactor}} variable in {{ic|~/.config/zoomus.conf}}.<br />
<br />
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.<br />
<br />
=== Gazebo ===<br />
<br />
Gazebo only renders an upper left of a view instead of the whole view. To fix this a Qt enviorment variable must be set.<br />
To run Gazebo:<br />
$ QT_SCREEN_SCALE_FACTORS=[1.0] gazebo<br />
To run a ROS simulation:<br />
$ TURTLEBOT3_MODEL=burger QT_SCREEN_SCALE_FACTORS=[1.0] roslaunch turtlebot3_gazebo turtlebot3_world.launch<br />
Making an alias such as gazebo="QT_SCREEN_SCALE_FACTORS=[1.0] gazebo" works for the first case but not for the second.<br />
<br />
=== Fcitx ===<br />
<br />
Fcitx preedit {{ic|FontSize}} can be changed in {{ic|~/.config/fcitx/conf/fcitx-classic-ui.config}}.<br />
<br />
For Fcitx5, set {{ic|Font}} with a size inside double quotes in {{ic|~/.config/fcitx5/conf/classicui.conf}}.<br />
<br />
=== Unsupported applications, via a network layer ===<br />
<br />
{{AUR|run_scaled-git}} can be used to scale applications (which uses {{Pkg|xpra}} internally).<br />
<br />
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}}.<br />
<br />
[[x11vnc]] has an experimental option {{ic|-appshare}}, which opens one viewer per application window. Perhaps something could be hacked up with that.<br />
<br />
=== Unsupported applications, via weston ===<br />
<br />
There is a no-network, potentially GPU-accelerated solution to scale old/unsupported applications via weston. The basic example goes as:<br />
<br />
weston --xwayland --socket=testscale --scale=2<br />
DISPLAY=:1 WAYLAND_DISPLAY=testscale your_app<br />
<br />
Note 1: You can make it look nicer. Create a dedicated {{ic|weston.ini}} and use it with {{ic|weston --config}}:<br />
<br />
[core]<br />
idle-time=0<br />
[shell]<br />
panel-position=none<br />
locking=false<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
<br />
== Multiple displays ==<br />
<br />
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]].<br />
<br />
=== Side display ===<br />
<br />
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:<br />
<br />
$ xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1<br />
<br />
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.<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
{{Note|1=<nowiki/><br />
* 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].<br />
* 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.}}<br />
<br />
=== Multiple external monitors ===<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 0.5x0.5 --output DP2 --right-of eDP1 --output HDMI1 --right-of DP2<br />
<br />
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.<br />
<br />
=== Mirroring ===<br />
<br />
If all you want is to mirror ("unify") displays, this is easy as well:<br />
<br />
With AxB your native HiDPI resolution (for ex 3200x1800) and CxD your external screen resolution (e.g. 1920x1200)<br />
<br />
$ xrandr --output HDMI --scale [A/C]x[B/D]<br />
<br />
In this example which is QHD (3200/1920 = 1.66 and 1800/1200 = 1.5)<br />
<br />
$ xrandr --output HDMI --scale 1.66x1.5<br />
<br />
For UHD to 1080p (3840/1920=2 2160/1080=2)<br />
<br />
$ xrandr --output HDMI --scale 2x2<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
=== Tools ===<br />
<br />
There are several tools which automate the commands described above.<br />
<br />
* [https://gist.github.com/wvengen/178642bbc8236c1bdb67 This script] extend a non-HiDPI external display above a HiDPI internal display.<br />
* [https://github.com/ashwinvis/xrandr-extend xrandr-extend].<br />
* {{AUR|xlayoutdisplay}} is a CLI front end for xrandr which detects and sets correct DPI: [https://github.com/alex-courtis/xlayoutdisplay README]<br />
<br />
== Linux console (tty) ==<br />
<br />
=== In-kernel fonts ===<br />
<br />
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.<br />
<br />
=== Fonts outside the kernel (tty) ===<br />
<br />
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.<br />
<br />
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. Using small resolutions will make the text look bigger, but also pixelated.<br />
<br />
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.<br />
<br />
=== Modern HiDPI support (kmscon) ===<br />
<br />
For real HiDPI support, see [[KMSCON]] instead of changing the font size in the tty.<br />
<br />
== See also ==<br />
<br />
* [https://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)<br />
* [https://www.eizo.com/library/basics/pixel_density_4k/ Understanding pixel density]<br />
* [http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/ Mixed DPI and the X Window System]</div>SECuREhttps://wiki.archlinux.org/index.php?title=PulseAudio/Examples&diff=692102PulseAudio/Examples2021-08-18T18:45:25Z<p>SECuRE: Fix config file path as per https://man.archlinux.org/man/pulse-client.conf.5</p>
<hr />
<div>[[Category:Sound]]<br />
[[it:PulseAudio (Italiano)/Examples]]<br />
[[ja:PulseAudio/サンプル]]<br />
[[ru:PulseAudio (Русский)/Examples]]<br />
{{Related articles start}}<br />
{{Related|PulseAudio}}<br />
{{Related|PulseAudio/Troubleshooting}}<br />
{{Related articles end}}<br />
<br />
== Set default input source ==<br />
<br />
List available input sources<br />
{{hc|$ pacmd list-sources {{!}} grep -e 'index:' -e device.string -e 'name:'|2=<br />
'' ''index: 0<br />
name: <input><br />
device.string = "hw:2"<br />
* index: 1<br />
name: <oss_input.dsp><br />
device.string = "/dev/dsp"<br />
index: 2<br />
name: <alsa_output.pci-0000_04_01.0.analog-stereo.monitor><br />
}}<br />
<br />
The {{ic|*}} in front of the index indicates the current default input.<br />
<br />
To set a system wide default, add the source name in the {{ic|default.pa}} file:<br />
{{hc|/etc/pulse/default.pa|...<br />
set-default-source ''alsa_output.pci-0000_04_01.0.analog-stereo.monitor''<br />
...}}<br />
<br />
For temporary use<br />
$ pacmd "set-default-source alsa_output.pci-0000_04_01.0.analog-stereo.monitor"<br />
<br />
{{Tip|The default source can be referred as {{ic|@DEFAULT_SOURCE@}} in commands, for example: {{ic|$ pactl set-source-mute @DEFAULT_SOURCE@ toggle}}.}}<br />
<br />
== Set the default output sink ==<br />
<br />
To list the output sinks available, type the following command:<br />
{{hc|$ pacmd list-sinks {{!}} grep -e 'name:' -e 'index:'|<br />
* index: 0<br />
name: <alsa_output.pci-0000_04_01.0.analog-stereo><br />
index: 1<br />
name: <combined>}}<br />
<br />
The {{ic|*}} in front of the index indicates the current default output.<br />
<br />
To set a system wide default, add the source name in the {{ic|default.pa}} file:<br />
{{hc|/etc/pulse/default.pa|...<br />
set-default-sink ''alsa_output.pci-0000_04_01.0.analog-stereo''<br />
...}}<br />
<br />
When done then you can logout/login or restart PulseAudio manually for these changes to take effect.<br />
<br />
{{Note|1=<nowiki></nowiki><br />
* The numbering of sinks is not guaranteed to be persistent, so all sinks in the {{ic|default.pa}} file should be identified by the name.<br />
* For quick identification at runtime (e.g. to manage sound volume), you can use the sink index instead of the sink name: {{bc|<nowiki><br />
$ pactl set-sink-volume 0 +3%<br />
$ pactl set-sink-volume 0 -3%<br />
$ pactl set-sink-mute 0 toggle<br />
</nowiki>}}<br />
* To avoid unnecessary overriding of 100% normal volume it is better to use alternative utilities for managing of sound. See the [https://bbs.archlinux.org/viewtopic.php?id=124513 forum thread] for more information.}}<br />
<br />
{{Tip|The default sink can be referred as {{ic|@DEFAULT_SINK@}} in commands, for example: {{ic|$ pactl set-sink-volume @DEFAULT_SINK@ +5%}}.}}<br />
<br />
== Set the default output sink profile ==<br />
<br />
Sometimes PulseAudio neglects to load the desired profile on start (e.g. a profile for having [[#Independent analog and digital outputs on the same card]]). To change the default profile, append the following to {{ic|default.pa}}:<br />
<br />
{{hc|/etc/pulse/default.pa|...<br />
set-card-profile <symbolic-name> <profilename>}}<br />
<br />
{{Note|<br />
You could also use {{ic|<cardindex>}} instead of {{ic|<symbolic-name>}}, but using {{ic|<symbolic-name>}} ensures referencing the correct device. {{ic|<cardindex>}} is dynamic, and changes when a new device is plugged in.<br />
}}<br />
<br />
Find {{ic|<symbolic-name>}} by running {{ic|pacmd list-cards}}:<br />
<br />
{{bc|$ pacmd list-cards<br />
3 card(s) available.<br />
index: 0<br />
name: <alsa_card.pci-0000_01_00.1><br />
driver: <module-alsa-card.c><br />
owner module: 6<br />
(...)<br />
<br />
index: 1<br />
name: <alsa_card.usb-Sony_Interactive_Entertainment_Wireless_Controller-00><br />
driver: <module-alsa-card.c><br />
owner module: 7<br />
(...)<br />
<br />
index: 2<br />
name: <alsa_card.pci-0000_00_14.2><br />
driver: <module-alsa-card.c><br />
owner module: 8<br />
(...)}}<br />
<br />
In this case, I want to use the device with index number 2, so {{ic|<symbolic-name>}} should be {{ic|alsa_card.pci-0000_00_14.2}}.<br />
<br />
To find {{ic|<profilename>}}, set the desired profile manually, then run {{ic|pacmd list-cards | grep 'active profile'}}:<br />
<br />
{{bc|<nowiki>$ pacmd list-cards | grep 'active profile'</nowiki><br />
active profile: <off><br />
active profile: <off><br />
active profile: <output:analog-stereo+output:iec958-stereo+input:analog-stereo>}}<br />
<br />
In this case, {{ic|default.pa}} should now be changed to this:<br />
{{hc|/etc/pulse/default.pa|...<br />
set-card-profile alsa_card.pci-0000_00_14.2 output:analog-stereo+output:iec958-stereo+input:analog-stereo}}<br />
<br />
You can test your configuration by running {{ic|pactl set-card-profile <symbolic-name> <profilename>}}.<br />
<br />
== Independent analog and digital outputs on the same card ==<br />
<br />
{{Out of date|{{ic|/usr/share/pulseaudio/alsa-mixer/paths}} has been replaced by {{ic|/usr/share/alsa-card-profile/mixer/paths}}|section=Having both speakers and headphones plugged in and switching in software on-the-fly}}<br />
Sound cards may have both analog and digital (iec958) outputs. Pulseaudio does not generate combined profiles by default, you can choose either digital or analog profiles.<br />
<br />
The easiest way to make both outputs available is to add a combined profile to the end of default profile configuration file:<br />
<br />
{{hc|/usr/share/pulseaudio/alsa-mixer/profile-sets/default.conf|...<br />
<nowiki><br />
# Profile must be a '+' separated list of relevant mappings configured above<br />
[Profile output:analog-stereo+output:iec958-stereo+input:analog-stereo]<br />
# Human readable description<br />
description = Analog and digital stereo output and analog stereo intput<br />
output-mappings = analog-stereo iec958-stereo<br />
input-mappings = analog-stereo<br />
</nowiki>}}<br />
<br />
This way a defined profile is added to the end of the list of available profiles.<br />
<br />
Although this works, pulseaudio has a nasty habit of falling back to auto-generated profiles, so you may eventually need to set your card back to the combined profile. The best way to overcome this is by writing a custom config with disabled {{ic|auto-profiles}}. Copy {{ic|default.conf}} to {{ic|custom-profile.conf}}, and edit it to suit your needs (this example is for stereo output/input):<br />
<br />
{{hc|/usr/share/pulseaudio/alsa-mixer/profile-sets/custom-profile.conf|<br />
<nowiki><br />
[General]<br />
auto-profiles = no # disable profile auto-generation<br />
# Leave only relevant mappings:<br />
[Mapping analog-stereo]<br />
device-strings = front:%f<br />
channel-map = left,right<br />
paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2<br />
paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic<br />
priority = 15<br />
<br />
[Mapping iec958-stereo]<br />
device-strings = iec958:%f<br />
channel-map = left,right<br />
paths-input = iec958-stereo-input<br />
paths-output = iec958-stereo-output<br />
priority = 5<br />
<br />
[Profile output:analog-stereo+output:iec958-stereo+input:analog-stereo]<br />
description = Analog and digital stereo output and analog stereo intput<br />
output-mappings = analog-stereo iec958-stereo<br />
input-mappings = analog-stereo<br />
skip-probe=yes # since you know what your sound card has, there is no need for checking which sinks are available<br />
</nowiki>}}<br />
<br />
Now that you have your custom profile you need to tell pulseaudio to use it. This can be done by defining an [[Udev#About udev rules|udev rule]]:<br />
<br />
First get relevant information about your sound card:<br />
<br />
{{bc|$ pactl list cards<br />
<nowiki><br />
Card #0<br />
Name: alsa_card.pci-0000_00_1b.0<br />
--- snip ----<br />
Properties:<br />
--- snip ---<br />
device.vendor.id = "8086" # This is a 'vendor' attribute for udev rule<br />
device.product.id = "1c20" # This is a 'device' attribute for udev rule</nowiki>}}<br />
<br />
Now create a config file:<br />
<br />
{{hc|/usr/lib/udev/rules.d/91-pulseaudio-custom.rules|<br />
<nowiki><br />
SUBSYSTEM!="sound", GOTO="pulseaudio_end"<br />
ACTION!="change", GOTO="pulseaudio_end"<br />
KERNEL!="card*", GOTO="pulseaudio_end"<br />
<br />
SUBSYSTEMS=="pci", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x1c20", ENV{PULSE_PROFILE_SET}="custom-profile.conf"<br />
<br />
LABEL="pulseaudio_end"<br />
</nowiki>}}<br />
<br />
Now tell udev to reload sound subsystem {{ic|udevadm trigger -ssound}} (as the root user) and restart pulseaudio. Your sound card should now use only the defined profile and have both analog and digital outputs available.<br />
<br />
== Simultaneous HDMI and analog output ==<br />
<br />
PulseAudio allows for simultaneous output to multiple sources. In this example, some applications are configured to use HDMI while others are configured to use analog. Multiple applications are able to receive audio at the same time. ({{ic|aplay}} is from the {{Pkg|alsa-utils}} package.)<br />
{{bc|$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: ALC889A Analog [ALC889A Analog]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: ALC889A Digital [ALC889A Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 3: HDMI 0 [HDMI 0]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0}}<br />
<br />
Or by using the the {{ic|pacmd}} command: <br />
<br />
{{hc|<nowiki>$ pacmd list-sinks | grep -e 'name:' -e 'alsa.device ' -e 'alsa.subdevice '</nowiki>|<nowiki><br />
name: <alsa_output.pci-0000_00_1b.0.analog-stereo><br />
alsa.subdevice = "0"<br />
alsa.device = "0"</nowiki>}}<br />
<br />
The key to a configuration like this is to understand that whatever is selected in pavucontrol under ''Configuration > Internal Audio'' is the default device. Load ''pavucontrol > Configuration'' and select HDMI as the profile. <br />
<br />
To setup the analog device as a secondary source, add the following to the {{ic|/etc/pulse/default.pa}} configuration at the beginning, before any other modules are loaded: <br />
<br />
### Load analog device<br />
load-module module-alsa-sink device=hw:0,0<br />
load-module module-combine-sink sink_name=combined<br />
set-default-sink combined<br />
<br />
Restart PulseAudio, run ''pavucontrol'' and select the "Output Devices" tab. Three settings should be displayed:<br />
# Internal Audio Digital Stereo (HDMI)<br />
# Internal Audio<br />
# Simultaneous output to Internal Audio Digital Stereo (HDMI), Internal Audio<br />
<br />
Now start a program that will use PulseAudio such as MPlayer, VLC, mpd, etc. and switch to the "Playback" tab. A drop-down list should be available for the running program to select one of the three sources.<br />
<br />
Also see [https://bbs.archlinux.org/viewtopic.php?id=118026 this thread] for a variation on this theme and [https://www.freedesktop.org/wiki/Software/PulseAudio/FAQ#Can_I_use_PulseAudio_to_playback_music_on_two_sound_cards_simultaneously.3F PulseAudio FAQ].<br />
<br />
=== Alternative solution using module-loopback with delay compensation ===<br />
<br />
If the example above does not work for you, for instance because of echos / delays, you can try the following configuration.<br />
<br />
In this case, the HDMI-Audio was 65ms behind analog when using module-combine-sink.<br />
<br />
{{hc|1=/etc/pulse/default.pa|2=<br />
[...]<br />
load-module module-alsa-sink device=hw:0,0 sink_name=analog sink_properties=device.description=analog<br />
load-module module-alsa-sink device=hw:0,1 sink_name=digital sink_properties=device.description=digital<br />
load-module module-alsa-sink device=hw:0,3 sink_name=hdmi sink_properties=device.description=hdmi<br />
load-module module-loopback sink=analog latency_msec=65<br />
[...]<br />
set-default-sink hdmi<br />
}}<br />
<br />
== HDMI output configuration ==<br />
<br />
As outlined in https://download.nvidia.com/XFree86/gpu-hdmi-audio-document/index.html#_issues_in_pulseaudio unless the HDMI port is the first<br />
output, PulseAudio will not be able to have any audio when using certain graphics cards with HDMI audio support. This is because of a bug in PulseAudio where it will only select the first HDMI output on a device. A work around posted further down is to first find which HDMI output is working by using the {{ic|aplay}} utility from ALSA (in {{Pkg|alsa-utils}}).<br />
<br />
The original title for this section indicated the problem is specific to nVidia cards. As seen in [https://bbs.archlinux.org/viewtopic.php?id=133222 this forum thread] other cards are affected as well. The rest of the section will use an nVidia card as a case-study but the solution should carry over for people using other affected cards.<br />
<br />
=== Finding HDMI output ===<br />
<br />
Then find the working output by listing the available cards<br />
# aplay -l<br />
<br />
sample output:<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: NVidia_1 [HDA NVidia], device 3: HDMI 0 [HDMI 0]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: NVidia_1 [HDA NVidia], device 7: HDMI 0 [HDMI 0]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
card 1: NVidia_1 [HDA NVidia], device 8: HDMI 0 [HDMI 0]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: NVidia_1 [HDA NVidia], device 9: HDMI 0 [HDMI 0]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
In case your HDMI port is wired to the NVIDIA card, but {{ic|aplay}} does not detect an NVIDIA audio card, follow [[NVIDIA/Troubleshooting#No audio over HDMI]].<br />
<br />
=== Testing for the correct card ===<br />
<br />
Now that we have a list of detected cards and devices, users will need to test for which one is outputting to the TV/monitor; for example, to test card '''1''', device '''3''' from the list above:<br />
# aplay -D plughw:1,3 /usr/share/sounds/alsa/Front_Right.wav<br />
<br />
If there is no audio, then try substituting a different card and/or device number (on my card I had to use card 1 device 7)<br />
<br />
=== Manually configuring PulseAudio to detect the Nvidia HDMI ===<br />
<br />
Having identified which HDMI device is working, PulseAudio can be forced to use it via an edit to {{ic|/etc/pulse/default.pa}}:<br />
# load-module module-alsa-sink device=hw:1,7<br />
<br />
where the 1 is the card and the 7 is the device found to work in the previous section. Place this towards the bottom of the file, so that other sinks may still be auto-detected.<br />
<br />
Restart PulseAudio:<br />
$ pulseaudio -k<br />
$ pulseaudio --start<br />
<br />
Open the sound settings manager, make sure that under the hardware tab the graphics cards HDMI audio is set to "Digital Stereo (HDMI) Output" (My graphics card audio is called "GF100 High Definition Audio Controller").<br />
<br />
Then, open the output tab. There should now be two HDMI outputs for the graphics card. Test which one works by selecting one of them, and then using a program to play audio. For example, use VLC to play a movie, and if it does not work, then select the other.<br />
<br />
=== Automatically switch audio to HDMI ===<br />
<br />
Create a script to switch to the desired audio profile if an HDMI cable is plugged in:<br />
<br />
{{hc|/usr/local/bin/hdmi_sound_toggle.sh|2=<nowiki><br />
#!/bin/bash<br />
<br />
export PATH=/usr/bin<br />
<br />
USER_NAME=$(who | awk -v vt=tty$(fgconsole) '$0 ~ vt {print $1}')<br />
USER_ID=$(id -u "$USER_NAME")<br />
CARD_PATH="/sys/class/drm/card0/"<br />
AUDIO_OUTPUT="analog-surround-40"<br />
PULSE_SERVER="unix:/run/user/"$USER_ID"/pulse/native"<br />
<br />
for OUTPUT in $(cd "$CARD_PATH" && echo card*); do<br />
OUT_STATUS=$(<"$CARD_PATH"/"$OUTPUT"/status)<br />
if [[ $OUT_STATUS == connected ]]<br />
then<br />
echo $OUTPUT connected<br />
case "$OUTPUT" in<br />
"card0-HDMI-A-1")<br />
AUDIO_OUTPUT="hdmi-stereo" # Digital Stereo (HDMI 1)<br />
;;<br />
"card0-HDMI-A-2")<br />
AUDIO_OUTPUT="hdmi-stereo-extra1" # Digital Stereo (HDMI 2)<br />
;;<br />
esac<br />
fi<br />
done<br />
echo selecting output $AUDIO_OUTPUT<br />
sudo -u "$USER_NAME" pactl --server "$PULSE_SERVER" set-card-profile 0 output:$AUDIO_OUTPUT+input:analog-stereo<br />
</nowiki>}}<br />
<br />
Make the script executable:<br />
<br />
chmod +x /usr/local/bin/hdmi_sound_toggle.sh<br />
<br />
Create a [[udev]] rule to run this script when the status of the HDMI change:<br />
<br />
{{hc|/etc/udev/rules.d/99-hdmi_sound.rules|2=<br />
KERNEL=="card0", SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/hdmi_sound_toggle.sh"<br />
}}<br />
<br />
To make the change effective do not forget to reload the udev rules:<br />
udevadm control --reload-rules<br />
<br />
A reboot might be required.<br />
<br />
== Surround sound systems ==<br />
<br />
Many people have a surround sound card, but have speakers for just two channels, so PulseAudio cannot really default to a surround sound setup. To enable all of the channels, edit {{ic|/etc/pulse/daemon.conf}}: uncomment the default-sample-channels line (i.e. remove the semicolon from the beginning of the line) and set the value to '''6'''. For a ''5.1'' setup, or '''8''' for a ''7.1'' setup etc.<br />
# Default<br />
default-sample-channels=2<br />
# For 5.1<br />
default-sample-channels=6<br />
# For 7.1<br />
default-sample-channels=8<br />
<br />
If your channels are not correclty mapped or the volume controls for the individual channels do not work as expected in pavucontrol, and you have a HDMI and an analog soundcard, then try to add the following line to {{ic|/etc/pulse/default.pa}}<br />
<br />
load-module module-combine channels=6 channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe<br />
<br />
Note that this example is for a 5.1 setup.<br />
<br />
After doing the edit, restart PulseAudio.<br />
<br />
=== Splitting front/rear ===<br />
<br />
Connect speakers to front analog output and headphones to rear output. It would be useful to split front/rear to separate sinks. Add to {{ic|/etc/pulse/default.pa}}:<br />
<br />
load-module module-remap-sink sink_name=speakers sink_properties="device.description='Speakers'" remix=no master=alsa_output.pci-0000_05_00.0.analog-surround-40 channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right<br />
load-module module-remap-sink sink_name=headphones sink_properties="device.description='Headphones'" remix=no master=alsa_output.pci-0000_05_00.0.analog-surround-40 channels=2 master_channel_map=rear-left,rear-right channel_map=front-left,front-right<br />
Make sure to replace alsa_output.pci-0000_05_00.0.analog-surround-40 with the sound card name shown in 'pacmd list-sinks'.<br />
Now you have 2 additional sinks which can be used separately. You can choose 'sink_name' freely, as long as there is no sink with that name already. The 'remix' parameter controls whether the audio should be down-/upmixed to match the channels in the sink.<br />
<br />
{{Tip|If pulseaudio fails with {{ic|master sink not found}}, comment out the remapping lines, start PulseAudio and verify your card output is set to the one you specified (e.g. analog surround 4.0). Alternatively, try using a [[#Set the default output sink|sink index]] instead of a sink name.}}<br />
<br />
=== Splitting 7.1 into 5.1+2.0 ===<br />
<br />
Similar to the example above, you can also split a 7.1 configuration into 5.1 surround and stereo output devices.<br />
Set your card to 7.1 mode, then add the following lines to {{ic|/etc/pulse/default.pa}}:<br />
load-module module-remap-sink sink_name=Surround sink_properties="device.description='Surround'" remix=no master=alsa_output.pci-0000_00_14.2.analog-surround-71 channels=6 master_channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe<br />
load-module module-remap-sink sink_name=Stereo sink_properties="device.description='Stereo'" remix=no master=alsa_output.pci-0000_00_14.2.analog-surround-71 channels=2 master_channel_map=side-left,side-right channel_map=front-left,front-right<br />
<br />
Make sure to replace alsa_output.pci-0000_00_14.2 with your sound card name, get it by running 'pacmd list-sinks'.<br />
This configuration will use the front/rear/center+lfe (green/black/orange) jacks for the 5.1 sink and the side (grey) jack for the stereo sink.<br />
It will also downmix any audio to stereo for the stereo sink, but will not touch the 5.1 output.<br />
<br />
{{Tip|If pulseaudio fails with {{ic|master sink not found}}, comment out the remapping lines, start PulseAudio and verify your card output is set to analog surround 7.1. Alternatively, try using a [[#Set the default output sink|sink index]] instead of a sink name.}}<br />
<br />
=== Disabling LFE remixing ===<br />
<br />
By default, PulseAudio remixes the number of channels to the default-sample-channels and since version 7 it also remixes the LFE channel. If you wish to disable LFE remixing, uncomment the line:<br />
<br />
; enable-lfe-remixing = yes<br />
<br />
and replace yes with no:<br />
<br />
enable-lfe-remixing = no<br />
<br />
then restart Pulseaudio.<br />
<br />
=== Binaural Headphones ===<br />
<br />
{{AUR|ladspa-bs2b}} provides a plugin to simulate surround sound on stereo headphones. To use it, find your headphones with:<br />
{{hc|<nowiki>$ pacmd list-sinks | grep -e 'name:'</nowiki>|<br />
name: <alsa_output.pci-0000_00_1b.0.iec958-ac3-surround-51><br />
name: <alsa_output.pci-0000_00_1b.0.iec958-ac3-surround-51.equalizer><br />
name: <bluez_sink.00_1F_82_28_93_51><br />
}}<br />
Load the plugin (''new'' sink_name is up to you, master=''headphone's sink name''):<br />
pacmd load-module module-ladspa-sink sink_name=binaural master=bluez_sink.00_1F_82_28_93_51 plugin=bs2b label=bs2b control=700,4.5<br />
Use {{Pkg|pavucontrol}} to transfer streams to the new sink, or:<br />
pactl move-sink-input $INPUTID $BINAURALSINKNAME<br />
<br />
== PulseAudio over network ==<br />
<br />
One of PulseAudio's unique features is its ability to stream audio from clients over TCP to a server running the PulseAudio daemon reliably within a LAN. Ensure that client and server systems agree on the time (i.e., use NTP), or audio streams may be choppy or may not work at all. For a more detailed guide visit the [https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Network/ Official PulseAudio Documentation]<br />
<br />
Enable the TCP module on the server(the computer that actually outputs sound), edit {{ic|/etc/pulse/default.pa}} to add or uncomment:<br />
load-module module-native-protocol-tcp<br />
<br />
Or you can use the {{ic|paprefs}} gui application (root is not required):<br />
Go to Network Server -> Enable network access to local sound devices<br />
<br />
To make sure module-native-protocol-tcp is loaded on the server, you can use:<br />
pacmd list-modules | grep module-native-protocol-tcp<br />
<br />
It is a requirement that both the client and server share the same cookie. Ensure that the clients and server share the same cookie file found under {{ic|~/.config/pulse/cookie}}. It does not matter whose cookie file you use (the server or a client's), just that the server and client(s) share the same one.<br />
<br />
If it is undesirable to copy the cookie file from clients, anonymous clients can access the server by passing {{ic|auth-anonymous}} to {{ic|module-native-protocol-tcp}} on the server (again in {{ic|/etc/pulse/default.pa}}):<br />
<br />
load-module module-native-protocol-tcp auth-anonymous=1<br />
<br />
It is also possible to authenticate based on client IP address:<br />
<br />
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24<br />
<br />
Change the LAN IP subnet to match that of those clients you wish to have access to the server.<br />
<br />
=== Selecting the Server ===<br />
<br />
For a single shell or command you can set the environment variable {{ic|$PULSE_SERVER}} to the host name or IP address of the desired PulseAudio server.<br />
$ env PULSE_SERVER=<i>server-hostname-or-ip</i> mplayer test.mp3<br />
Alternatively you can create or modify {{ic|~/.config/pulse/client.conf}} or {{ic|/etc/pulse/client.conf}} to set a default-server persistently.<br />
default-server = <i>server-hostname-or-ip</i><br />
<br />
=== Selecting the Server with Zeroconf ===<br />
<br />
{{note|This section is known to be unreliable for some people.}}<br />
For the remote PulseAudio server to appear in the PulseAudio Device Chooser ({{ic|pasystray}}), load the appropriate zeroconf modules, and enable the [[Avahi]] [[daemon]]. On both machines, the client and server, [[install]] {{Pkg|pulseaudio-zeroconf}} then [[start]] and [[enable]] {{ic|avahi-daemon.service}}.<br />
<br />
On the server, add {{ic|load-module module-zeroconf-publish}} to {{ic|/etc/pulse/default.pa}}. <br />
On the client, add {{ic|load-module module-zeroconf-discover}} to {{ic|/etc/pulse/default.pa}}. Now redirect any stream or complete audio output to the remote PulseAudio server by selecting the appropriate sink.<br />
<br />
If you have issues with the remote syncs appearing on the client, try restarting the Avahi daemon on the server to rebroadcast the available interfaces.<br />
<br />
Run the graphical PulseAudio Volume Control {{ic|pavucontrol}}. Under the '''Output Devices''' tab, you should see the local and remote output devices. Under the '''Playback''' tab, to the left of the "X" Mute Audio button, you should see a box containing the name of an output device. That box is ''actually a button'', which will display a drop-down radio-button list of the available output devices, with one output device selected. Selecting an output device from the list will allow the audio stream to be switched to the PulseAudio server associated with that output device. This control is not at all obvious until you have used it, and is especially useful with a remote Headless sound server.<br />
<br />
Similarly, under the '''Input Devices''' tab, local and remote input devices will be seen. And under the '''Recording''' tab, there will be a box, to the left of the "X" Mute Audio button, with the name of an input device which is actually a button which will display a drop-down radio-button list of available input devices.<br />
<br />
Run {{ic|pavucontrol}} on the local or remote host associated with the audio stream to be directed. For instance, run {{ic|pavucontrol}} on the remote host to direct the remote audio output to the local host. Run {{ic|pavucontrol}} on the local host to direct the local audio output to some remote host.<br />
<br />
Setting up simultaneous inputs or outputs is a different thing. Search about "monitor" and "module-combine-sink" for that.<br />
<br />
=== Switching the PulseAudio server used by local X clients ===<br />
<br />
To switch between servers on the client from within X, the {{ic|pax11publish}} command can be used. For example, to switch from the default server to the server at hostname foo:<br />
$ pax11publish -e -S foo<br />
<br />
Or to switch back to the default:<br />
$ pax11publish -e -r<br />
<br />
Instead of telling the PulseAudio server to stream audio (as described above), this will edit PulseAudio variables on the X11 root window, which will instruct the PulseAudio client libraries to connect to a PulseAudio server other than {{ic|localhost}}. As such, the programs will no longer interact with the local {{ic|pulseaudio}} process, which can then be [[stop]]ped. Programs such as {{ic|pactl}}, {{ic|pacmd}} or {{ic|pavucontrol}} will need to also run with the appropriate {{ic|PULSE_SERVER}} environment/X variable to control the remote PulseAudio server.<br />
<br />
Note that for the switch to become apparent, the programs using Pulse must be restarted, or their PulseAudio client library otherwise reinitialized (completely stopping and restarting playback may be enough). To make this setting permanent, edit {{ic|default-server}} in {{ic|~/.config/pulse/client.conf}} or {{ic|/etc/pulse/client.conf}}.<br />
<br />
=== When everything else seems to fail ===<br />
<br />
The following is a quick fix and NOT a permanent solution<br />
<br />
On the server:<br />
$ paprefs <br />
Go to Network Access -> Enable access to local sound devices (Also check both 'Allow discover' and 'Don't require authentication').<br />
<br />
On the client:<br />
$ export PULSE_SERVER=server.ip && mplayer test.mp3<br />
<br />
=== Using RTP/UDP instead of native-protocol-tcp ===<br />
<br />
There are serious issues with trying to send data in real time over TCP, especially over lossy connections like wifi. This is why [[Wikipedia:Real-time Transport Protocol|RTP over UDP]] was invented. It can be used to increase reliability and reduce latency.<br />
<br />
When RTP is working properly, late or dropped packets will just create a few milliseconds of silence instead of a long pause while TCP is orchestrating the packet resend logistics. As an added bonus, if the remote server is ever restarted, the connection will be re-established automatically.<br />
<br />
To use RTP instead of {{ic|native-protocol-tcp}}, pulseaudio clients must connect to a local pulseaudio server first. This local server then connects to the remote pulseaudio server through RTP.<br />
<br />
To use RTP in pulseaudio on archlinux, install {{pkg|pulseaudio-rtp}} on the remote and local servers.<br />
<br />
To configure the remote pulseaudio server, add the following to {{ic|/etc/pulse/default.pa}} (or to {{ic|/etc/pulse/system.pa}} if running pulseaudio in {{ic|--system}} mode):<br />
<br />
load-module module-rtp-recv latency_msec=10 sap_address=0.0.0.0<br />
<br />
{{ic|1=sap_address=0.0.0.0}} is important to prevent pulseaudio from trying to use multicast, which [https://tools.ietf.org/id/draft-mcbride-mboned-wifi-mcast-problem-statement-01.html#rfc.section.1 doesn't work at all over wifi]. Use {{ic|latency_msec}} to tune the receiving buffer size on the remote end. If you find the audio is spotty, try increasing this number. If you care more about latency, try decreasing it. Restart the remote server to cause the changes to take effect.<br />
<br />
To configure the local pulseaudio server, add the following to {{ic|/etc/pulse/default.pa}}:<br />
<br />
load-module module-null-sink sink_name=rtp sink_properties="device.description='RTP'"<br />
load-module module-rtp-send source=rtp.monitor destination_ip=<remote host><br />
<br />
{{ic|<remote host>}} is the host name of the remote pulseaudio server.<br />
<br />
After restarting the local server, a new sink labelled "RTP" will appear in pavucontrol. To route a particular client's output to it, find the client under the "Playback" tab, then change the client from its current sink (e.g. "Built-in Audio Analog Stereo") to "RTP". To use the RTP sink by default for all clients, add this to {{ic|/etc/pulse/default.pa}}, then restart the local pulseaudio server:<br />
<br />
set-default-sink rtp<br />
<br />
== ALSA monitor source ==<br />
<br />
To be able to record from a monitor source (a.k.a. "What-U-Hear", "Stereo Mix"), use {{ic|pactl list}} to find out the name of the source in PulseAudio (e.g. {{ic|alsa_output.pci-0000_00_1b.0.analog-stereo.monitor}}). Then add lines like the following to {{ic|/etc/asound.conf}} or {{ic|~/.asoundrc}}:<br />
pcm.pulse_monitor {<br />
type pulse<br />
device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor<br />
}<br />
<br />
ctl.pulse_monitor {<br />
type pulse<br />
device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor<br />
}<br />
<br />
Now you can select {{ic|pulse_monitor}} as a recording source.<br />
<br />
Alternatively, you can use pavucontrol to do this: make sure you have set up the display to "All input devices", then select "Monitor of [your sound card]" as the recording source.<br />
<br />
== Monitor specific output ==<br />
<br />
It is possible to monitor a specific output, for example to stream audio from a music player into a VOIP application.<br />
Simply create a null output device:<br />
<br />
pactl load-module module-null-sink sink_name=<name><br />
<br />
In Pulseaudio Volume Control (pavucontrol), under the "Playback" tab, change the output of an application to <name>, and in the recording tab change the input of an application to "Monitor of <name>". Audio will now be outputted from one application into the other.<br />
<br />
== PulseAudio through JACK ==<br />
<br />
The [[JACK Audio Connection Kit]] is popular for audio work, and is widely supported by Linux audio applications. It fills a similar niche as PulseAudio, but with more of an emphasis on professional audio work. It can offer lower latency audio monitoring along with greater control of input and output of multi-i/o sound devices.<br />
<br />
=== The KXStudio method ===<br />
<br />
This configuration requires the {{Pkg|jack2}} package.<br />
<br />
JACK now has native features for bridging between ALSA, PulseAudio, and JACK. This will allow you to simultaneously have JACK and PulseAudio running with both outputting at the same time, with no config editing or terminal commands required.<br />
<br />
If you have {{Pkg|qjackctl}} installed, make sure that it is not running (it might be running minified in the system tray). Also ensure that no {{ic|jackd}} process is running (use {{ic|ps xw | grep jackd}} in a terminal to check).<br />
<br />
Install {{Pkg|cadence}}, as well as {{Pkg|pulseaudio-jack}}. Once installed and started, JACK bridge configuration is found in the bottom right of the window. The ALSA audio bridge should be set to ALSA -> PulseAudio -> JACK, and the PulseAudio bridge should be enabled. Make sure in {{ic|pavucontrol}} that all output devices besides Jack sink are muted, and all input devices besides Jack input are muted. Start JACK using the Force Restart button, and if it starts successfully PulseAudio programs should begin outputting to JACK.<br />
<br />
=== The manual sink configuration method ===<br />
<br />
This configuration provides a method of allowing JACK and PulseAudio to run at the same time and output to each other. It uses manual configuration of the systems that bridge between JACK and PulseAudio. This configuration has no reliance on scripts or commands and is entirely based in configuration.<br />
<br />
This configuration only works with jack2. To use this configuration, just install the {{Pkg|pulseaudio-jack}} package. {{ic|/etc/pulse/default.pa}} is already configured to load the modules in {{Pkg|pulseaudio-jack}} if they are present. If you want to be sure, open the file and look for the line:<br />
load-module module-jackdbus-detect ''options''<br />
Where {{ic|''options''}} can be any options supported by this module, usually {{ic|1=channels=2}}.<br />
<br />
As described on the [https://github.com/jackaudio/jackaudio.github.com/wiki/JackDbusPackaging Jack-DBUS Packaging] page:<br />
<br />
''Server auto-launching is implemented as D-Bus call that auto-activates JACK D-Bus service, in case it is not already started, and starts the JACK server. Correct interaction with PulseAudio is done using a D-Bus based audio card "acquire/release" mechanism. When JACK server starts, it asks this D-Bus service to acquire the audio card and PulseAudio will unconditionally release it. When JACK server stops, it releases the audio card that can be grabbed again by PulseAudio.''<br />
<br />
{{ic|module-jackdbus-detect.so}} dynamically loads and unloads module-jack-sink and module-jack-source when jackdbus is started and stopped.<br />
<br />
If PulseAudio sound does not work, check with {{ic|pavucontrol}} to see if the relevant programs appear in the playback tab. If not, add the following to {{ic|~/.asoundrc}} or {{ic|/etc/asound.conf}} to redirect ALSA to PulseAudio:<br />
<br />
pcm.pulse {<br />
type pulse<br />
}<br />
<br />
ctl.pulse {<br />
type pulse<br />
}<br />
<br />
pcm.!default {<br />
type pulse<br />
}<br />
ctl.!default {<br />
type pulse<br />
}<br />
<br />
If it still does not work, check with {{ic|pavucontrol}} in the playback tab and make sure the relevant programs are outputting to PulseAudio JACK Sink instead of your audio card (which JACK has control of, so it will not work). Also ensure that in the JACK graph the PulseAudio JACK Source is connected to the system audio output.<br />
<br />
=== The shell script method ===<br />
<br />
This method allows JACK and PulseAudio to output at the same time. It mostly relies on shell scripts that are automatically run by QJackCTL to manage aspects of how the JACK sinks and PulseAudio behave.<br />
<br />
The basic idea is that killing PulseAudio is a bad idea because it may crash any apps using PulseAudio and disrupt any audio playing.<br />
<br />
The flow of how this setup works:<br />
<br />
# PulseAudio releases the sound card<br />
# JACK grabs sound card and starts up<br />
# script redirects PulseAudio to JACK<br />
# manually send PulseAudio apps to JACK output (pavucontrol may come in helpful for this)<br />
# use JACK programs etc<br />
# via script, stop redirecting PulseAudio to JACK<br />
# stop JACK and release sound card<br />
# PulseAudio grabs sound card and reroutes audio to it directly<br />
<br />
With QJackCTL, set up these scripts:<br />
<br />
{{ic|pulse-jack-pre-start.sh}} set it up as the execute script on startup script<br />
#!/bin/bash<br />
pacmd suspend true<br />
<br />
{{ic|pulse-jack-post-start.sh}} set this one up as execute script after startup<br />
#!/bin/bash<br />
pactl load-module module-jack-sink channels=2<br />
pactl load-module module-jack-source channels=2<br />
pacmd set-default-sink jack_out<br />
pacmd set-default-source jack_in<br />
<br />
{{ic|pulse-jack-pre-stop.sh}} "execute script on shutdown"<br />
#!/bin/bash<br />
SINKID=$(LANG=C pactl list | grep -B 1 "Name: module-jack-sink" | grep Module | sed 's/[^0-9]//g')<br />
SOURCEID=$(LANG=C pactl list | grep -B 1 "Name: module-jack-source" | grep Module | sed 's/[^0-9]//g')<br />
pactl unload-module $SINKID<br />
pactl unload-module $SOURCEID<br />
sleep 5<br />
<br />
{{ic|pulse-jack-post-stop.sh}} "execute script after shutdown"<br />
#!/bin/bash<br />
pacmd suspend false<br />
<br />
=== The PulseAudio kill method ===<br />
<br />
This method relies on shell scripts to automatically kill PulseAudio when JACK is started, and automatically restart it when JACK is stopped. This will result in lower CPU usage than having both running, but can cause errors in already running PulseAudio application and does not allow simultaneous output of both.<br />
<br />
Using the settings listed above, use QjackCtl to execute a script upon startup and shutdown to load/unload PulseAudio. Part of the reason users may wish to do this is that the above changes disable PulseAudio's automatic hardware detection modules. This particular setup is for using PulseAudio in an exclusive fashion with JACK, though the scripts could be modified to unload and load an alternate non-JACK setup, but killing and starting PulseAudio while programs might be using it would become problematic.<br />
<br />
{{Note|padevchooser in the following example is deprecated. It is replaced by pasystray}}<br />
<br />
The following example could be used and modified as necessary as a startup script that daemonizes PulseAudio and loads the ''padevchooser'' program (optional, needs to be built from AUR) called {{ic|jack_startup}}: <br />
#!/bin/bash <br />
#Load PulseAudio and PulseAudio Device Chooser<br />
pulseaudio -D<br />
padevchooser&<br />
<br />
as well as a shutdown script to kill PulseAudio and the Pulse Audio Device Chooser, as another example called {{ic|jack_shutdown}} also in the home directory: <br />
#!/bin/bash <br />
#Kill PulseAudio and PulseAudio Device Chooser <br />
pulseaudio --kill <br />
killall padevchooser <br />
<br />
Both scripts need to be made executable: <br />
chmod +x jack_startup jack_shutdown<br />
<br />
then with QjackCtl loaded, click on the ''Setup'' button and then the ''Options'' tab and tick both "Execute Script after Startup:" And "Execute Script on Shutdown:" and put either use the ... button or type the path to the scripts (assuming the scripts are in the home directory) {{ic|~/jack_startup}} and {{ic|~/jack_shutdown}} making sure to save the changes.<br />
<br />
== PulseAudio through JACK issues ==<br />
<br />
=== When JACK is started Firefox, Chrome and other apps stop playing video and audio ===<br />
<br />
Firefox/Chrome/etc. is using PulseAudio soundcard sink instead of the JACK sink. Open {{ic|pavucontrol}} and on the ''Playback'' tab switch all audiostreams from something like "Built-in Audio Analog Stereo" to something like "Jack sink (PulseAudio JACK Sink)".<br />
<br />
=== After I start JACK the sound from PulseAudio becomes distorted ===<br />
<br />
In QjackCtl click ''Setup'' and on the ''Settings'' tab, ''Parameters'' subtab untick "Realtime". In addition, tweaking Sample Rate, Frames/Period and Period/Buffer may help. Look for latency in the bottom right corner, as you still want minimal latency for audio production. Also, I think Sample Rate should match one of the rates supported by your audio interface ({{ic|cat /proc/asound/cardN/codec\#M}} and look for {{ic|rates}}, there could be multiple occurrences).<br />
<br />
== PulseAudio through OSS ==<br />
<br />
Add the following to {{ic|/etc/pulse/default.pa}}:<br />
load-module module-oss<br />
<br />
Then start PulseAudio as usual, making sure that sinks and sources are defined for OSS devices.<br />
<br />
== PulseAudio from within a chroot ==<br />
<br />
Since a chroot sets up an alternative root for the running/jailing of applications, PulseAudio must be installed within the chroot itself ({{ic|pacman -S pulseaudio}} within the chroot environment).<br />
<br />
PulseAudio, if not set up to connect to any specific server (this can be done in {{ic|/etc/pulse/client.conf}}, through the PULSE_SERVER environment variable, or through publishing to the local X11 properties using module-x11-publish), will attempt to connect to the local pulse server, failing which it will spawn a new pulse server. Each pulse server has a unique ID based on the machine-id value in {{ic|/var/lib/dbus}}. To allow for chrooted apps to access the pulse server, the following directories must be mounted within the chroot:-<br />
/run<br />
/var/lib/dbus<br />
/tmp<br />
~/.config/pulse<br />
<br />
{{ic|/dev/shm}} should also be mounted for efficiency and good performance. Note that mounting /home would normally also allow sharing of the {{ic|~/.pulse}} folder.<br />
<br />
PulseAudio selects the path to the socket via XDG_RUNTIME_DIR, so be sure to drag it along when you chroot as a normal user using [[sudo]] (see [[Sudo#Environment variables]]).<br />
<br />
== Remap stereo to mono ==<br />
<br />
Remap a stereo input-sink to a mono sink by creating a virtual sink. It would be useful if you only have one speaker. Add to {{ic|/etc/pulse/default.pa}}:<br />
<br />
load-module module-remap-sink master=alsa_output.pci-0000_00_1f.5.analog-stereo sink_name=mono sink_properties="device.description='Mono'" channels=2 channel_map=mono,mono<br />
# Optional: Select new remap as default<br />
set-default-sink mono<br />
<br />
(replace alsa_output.pci-0000_00_1f.5.analog-stereo in the sound card name shown from {{ic|pacmd list-sinks}})<br />
<br />
Switch player between virtual mono sink and real stereo sink.<br />
<br />
== Remap left or right to mono ==<br />
<br />
Particularly useful in the case an audio stream has different content in the left and right channels, such as Japanese television broadcasts with bilingual audio.<br />
<br />
# For Japanese bilingual TV<br />
load-module module-remap-sink sink_name=Left-to-Mono sink_properties="device.description='Left to Mono (5.1 AC3 on ALC892 Digital)'" master=alsa_output.pci-0000_00_1b.0.iec958-ac3-surround-51 channels=2 master_channel_map=mono,mono channel_map=front-left,rear-left<br />
load-module module-remap-sink sink_name=Right-to-Mono sink_properties="device.description='Right to Mono (5.1 AC3 on ALC892 Digital)'" master=alsa_output.pci-0000_00_1b.0.iec958-ac3-surround-51 channels=2 master_channel_map=mono,mono channel_map=front-right,rear-right<br />
<br />
Replace {{ic|alsa_output.pci-0000_00_1b.0.iec958-ac3-surround-51}} (5.1 AC3 on ALC892 Digital) with your own card ({{ic|pacmd list-sinks}}).<br />
<br />
{{Note|<br />
* ''master_channel_map'' is a list of outputs to be remapped to.<br />
* ''channel_map'' is a list of inputs to be remapped from.<br />
* A stereo card will not have to specify as many channels, eg. {{ic|1=channels=1 master_channel_map=mono channel_map=right}}}}<br />
<br />
== Remap for broadcasting software ==<br />
<br />
If you do not want to capture sound from the application you need to create Remap sink:<br />
<br />
### Create Remap sink<br />
load-module module-remap-sink sink_name=Remap_sink master=SINK_NAME channels=2 remix=no<br />
set-default-sink Remap_sink <br />
<br />
{{Note|1=Replace {{ic|SINK_NAME}} with the real name of the master sink {{ic|pacmd list-sinks}}.}}<br />
<br />
Then restart PulseAudio daemon:<br />
<br />
$ pulseaudio -k<br />
$ pulseaudio --start<br />
<br />
Now you need set the {{ic|Remap_sink}} as the default sound source in broadcast software<br />
<br />
{{Note|1=Use environment variable {{ic|1=PULSE_SINK=SINK_NAME}} for applications, sound that does not need to be captured.}}<br />
<br />
== Swap left/right channels ==<br />
<br />
This is the same as "reverse stereo", where the left and right channels are to be swapped.<br />
<br />
First, identify the card you want its channels swapped:<br />
$ cat /proc/asound/cards<br />
and use the name string for the device you wish to use (the one in square brackets, e.g. [Intel]).<br />
<br />
Edit {{ic|/etc/pulse/default.pa}} and comment out module-hal-detect and module-detect lines.<br />
<br />
Search for the commented-out line that starts "#load-module module-alsa-sink", uncomment it and change it to<br />
<br />
load-module module-alsa-sink device=hw:"device_name" channel_map=right,left<br />
Restart the pulseaudio deamon by running<br />
pulseaudio -k; pulseaudio -D<br />
<br />
[https://www.freedesktop.org/wiki/Software/PulseAudio/FAQ/#index34h3 Pulseaudio FAQ: How can I reverse my left and right speaker channels?]<br />
<br />
=== Using default.pa ===<br />
<br />
Another approach to swapping channels is suggested in [https://superuser.com/a/144252]:<br />
<br />
{{hc|~/.config/pulse/default.pa|2=<br />
#!/usr/bin/pulseaudio -nF<br />
<br />
.include /etc/pulse/default.pa<br />
<br />
load-module module-remap-sink sink_name=reverse-stereo master=0 channels=2 master_channel_map=front-right,front-left channel_map=front-left,front-right<br />
set-default-sink reverse-stereo<br />
}}<br />
<br />
=== Using PulseEffects ===<br />
<br />
# Install {{Pkg|pulseeffects}}{{Broken package link|replaced by {{Pkg|easyeffects}}}}:<br />
# Using the "Stereo Tools" application on the left of the PulseEffects UI<br />
# Navigate to the "Stereo Matrix" page<br />
# Under "Mode" select "LR > RL (Stereo Flip Channels)"<br />
<br />
The way PulseEffects works is it becomes your primary output device. You will then need to use the PulseAudio Volume Control {{Pkg|pavucontrol}} tool to set the PulseEffects output to the device you want.<br />
<br />
== PulseAudio as a minimal unintrusive dumb pipe to ALSA ==<br />
<br />
Some people do not want to run PulseAudio all the time for various reasons. This example will turn the full fledged audio server into an unobstrusive dumb pipe to ALSA devices that automatically starts '''and''' stops itself when done, allowing applications that requires PulseAudio to fully function while not touching any ALSA setting nor setting itself as the default ALSA device.<br />
<br />
This configuration tells native PA clients to autospawn the daemon when they need it, then the daemon is configured to autoexit as soon as all clients have disconnected. The daemon itself uses a plain simple static configuration that uses your configured {{ic|pcm.!default}} ALSA devices and nothing more. No replacement of ALSA's default, no playing with mixer levels, nothing but record/playback. Also make sure {{Pkg|pulseaudio-alsa}} is '''not''' installed so standard ALSA clients do not default to pulse. Since {{Pkg|pulseaudio-alsa}} contains only a configuration file {{ic|/etc/asound.conf}}, if it's installed as dependency, one could simply comment all contents in {{ic|/etc/asound.conf}}. {{ic|alsamixer}} functions properly as well as any other ALSA clients. Also make sure common frameworks like Xine, Gstreamer and Phonon are configured to use ALSA: by default if they detect PulseAudio is installed they will try to use it before ALSA.<br />
<br />
{{hc|/etc/pulse/daemon.conf|<nowiki><br />
# Replace these with the proper values<br />
exit-idle-time = 0 # Exit as soon as unneeded<br />
flat-volumes = yes # Prevent messing with the master volume<br />
</nowiki>}}<br />
<br />
{{hc|/etc/pulse/client.conf|<nowiki><br />
# Replace these with the proper values<br />
<br />
# Applications that uses PulseAudio *directly* will spawn it,<br />
# use it, and pulse will exit itself when done because of the<br />
# exit-idle-time setting in daemon.conf<br />
autospawn = yes<br />
</nowiki>}}<br />
<br />
{{hc|/etc/pulse/default.pa|<nowiki><br />
# Replace the *entire* content of this file with these few lines and<br />
# read the comments<br />
<br />
.fail<br />
# Set tsched=0 here if you experience glitchy playback. This will<br />
# revert back to interrupt-based scheduling and should fix it.<br />
#<br />
# Replace the device= part if you want pulse to use a specific device<br />
# such as "dmix" and "dsnoop" so it doesn't lock an hw: device.<br />
<br />
# INPUT/RECORD<br />
load-module module-alsa-source device="default" tsched=1<br />
<br />
# OUTPUT/PLAYBACK<br />
load-module module-alsa-sink device="default" tsched=1 <br />
<br />
# Accept clients -- very important<br />
load-module module-native-protocol-unix<br />
<br />
.nofail<br />
.ifexists module-x11-publish.so<br />
# Publish to X11 so the clients know how to connect to Pulse. Will<br />
# clear itself on unload.<br />
load-module module-x11-publish<br />
.endif<br />
</nowiki>}}<br />
<br />
== Having both speakers and headphones plugged in and switching in software on-the-fly ==<br />
<br />
{{Out of date|{{ic|/usr/share/pulseaudio/alsa-mixer/paths}} has been replaced by {{ic|/usr/share/alsa-card-profile/mixer/paths}}|section=Having both speakers and headphones plugged in and switching in software on-the-fly}}<br />
By design, Pulseaudio automatically turns off Line Out when headphones are plugged in and uses Headphone slider instead. You can observe this behavior in {{ic|alsamixer}}. What we want is to have Headphone and Line Out sliders working separately and at the same time. This is extremely useful if you want to remap Realtek's jacks to have, say, Rear Green for headphones and Blue for speakers (with the help of {{ic|hdajackretask}} from {{Pkg|alsa-tools}}).<br />
<br />
To achieve this, you should directly edit Pulseaudio mixer's configuration.<br />
<br />
1. We tell pulseaudio that headphones are always plugged in. Edit:<br />
<br />
{{ic|/usr/share/pulseaudio/alsa-mixer/paths/analog-output-lineout.conf}}<br />
<br />
Find:<br />
{{bc|<nowiki><br />
[Jack Headphone]<br />
state.plugged = no<br />
state.unplugged = unknown<br />
</nowiki>}}<br />
<br />
Change {{ic|no}} to {{ic|yes}}<br />
<br />
2. By default, Line Out's volume controlled only by Master, and not by Line Out slider itself. We want to merge Line Out with Master.<br />
<br />
Add this snippet to the end of the file:<br />
<br />
{{bc|<nowiki><br />
[Element Line Out]<br />
switch = mute<br />
volume = merge<br />
</nowiki>}}<br />
<br />
3. We need to completely cut off Line Out when we use headphones. Edit:<br />
<br />
{{ic|/usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf}}<br />
<br />
Add this snippet to the end of the file:<br />
<br />
{{bc|<nowiki><br />
[Element Line Out]<br />
switch = off<br />
volume = off<br />
</nowiki>}}<br />
<br />
{{Note|On some systems you might need to use {{ic|[Element Front]}} instead of {{ic|[Element Line Out]}}.}}<br />
<br />
4. Like Pulseaudio, Alsa itself cuts off speakers when headphones are plugged in. Open {{ic|alsamixer}} (in case of Realtek HDA {{ic|alsamixer -c0}}) and change {{ic|Auto-Mute mode}} to {{ic|disabled}}. <br />
<br />
5. Restart Pulseaudio<br />
<br />
{{bc|<nowiki><br />
$ pulseaudio -k<br />
$ pulseaudio --start<br />
</nowiki>}}<br />
<br />
Now you have two separate ports on the same sink in pulseaudio. They mute each other, so you can switch to headphones and this will mute Line Out, and vice versa.<br />
To switch between ports you can use Gnome or Plasma sound mixer, or install appropriate desktop extension.<br />
<br />
== Allowing multiple users to use PulseAudio at the same time ==<br />
<br />
It is sometimes desirable to run some programs as another user on the same desktop of the primary user in order to isolate the software. However, PulseAudio will not accept by default connections by the secondary users, since a PulseAudio daemon is already running for the primary user. However, a PulseAudio UNIX socket can be created in order to accept connections from other users to the main PulseAudio daemon run by the primary user.<br />
<br />
First, edit {{ic|~/.config/pulse/default.pa}} and add a directive for the unix socket to be created:<br />
<br />
{{hc|1=~/.config/pulse/default.pa|2=load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse-socket}}<br />
<br />
Afterwards, for the secondary user, set PulseAudio as a client to the UNIX socket just created:<br />
<br />
{{hc|/home/''secondaryuser''/.config/pulse/client.conf|2=default-server = unix:/tmp/pulse-socket}}<br />
<br />
Now, after restarting the PulseAudio daemon, applications ran by the secondary user should be able to play sound through the primary user's main PulseAudio daemon without problems.<br />
<br />
== Mixing additional audio into the microphone's audio ==<br />
<br />
Using a setup of null sinks and loopbacks you can mix arbitrary applications' audio output into your microphone's audio, for example to play sound effects or music on voice chat applications.<br />
<br />
The setup suggested here will also play your sound effects back to you and use [https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-echo-cancel PulseAudio echo cancellation] to prevent the effects from feeding back into your microphone.<br />
<br />
=== PulseAudio management with pulse-autoconf ===<br />
<br />
As of August 2020 there is {{AUR|pulse-autoconf}}, a PulseAudio server dynamic configuration daemon that supports this setup with its 'EchoCancellationWithSourcesMix' preset and that comes with further benefits, such as dynamically reacting to changes in the PulseAudio server, for example when a headset or a webcam is plugged in or unplugged.<br />
<br />
If {{AUR|pulse-autoconf}} does not work out for your use case, read on for the manual way.<br />
<br />
=== PulseAudio configuration ===<br />
<br />
Symbology: {{ic|(Application)}}, {{ic|<nowiki>{Audio source}</nowiki>}}, {{ic|[Audio sink]}}, {{ic|<nowiki>{m} = Monitor of audio sink</nowiki>}}, {{ic|<nowiki>{}* = Fallback (default) source</nowiki>}}, {{ic|<nowiki>[]* = Fallback (default) sink</nowiki>}}<br />
<br />
{Microphone}<br />
||<br />
{src_ec} -----------------> [sink_mix]{m}=={src_main}* -----> (Voice chat)<br />
Loopback ^ |<br />
| Loopback |<br />
| v<br />
(Soundboard) ---------> [sink_fx]{m} -----------------------> [sink_main]*<br />
Loopback ||<br />
[Speakers]<br />
; {src_ec}, [sink_main]<br />
: Echo cancellation "clones" of the microphone and speakers<br />
; [sink_fx]<br />
: Virtual sink into which the sound effects are played<br />
; [sink_mix]<br />
: Virtual sink where the microphone and the sound effects are mixed together<br />
; {src_main}<br />
: Remap of "Monitor of sink_mix", to work around applications that do not allow recording from monitor sources<br />
<br />
=== Applications configuration ===<br />
<br />
The applications providing the sound effects must<br />
* Output to "sink_fx"<br />
<br />
All other applications, including the voice chat, must<br />
* Record audio from "src_main"<br />
* Output to "sink_main"<br />
Accordingly, these devices will be set as defaults. Controlling which application uses which audio source/sink can usually be done in the {{ic|pavucontrol}} graphical PulseAudio control panel.<br />
<br />
For some applications changing their sources or sinks in {{ic|pavucontrol}} has no effect. In this case you can typically select the source or sink in the applications' audio settings.<br />
<br />
'''No application whatsoever''' must record from, or output to, the "real" microphone or speakers, as this would bypass the echo cancellation.<br />
<br />
Any echo cancellation or other audio processing provided by the voice chat application should be disabled – PulseAudio is doing this already, and as the application is not aware of the sound effects being played on the speakers, it will likely be ineffective in filtering them from the microphone anyway.<br />
<br />
=== Setup steps ===<br />
<br />
# Connect your microphone and headphones and make sure PulseAudio is configured correctly for their use, for example in the "Configuration" tab in {{ic|pavucontrol}}<br />
# ''First time only:''<br />
## Save the template script below to an executable file of your choice<br />
## Find the names of your microphone and headphones with {{ic|<nowiki>pactl list short sources | grep -v ".monitor"</nowiki>}} and {{ic|pactl list short sinks}}, respectively<br />
## In the script, replace the values of "microphone" and "speakers" with the names of your microphone/headphones<br />
# Run the script<br />
# Run your voice chat application and make it record audio from "src_main" and output audio to "sink_main"<br />
# Run your sound effects application(s) and make them play to "sink_fx"<br />
<br />
As for applications that can play sound effects, {{AUR|castersoundboard-git}} has been found to work quite well.<br />
It however needs to be closed and re-opened when PulseAudio is restarted.<br />
<br />
=== Teardown ===<br />
<br />
The changes that the script makes to the running PulseAudio server are not permanent and will be lost when PulseAudio terminates.<br />
<br />
To ditch the custom configuration, just restart PulseAudio, e.g. with {{ic|systemctl --user stop pulseaudio.service}}. (PulseAudio is socket-activated and will automatically start on demand.)<br />
<br />
=== Template script ===<br />
<br />
#!/bin/bash<br />
<br />
microphone="alsa_input.pci-0000_00_1b.0.analog-stereo"<br />
speakers="alsa_output.pci-0000_00_1b.0.analog-stereo"<br />
<br />
echo "Setting up echo cancellation"<br />
pactl load-module module-echo-cancel use_master_format=1 aec_method=webrtc \<br />
aec_args="analog_gain_control=0\\ digital_gain_control=1\\ experimental_agc=1\\ noise_suppression=1\\ voice_detection=1\\ extended_filter=1" \<br />
source_master="$microphone" source_name=src_ec source_properties=device.description=src_ec \<br />
sink_master="$speakers" sink_name=sink_main sink_properties=device.description=sink_main<br />
<br />
echo "Creating virtual output devices"<br />
pactl load-module module-null-sink sink_name=sink_fx sink_properties=device.description=sink_fx<br />
pactl load-module module-null-sink sink_name=sink_mix sink_properties=device.description=sink_mix<br />
<br />
echo "Creating remaps"<br />
pactl load-module module-remap-source master=sink_mix.monitor \<br />
source_name=src_main source_properties="device.description=src_main"<br />
<br />
echo "Setting default devices"<br />
pactl set-default-source src_main<br />
pactl set-default-sink sink_main<br />
<br />
echo "Creating loopbacks"<br />
pactl load-module module-loopback latency_msec=60 adjust_time=6 source=src_ec sink=sink_mix<br />
pactl load-module module-loopback latency_msec=60 adjust_time=6 source=sink_fx.monitor sink=sink_mix<br />
pactl load-module module-loopback latency_msec=60 adjust_time=6 source=sink_fx.monitor sink=sink_main<br />
<br />
This script has been inspired by https://askubuntu.com/a/915064 , for more in-depth information also see that post's author's [https://github.com/toadjaune/pulseaudio-config pulseaudio-config GitHub repository].<br />
<br />
Using {{ic|module-remap-source}} to work around applications that do not accept a monitor as source is taken from https://unix.stackexchange.com/a/608482 .<br />
<br />
== Invert phase of one audio channel ==<br />
<br />
This is useful for compensating when one of your speakers is wired with the wrong polarity. To test if this is needed, see [https://www.audiocheck.net/audiotests_polaritycheck.php].<br />
<br />
Adapted from a more general example of [https://askubuntu.com/a/194345 Assigning a LADSPA filter to a single audio channel].<br />
Requires {{Pkg|swh-plugins}}.<br />
<br />
#!/bin/bash<br />
master=alsa_output.pci-0000_07_00.0.analog-stereo<br />
pacmd load-module module-ladspa-sink sink_name=ladspa_out sink_master=$master plugin=inv_1429 label=inv<br />
pacmd load-module module-remap-sink sink_name=remapR master=ladspa_out channels=1 master_channel_map=front-right channel_map=front-right<br />
pacmd load-module module-remap-sink sink_name=remapL master=$master channels=1 master_channel_map=front-left channel_map=front-left<br />
pacmd load-module module-combine-sink sink_name=invert sink_properties=device.description='"Invert\ phase"' slaves=remapL,remapR channels=2<br />
<br />
== Renaming devices ==<br />
<br />
Sound devices will sometimes have confusing names assigned to them by default. Names like ''"CM106 Like Sound Device"'' are not very descriptive.<br />
This can be easily fixed and it works for both Pulseaudio sources and sinks.<br />
<br />
The easiest method is to add the following lines to the end of the {{ic|/etc/pulse/default.pa}} file.<br />
<br />
To update a source name:<br />
<br />
update-source-proplist <DEVICE_NAME> device.description="<NEW_NAME>"<br />
<br />
And to update a sink name:<br />
<br />
update-sink-proplist <DEVICE_NAME> device.description="<NEW_NAME>"<br />
<br />
The device name can be queried using the command {{ic|pacmd list-sources {{!}} grep name:}} for sources, or {{ic|pacmd list-sinks {{!}} grep name:}} for sinks.<br />
<br />
This configuration can also be persisted on a per-user basis and be written to {{ic|~/.config/pulse/default.pa}} like so:<br />
<br />
#!/usr/bin/pulseaudio -nF<br />
<br />
## Include defaults<br />
.include /etc/pulse/default.pa<br />
<br />
## Rename devices<br />
update-source-proplist <DEVICE_NAME> device.description="<NEW_NAME>"<br />
<br />
The default Pulseaudio config needs to be included, otherwise the daemon will not start.</div>SECuREhttps://wiki.archlinux.org/index.php?title=Webcam_setup&diff=667310Webcam setup2021-05-02T16:28:49Z<p>SECuRE: added MJPEG pixel format example for MPlayer as well, not just MPV</p>
<hr />
<div>[[Category:Digital imaging]]<br />
[[es:Webcam setup]]<br />
[[ja:ウェブカメラ設定]]<br />
[[zh-hans:Webcam setup]]<br />
This is a guide to setting up your webcam in Arch Linux.<br />
<br />
Most probably your webcam will work out of the box. Permissions to access video devices (e.g. {{ic|/dev/video0}}) are handled by [[udev]], there is no configuration necessary.<br />
<br />
== Loading ==<br />
<br />
Most recent webcams are UVC (''USB Video Class'') compliant and are supported by the generic ''uvcvideo'' kernel driver module. To check that your webcam is recognized, run [[dmesg]] just after you plug the webcam in. You should see something like this:<br />
{{hc|# dmesg {{!}} tail|<br />
sn9c102: V4L2 driver for SN9C10x PC Camera Controllers v1:1.24a<br />
usb 1-1: SN9C10[12] PC Camera Controller detected (vid/pid 0x0C45/0x600D)<br />
usb 1-1: PAS106B image sensor detected<br />
usb 1-1: Initialization succeeded<br />
usb 1-1: V4L2 device registered as /dev/video0<br />
usb 1-1: Optional device control through 'sysfs' interface ready<br />
usbcore: registered new driver sn9c102}}<br />
Some pre-UVC webcams are also supported via the ''gspca'' kernel driver module. See the [https://www.linuxtv.org/wiki/index.php/Gspca_devices gspca devices] for a non-exhaustive list of supported devices under this framework.<br />
<br />
Otherwise, if your webcam is not supported by the kernel's drivers, an external driver is necessary. The first step is to identify the name of the webcam, using for example {{Ic|lsusb}}. Then you can check [https://www.linuxtv.org/wiki/index.php/Webcam_devices webcam devices] for information and resources about webcams. Once you find a driver compatible with the webcam, you have to add the corresponding [[kernel module]] in {{ic|/etc/modules-load.d/webcam.conf}} so it will be loaded into the kernel during init stage bootstrapping.<br />
<br />
{{Note|The Linux kernel to userspace API used to control webcams is named ''Video4Linux2'', '''v4l2''' for short. All applications which support v4l2 will work with the kernel's drivers.}}<br />
<br />
== Configuration ==<br />
<br />
If you want to configure brightness, color and other webcam parameters (e.g. in the case when out-of-the-box colors are too bluish/reddish/greenish) you may use ''Qt V4L2 Test Bench''. To run it, [[install]] {{Pkg|v4l-utils}} and launch {{ic|qv4l2}}, and it will present you a list of configurable settings. Changing these settings will affect all applications.<br />
<br />
=== Command Line ===<br />
<br />
{{Pkg|v4l-utils}} also installs an equivalent command line tool, {{ic|v4l2-ctl}}. To list all video devices:<br />
<br />
$ v4l2-ctl --list-devices<br />
<br />
To list the configurable settings of a video device:<br />
<br />
$ v4l2-ctl -d /dev/video0 --list-ctrls<br />
<br />
=== Persisting configuration changes ===<br />
<br />
Configuration made via V4L2 does not persist after the webcam is disconnected and reconnected. It's possible to use {{ic|v4l2-ctl}} with [[Udev]] rules in order to set some configuration each time a particular camera is connected.<br />
<br />
For example, to set a default zoom setting on a particular Logitech webcam each time it is connected, add a [[Udev#udev_rule_example|udev rule]] like this:<br />
<br />
{{hc|/etc/udev/rules.d/99-logitech-default-zoom.rules|2=<br />
SUBSYSTEM=="video4linux", KERNEL=="video[0-9]*", ATTRS{product}=="HD Pro Webcam C920", ATTRS{serial}=="BBBBFFFF", ATTR{index}=="0", RUN+="/usr/bin/v4l2-ctl -d $devnode --set-ctrl=zoom_absolute=170"<br />
}}<br />
<br />
To find udev attributes like the product name and serial, see [[Udev#List the attributes of a device]]. It also possible to [[Udev#Setting static device names|set a static name for a video device]]).<br />
<br />
== Applications ==<br />
<br />
See also [[List of applications/Multimedia#Webcam]].<br />
<br />
=== xawtv ===<br />
<br />
This is a basic ''Video4Linux2'' device viewer, and although it is intended for use with TV tuner cards, it works well with webcams. It will display what your webcam sees in a window.<br />
<br />
[[Install]] {{Pkg|xawtv}} and run it with:<br />
$ xawtv -c /dev/video0<br />
<br />
In case of error see [[#xawtv with nvidia card]].<br />
<br />
=== VLC ===<br />
<br />
[[VLC]] can also be used to view and record your webcam. In VLC's "Media" menu, open the 'Capture Device...' dialog and enter the video and audio device files. Or from the command line, do:<br />
$ vlc v4l2:// :input-slave=alsa:// :v4l-vdev="/dev/video0"<br />
This will make VLC mirror your webcam.<br />
* To take stills, simply choose ''Snapshot'' in the ''Video'' menu. <br />
* To record the stream, add a {{ic|--sout}} argument to the command line, e.g.<br />
$ vlc v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2" --sout "#transcode{vcodec=mp1v,vb=1024,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst=std{access=file,mux=mpeg1,dst=/tmp/test.mpg}}"<br />
<br />
(Obviously a bit overkill with regard to the bit rates but it is fine for testing purposes). Note that by default this will not display the video, in order to see what you are recording, you need to add the display as a destination to the argument (note that it will slow down the operation):<br />
... :duplicate{'''dst=display''',dst=std{access= ....<br />
<br />
If VLC does not detect webcams, ensure that {{Pkg|zvbi}} package is installed.<br />
<br />
=== MPlayer ===<br />
<br />
To use [[MPlayer]] to take snapshots from your webcam run this command from the terminal:<br />
$ mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 15 -vf screenshot<br />
From here you have to press {{ic|s}} to take the snapshot. The snapshot will be saved in the current folder as {{ic|shotXXXX.png}}.<br />
If you want to record video continuous:<br />
$ mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o ''filename''.avi<br />
Press {{ic|Ctrl+c}} to end the recording.<br />
<br />
To play video with [[MPlayer]] using MJPEG as the pixelformat instead of the default, which in most cases is YUYV, you can run the following:<br />
$ mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:outfmt=mjpeg -fps 15 <br />
<br />
=== mpv ===<br />
<br />
To use [[mpv]] to take snapshots from your webcam, run this command from the terminal:<br />
$ mpv av://v4l2:/dev/video0 --profile=low-latency --untimed<br />
<br />
From here you have to press {{ic|s}} to take the snapshot. The snapshot will be saved in your current folder as {{ic|mpv-shot''NNNN''.jpg}}.<br />
<br />
To use MJPEG as the pixelformat instead of the default, which in most cases is YUYV, you can run the following instead:<br />
$ mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0<br />
<br />
In some cases this can lead to drastic improvements in quality and performance (5FPS -> 30FPS for example).<br />
<br />
To adjust webcam settings, including the resolution, [https://github.com/mpv-player/mpv/wiki/Video4Linux2-Input see the mpv documentation].<br />
<br />
=== FFmpeg ===<br />
<br />
See [[FFmpeg#Recording webcam]].<br />
<br />
== Troubleshooting ==<br />
<br />
=== V4L1 support ===<br />
<br />
Version 2.6.27 of the Linux kernel dropped support for the legacy Video4Linux (1) API. Pixel format decoding has been pushed to user space, since Video4Linux version 2 does not support kernel space decoding. The libv4l library provides userland applications with pixel decoding services and will be used by most programs. Other compatibility layers are also available.<br />
<br />
'''If your device is created but your image looks strange (e.g. nearly completely green), you probably need this.'''<br />
<br />
If the application has V4L2 support but no pixelformat support then use the following command:<br />
LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so application<br />
<br />
If the application only supports the older version of V4L, use this command:<br />
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so application<br />
<br />
{{Tip|1=You also might want to put a line like the following into {{ic|/etc/profile}} or [[xprofile]] so you do not have to type that long command all the time:<br />
{{ic|1=export LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so}} or {{ic|1=export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so}}}}<br />
<br />
For 32-bit [[multilib]] applications, install the {{Pkg|lib32-v4l-utils}} package and replace {{ic|/usr/lib/libv4l/}} by {{ic|/usr/lib32/libv4l/}} in the above commands.<br />
<br />
=== xawtv with nvidia card ===<br />
<br />
If you are using an nvidia graphic card, and get an error like<br />
X Error of failed request: XF86DGANoDirectVideoMode<br />
Major opcode of failed request: 139 (XFree86-DGA)<br />
Minor opcode of failed request: 1 (XF86DGAGetVideoLL)<br />
Serial number of failed request: 69<br />
Current serial number in output stream: 69<br />
you should instead run it as {{ic|$ xawtv -nodga}}<br />
<br />
=== Microsoft Lifecam Studio/Cinema ===<br />
<br />
Under certain configurations, the Microsoft lifecam studio/cinema may request too much usb bandwidth and fail [http://www.ideasonboard.org/uvc/#footnote-13 see Uvcvideo FAQ]. In this case, change the buffering by loading the {{ic|uvcvideo}} driver with {{ic|1=quirks=0x80}}. Add it to {{ic|/etc/modprobe.d/uvcvideo.conf}} :<br />
<br />
{{hc|1=/etc/modprobe.d/uvcvideo.conf|2=<br />
## fix bandwidth issue for lifecam studio/cinema<br />
options uvcvideo quirks=0x80<br />
}}<br />
<br />
{{Note|If delays are visible in the logs, or the camera works periodically, this workaround should apply generally. Bigger values such as {{ic|1=quirks=0x100}} are possible.}}<br />
<br />
=== Skype ===<br />
<br />
When testing the webcam, note the following:<br />
* The echobot does not support videochat. Do not use it for testing your webcam.<br />
* Skype might recognize different video/camera devices (/dev/video*). These will be listed as something like "integrated camera..." in a dropdown menu in the camera settings. Try each camera and wait a few seconds, because it takes time to switch to a different camera.<br />
<br />
=== Check bandwidth used by USB webcams ===<br />
<br />
When running multiple webcams on a single USB bus, they may saturate the bandwidth of the USB bus and not work properly. You can diagnose this with the ''usbtop'' tool from the {{AUR|usbtop}} package.<br />
<br />
=== Invert the video stream ===<br />
<br />
If your video stream is inverted, you can make a new virtual video camera which inverts the inverted video. You need to [[install]] {{Pkg|v4l-utils}} and also {{Pkg|v4l2loopback-dkms}}. Create the virtual video camera:<br />
<br />
# modprobe v4l2loopback<br />
<br />
Check the name of the newly created camera:<br />
<br />
$ v4l2-ctl --list-devices<br />
Dummy video device (0x0000) (platform:v4l2loopback-000):<br />
/dev/video1<br />
<br />
Then you can run {{Pkg|ffmpeg}} to read from your actual webcam (here {{ic|/dev/video0}}) and invert it and feed it to the virtual camera:<br />
<br />
$ ffmpeg -f v4l2 -i /dev/video0 -vf "vflip" -f v4l2 /dev/video1<br />
<br />
You can use the "Dummy" camera in your applications instead of the "Integrated" camera.<br />
<br />
=== Bad image quality ===<br />
<br />
If you experience images being too bright, too dark, too exposed or any other, you can install {{AUR|v4l2ucp}} to tweak your image output.</div>SECuREhttps://wiki.archlinux.org/index.php?title=Smokeping&diff=628162Smokeping2020-08-02T06:59:10Z<p>SECuRE: /* Nginx */ fix nginx /imgcache location, without this change I got: open() "/srv/http/smokeping/imgcache/rrdtool.png" failed (2: No such file or directory)</p>
<hr />
<div>[[Category:Network monitoring]]<br />
[[ja:Smokeping]]<br />
[[zh-hans:Smokeping]]<br />
[https://oss.oetiker.ch/smokeping/index.en.html Smokeping]<br />
allows you to probe a list of servers, store that data using<br />
RRDtool, and generate statistical charts based on RRDtool's<br />
output. Smokeping consists of two parts. A daemon runs in the<br />
background pinging and collecting data at set intervals. A web<br />
interface displays that data in the form of graphs.<br />
<br />
This wiki page covers a basic setup of the smokeping daemon and the CGI webinterface.<br />
<br />
== Installation ==<br />
<br />
This section covers the installation of [https://oss.oetiker.ch/smokeping/index.en.html Smokeping] using the {{Pkg|smokeping}} package. FastCGI on Apache will be setup as described in [[Apache and FastCGI]].<br />
<br />
The smokeping package consists of two parts:<br />
* The smokeping daemon and configs in {{ic|/etc/smokeping/}}. This daemon performs the monitoring.<br />
* The smokeping "htdocs" in {{ic|/srv/http/smokeping}}. These will be used by the web interface.<br />
<br />
In addition to the {{Pkg|smokeping}} package, you will need:<br />
* A tool that smokeping can use for monitoring. {{Pkg|fping}} is the simplest and default method for simple ping probes.<br />
* {{Pkg|apache}} and {{Pkg|mod_fcgid}} for the web interface if you're using Apache.<br />
* {{Pkg|fcgiwrap}} and start and enable fcgiwrap.socket if you're using Nginx<br />
* An image cache directory that the FastCGI script can write to, e.g. {{ic|/srv/smokeping/imgcache}}<br />
* A data directory that the smokeping daemon can write to, and the FastCGI script can read, e.g. {{ic|/srv/smokeping/data}}<br />
* To ensure that the main config file is readable by the smokeping daemon.<br />
<br />
=== Optional Prerequisites ===<br />
<br />
If you want to use other probes such as the DNS or http probe you will<br />
need other packages as shown below. The configuration of these will is not covered by this wiki page.<br />
<br />
{| class="wikitable"<br />
! Probe !! Package Needed<br />
|-<br />
| Curl || {{Pkg|curl}}<br />
|-<br />
| DNS || {{Pkg|bind}} (for the dig utility)<br />
|-<br />
| EchoPing || {{Pkg|echoping}}<br />
|-<br />
| SSH || {{Pkg|openssh}}<br />
|-<br />
| TelnetIOSPing || {{Pkg|perl-net-telnet}}<br />
|-<br />
| AnotherDNS || {{Pkg|perl-net-dns}}<br />
|-<br />
| LDAP || {{Pkg|perl-ldap}}<br />
|-<br />
| LDAP (tls) || {{Pkg|perl-io-socket-ssl}}<br />
|-<br />
| Authen || {{Pkg|perl-authen-radius}}<br />
|}<br />
<br />
== Configuration ==<br />
<br />
Smokeping requires you to edit a few files. The unedited files end<br />
with the {{ic|.dist}} extension. Rename the {{ic|.dist}}<br />
files in {{ic|/etc/smokeping}} to remove the suffix. The ''find'' command does this and<br />
prints out each file that is being renamed and needs editing:<br />
<br />
# cd /etc/smokeping<br />
# find . -name '*.dist' -print -execdir sh -c 'mv {} $(basename {} .dist)' \;<br />
# mv /srv/http/smokeping/smokeping.fcgi.dist /srv/http/smokeping/smokeping.fcgi<br />
<br />
=== Editing the config file ===<br />
<br />
Next, edit the {{ic|/etc/smokeping/config}} file; this is smokeping's main config file. A brief description of the sections is followed by a complete example.<br />
<br />
The ''General'' section of the {{ic|/etc/smokeping/config}} file is the easiest to edit. Personalize the<br />
top of the config file to match your information. The comments describe each field. Note that if you do not have the {{ic|sendmail}} program installed (ie from postfix or sendmail) then use something else instead like {{ic|/bin/false}}. The file you specify must exist or smokeping will error out.<br />
<br />
The ''Alerts'' section is not needed in this minimal example, so it can be either commented out or removed.<br />
<br />
The ''Database'' section does not require any changes.<br />
<br />
In the ''Presentation'' section the path to the template filename needs to be updated.<br />
<br />
The ''Probes'' section specifies which probes are active. By default only the ''FPing'' probe is enabled. This section does not require any changes.<br />
<br />
The ''Slaves'' section is not needed in this minimal example, so it can be either commented out or removed. Note that if you use the {{ic|smokeping_secrets}} setting in the ''Slaves'' section, you will have to make that file unreadable to the rest of the world, or else smokeping will error: {{ic|chmod 600 /etc/smokeping/smokeping_secrets}}.<br />
<br />
The ''Targets'' section specifies which hosts will be probed (pinged in our example). Customize it so that it probes the host(s) you would like to collect statistics on, as shown in the example below.<br />
<br />
You can learn more about the Smokeping config<br />
file with the examples at<br />
http://oss.oetiker.ch/smokeping/doc/smokeping_examples.en.html<br />
<br />
{{hc|/etc/smokeping/config|2=<nowiki><br />
*** General ***<br />
<br />
owner = Your Name Here # your name<br />
contact = your.email@host.bla # your email<br />
mailhost = your.smtp.server.bla # your mail server<br />
sendmail = /bin/false # where the sendmail program is<br />
imgcache = /srv/smokeping/imgcache # filesystem directory where we store files<br />
imgurl = imgcache # URL directory to find them<br />
datadir = /srv/smokeping/data # where we share data between the daemon and webapp<br />
piddir = /var/run # filesystem directory to store PID file<br />
cgiurl = http://localhost/smokeping/smokeping.fcgi # exterior URL<br />
smokemail = /etc/smokeping/smokemail <br />
tmail = /etc/smokeping/tmail<br />
syslogfacility = local0<br />
# each probe is now run in its own process<br />
# disable this to revert to the old behaviour<br />
# concurrentprobes = no<br />
<br />
*** Database ***<br />
<br />
step = 300<br />
pings = 20<br />
<br />
# consfn mrhb steps total<br />
<br />
AVERAGE 0.5 1 1008<br />
AVERAGE 0.5 12 4320<br />
MIN 0.5 12 4320<br />
MAX 0.5 12 4320<br />
AVERAGE 0.5 144 720<br />
MAX 0.5 144 720<br />
MIN 0.5 144 720<br />
<br />
*** Presentation ***<br />
<br />
template = /etc/smokeping/basepage.html<br />
<br />
+ charts<br />
<br />
menu = Charts<br />
title = The most interesting destinations<br />
++ stddev<br />
sorter = StdDev(entries=>4)<br />
title = Top Standard Deviation<br />
menu = Std Deviation<br />
format = Standard Deviation %f<br />
<br />
++ max<br />
sorter = Max(entries=>5)<br />
title = Top Max Roundtrip Time<br />
menu = by Max<br />
format = Max Roundtrip Time %f seconds<br />
<br />
++ loss<br />
sorter = Loss(entries=>5)<br />
title = Top Packet Loss<br />
menu = Loss<br />
format = Packets Lost %f<br />
<br />
++ median<br />
sorter = Median(entries=>5)<br />
title = Top Median Roundtrip Time<br />
menu = by Median<br />
format = Median RTT %f seconds<br />
<br />
+ overview <br />
<br />
width = 600<br />
height = 50<br />
range = 10h<br />
<br />
+ detail<br />
<br />
width = 600<br />
height = 200<br />
unison_tolerance = 2<br />
<br />
"Last 3 Hours" 3h<br />
"Last 30 Hours" 30h<br />
"Last 10 Days" 10d<br />
"Last 400 Days" 400d<br />
<br />
*** Probes ***<br />
<br />
+ FPing<br />
<br />
binary = /usr/bin/fping<br />
<br />
*** Targets ***<br />
<br />
probe = FPing<br />
<br />
menu = Top<br />
title = Network Latency Grapher<br />
remark = Welcome to the SmokePing website of Arch User. \<br />
Here you will learn all about the latency of our network.<br />
<br />
+ targets<br />
menu = Targets<br />
title = Targets<br />
<br />
++ CloudflareDNS<br />
<br />
menu = Cloudflare DNS<br />
title = Cloudflare DNS server<br />
host = 1.1.1.1<br />
<br />
++ GoogleDNS<br />
<br />
menu = Google DNS<br />
title = Google DNS server<br />
host = 8.8.8.8<br />
<br />
++ MultiHost<br />
<br />
menu = Multihost example<br />
title = CloudflareDNS and Google DNS<br />
host = /targets/CloudflareDNS /targets/GoogleDNS<br />
</nowiki>}}<br />
<br />
==== Notes on the smokeping configuration file syntax ====<br />
<br />
Each '''+''' character defines a section in the hierarchy. Spaces are not allowed in the section names. Period and forward slashes should probably also be avoided in section names. This is probably because the RRD files are stored under the data directory with the same exact names as the sections.<br />
<br />
In the ''Targets'' section, you can define {{Ic|host}} as either a real host name or the path to another section to generate a multiple host chart, as shown in the {{ic|MultiHost}} example above.<br />
<br />
=== Setup the rest of the system ===<br />
<br />
Setup the extra directories referenced by the configuration file:<br />
# mkdir -p /srv/smokeping/data<br />
# mkdir -p /srv/smokeping/imgcache<br />
# chown -R smokeping:smokeping /srv/smokeping<br />
# chown -R http:http /srv/smokeping/imgcache<br />
# chmod a+rx /srv/smokeping<br />
# chmod -R a+rx /srv/smokeping/data<br />
<br />
Since the smokeping configuration is read by both the smokeping daemon and the FastCGI scripts, so it needs to be readable:<br />
# chmod a+rx /etc/smokeping<br />
# chmod a+r /etc/smokeping/config<br />
<br />
=== Start and enable daemon ===<br />
[[Start]] and enable {{ic|smokeping.service}}. Then check that it is running.<br />
<br />
== Setup web frontend ==<br />
=== Apache === <br />
Edit {{ic|/etc/httpd/conf/httpd.conf}} so that it includes:<br />
<br />
LoadModule fcgid_module modules/mod_fcgid.so<br />
<IfModule fcgid_module><br />
AddHandler fcgid-script .fcgi<br />
</IfModule><br />
<br />
Alias /smokeping/imgcache /srv/smokeping/imgcache<br />
Alias /smokeping /srv/http/smokeping<br />
<br />
<Directory "/srv/smokeping/imgcache"><br />
AllowOverride all<br />
Require all granted<br />
</Directory><br />
<br />
<Directory "/srv/http/smokeping"><br />
Options FollowSymLinks ExecCGI<br />
AllowOverride all<br />
Require all granted<br />
</Directory><br />
<br />
[[Start]] Apache via the {{ic|httpd.service}}.<br />
<br />
Check that http://localhost/smokeping/smokeping.fcgi loads. The first data should appear after a couple of minutes.<br />
<br />
If the fonts in the graphs are unreadable, you may need to install the {{Pkg|ttf-dejavu}} package.<br />
<br />
=== Caddy ===<br />
<br />
Thanks to the [https://caddy.community/t/smokeping-caddyfile/3560/8 Caddy community] and with this config file [https://s.natalian.org/2018-03-27/config /etc/smokeping/config] and with {{ic|sudo systemctl enable fcgiwrap.socket}}<br />
<br />
{{hc|/etc/caddy/caddy.conf.d/smokeping.conf|<br />
smokeping.example.com {<br />
<br />
log stdout<br />
errors<br />
<br />
tls john@example.com<br />
root /srv/http/smokeping<br />
<br />
fastcgi / unix:/var/run/fcgiwrap.sock {<br />
env SCRIPT_FILENAME /srv/http/smokeping/smokeping.fcgi.dist<br />
}<br />
}<br />
<br />
smokeping.example.com/js {<br />
root /srv/http/smokeping/js<br />
}<br />
<br />
<br />
smokeping.example.com/css {<br />
root /srv/http/smokeping/css<br />
}<br />
<br />
<br />
smokeping.example.com/cache {<br />
root /var/cache/smokeping<br />
}<br />
}}<br />
<br />
An updated version of this Caddy conf for smokeping - https://gist.github.com/Strykar/4df1eb8aebc4d5f7039f6045301352c7<br />
<br />
=== Lighttpd ===<br />
<br />
First install {{Pkg|lighttpd}} and {{Pkg|fcgi}}.<br />
<br />
Edit the [[Lighttpd]] configuration file and ensure you have at least all of the following configuration directives:<br />
<br />
{{hc|/etc/lighttpd/lighttpd.conf|2=<br />
server.document-root = "/srv/http"<br />
server.follow-symlink = "enable"<br />
<br />
server.modules += ("mod_fastcgi")<br />
fastcgi.server = (<br />
".fcgi" =><br />
((<br />
"bin-path" => "/srv/http/smokeping/smokeping.fcgi",<br />
"host" => "localhost",<br />
"port" => 8001,<br />
)),<br />
)<br />
}}<br />
<br />
Start and enable the server:<br />
<br />
{{bc|<br />
$ systemctl start lighttpd<br />
$ systemctl enable lighttpd<br />
}}<br />
<br />
[[Systemd]] should show {{ic|smokeping_cgi}} being managed by {{ic|lighttpd.service}}.<br />
<br />
{{hc|$ systemctl status lighttpd|2=<br />
● lighttpd.service - Lighttpd Web Server<br />
Loaded: loaded (/usr/lib/systemd/system/lighttpd.service; enabled; vendor preset: disabled)<br />
Active: active (running) since Wed 2018-12-26 14:34:42 PST; 1 day 7h ago<br />
Process: 17117 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)<br />
Main PID: 28321 (lighttpd-angel)<br />
Tasks: 6 (limit: 4915)<br />
Memory: 128.9M<br />
CGroup: /system.slice/lighttpd.service<br />
├─17119 /usr/bin/lighttpd -D -f /etc/lighttpd/lighttpd.conf<br />
├─17126 /usr/bin/perl /usr/bin/smokeping_cgi /etc/smokeping/config<br />
├─17127 /usr/bin/perl /usr/bin/smokeping_cgi /etc/smokeping/config<br />
├─17128 /usr/bin/perl /usr/bin/smokeping_cgi /etc/smokeping/config<br />
├─17129 /usr/bin/perl /usr/bin/smokeping_cgi /etc/smokeping/config<br />
└─28321 /usr/bin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf<br />
}}<br />
<br />
Finally, add a symbolic link to allow images to load:<br />
<br />
{{bc|<br />
# ln -s -t /srv/http/smokeping /srv/smokeping/imgcache<br />
}}<br />
<br />
=== Nginx ===<br />
Ensure that {{ic|fcgiwrap.socket}} and {{ic|nginx.service}} are both running via systemctl.<br />
<br />
Add a server block for smokeping to {{ic|/etc/nginx/nginx.conf}}, following is an example for a TLS enabled block.<br />
<br />
server {<br />
server_name smokeping.example.com;<br />
listen 443 ssl http2;<br />
listen [::]:443 ssl http2;<br />
root /srv/http/smokeping/;<br />
index smokeping.fcgi;<br />
gzip off;<br />
location ~ \.fcgi$ {<br />
fastcgi_intercept_errors on;<br />
include /etc/nginx/fastcgi_params;<br />
fastcgi_param SCRIPT_FILENAME /srv/http/smokeping/smokeping.fcgi;<br />
fastcgi_pass unix:/var/run/fcgiwrap.sock;<br />
}<br />
location /imgcache {<br />
alias /srv/smokeping/imgcache;<br />
gzip off;<br />
}<br />
}<br />
<br />
Verify that your config is fine via {{ic|nginx -t}} as the root user and reload the configuration via {{ic|nginx -s reload}} as the root user.<br />
<br />
== Advanced Configuration ==<br />
<br />
Smokeping is a powerful tool that can be configured in many ways. You can setup many different types of probes. You can setup slave smokeping servers that can send their statistics and show you probes from other servers. You can also create your custom probes in perl. These options are currently not covered by this guide, please consult the documentation on the [http://oss.oetiker.ch/smokeping/index.en.html Smokeping website] instead. Also see - https://github.com/oetiker/SmokePing/wiki/FAQ<br />
<br />
== Notes ==<br />
<br />
=== Smoketrace (Tr.cgi) ===<br />
<br />
The [http://oss.oetiker.ch/smokeping/doc/smoketrace.en.html SmokeTraceroute] utility is gone since v2.5.0 according to the [http://oss.oetiker.ch/smokeping/pub/CHANGES release notes].</div>SECuREhttps://wiki.archlinux.org/index.php?title=HiDPI&diff=613990HiDPI2020-05-17T20:24:59Z<p>SECuRE: add OBS Studio instructions</p>
<hr />
<div>[[Category:Graphics]]<br />
[[ja:HiDPI]]<br />
[[zh-hans:HiDPI]]<br />
{{Related articles start}}<br />
{{Related|Font configuration}}<br />
{{Related articles end}}<br />
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.<br />
<br />
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.<br />
<br />
== Desktop environments ==<br />
<br />
=== GNOME ===<br />
To enable HiDPI, navigate to ''Settings > Devices > Displays > Scale'' and choose an appropriate value. Or, use gsettings:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "[{'Gdk/WindowScalingFactor', <2>}]"<br />
$ gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
{{Note|1=GNOME only allows integer scaling numbers to be set. 1 = 100%, 2 = 200%, etc. See Fractional Scaling below.}}<br />
<br />
==== Fractional Scaling ====<br />
<br />
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.<br />
<br />
===== Wayland =====<br />
<br />
Enable the experimental fractional scaling feature:<br />
<br />
$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"<br />
<br />
then open ''Settings > Devices > Displays'' (the new options may only appear after a restart).<br />
<br />
===== Xorg =====<br />
<br />
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]].<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 1.25x1.25<br />
<br />
{{Note|To allow the mouse to reach the whole screen, you may need to use the {{ic|--panning}} option as explained in [[#Side display]].}}<br />
<br />
{{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}}<br />
<br />
GNOME ignores X settings due to its xsettings Plugin in Gnome Settings Daemon, where DPI setting is hard coded.<br />
There is blog entry for [http://blog.drtebi.com/2012/12/changing-dpi-setting-on-gnome-34.html recompiling Gnome Settings Daemon].<br />
In the source documentation there is another way mentioned to set X settings DPI:<br />
<br />
You can use the gsettings, just make sure to read previous setting first and merge it. In just simply set it with this command:<br />
<br />
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Xft/DPI': <153600>}"<br />
<br />
From README.xsettings<br />
<br />
Noting that variants must be specified in the usual way (wrapped in <>).<br />
<br />
Note also that DPI in the above example is expressed in 1024ths of an inch.<br />
<br />
==== Text Scaling ====<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.5<br />
<br />
===== GTK+ vs Gnome Shell elements on Xorg =====<br />
<br />
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]] 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:<br />
<br />
{{hc|usr/share/themes/Adapta/gnome-shell/gnome-shell.css|2=<br />
stage { font-size: 20pt; font-family: Roboto, Noto Sans, Sans-Serif; color: #263238; }<br />
}}<br />
<br />
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.<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Cantarell Bold 22' ## Change as needed<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-uses-system-font false<br />
<br />
=== KDE Plasma ===<br />
<br />
You can use Plasma's settings to fine tune font, icon, and widget scaling. This solution affects both Qt and GTK applications.<br />
<br />
To adjust font, widget, and icon scaling together:<br />
<br />
# ''System Settings > Display and Monitor > Display Configuration > Scale Display''<br />
# Drag the slider to the desired size<br />
# Restart for the settings to take effect<br />
<br />
To adjust only font scaling:<br />
<br />
# ''System Settings > Fonts''<br />
# 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.<br />
<br />
To adjust only icon scaling:<br />
<br />
# ''System Settings > Icons > Advanced''<br />
# Choose the desired icon size for each category listed. This should take effect immediately.<br />
<br />
==== Tray icons with fixed size ====<br />
<br />
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}}.<br />
<br />
=== Xfce ===<br />
<br />
Xfce supports HiDPI scaling which can be enabled using the settings manager:<br />
<br />
# Go to ''Settings Manager > Appearance > Settings > Window Scaling'' and select 2 as the scaling factor.<br />
# Go to ''Settings Manager > Window Manager > Style'' and select {{ic|Default-xhdpi}} theme.<br />
<br />
Alternatively, it is possible to do the same from command line using {{ic|xfconf-query}}:<br />
<br />
xfconf-query -c xsettings -p /Gdk/WindowScalingFactor -s 2<br />
xfconf-query -c xfwm4 -p /general/theme -s Default-xhdpi<br />
<br />
The steps above would set 2x scaled resolution for Xfce and other GTK 3 apps.<br />
<br />
Scaling for Qt 5 apps should be set manually, see [[#Qt 5]].<br />
<br />
=== Cinnamon ===<br />
<br />
Has good support out of the box.<br />
<br />
=== Enlightenment ===<br />
<br />
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.<br />
<br />
== X Resources ==<br />
<br />
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]]:<br />
<br />
{{hc|~/.Xresources|2=<br />
Xft.dpi: 192<br />
<br />
! These might also be useful depending on your monitor and personal preference:<br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintfull<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
}}<br />
<br />
For {{ic|Xft.dpi}}, using integer multiples of 96 usually works best, e.g. 192 for 200% scaling.<br />
<br />
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).<br />
<br />
This will make the font render properly in most toolkits and applications, it will however not affect things such as icon size!<br />
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.<br />
<br />
== X Server ==<br />
<br />
{{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.}}<br />
<br />
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.<br />
<br />
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:<br />
<br />
{{hc|$ xdpyinfo {{!}} grep -B 2 resolution|<br />
screen #0:<br />
dimensions: 3200x1800 pixels (423x238 millimeters)<br />
resolution: 192x192 dots per inch<br />
}}<br />
<br />
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.<br />
<br />
If the DPI displayed by xdpyinfo is not correct, see [[Xorg#Display size and DPI]] for how to fix it.<br />
<br />
== GUI toolkits ==<br />
<br />
=== Qt 5 ===<br />
<br />
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:<br />
<br />
export QT_AUTO_SCREEN_SCALE_FACTOR=1<br />
<br />
If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen ({{ic|QT_SCREEN_SCALE_FACTORS}}) or globally ({{ic|QT_SCALE_FACTOR}}). For more details see the [https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/ Qt blog post] or [https://doc.qt.io/qt-5/highdpi.html Qt developer documentation].<br />
<br />
{{Note|<br />
* 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.<br />
* {{ic|QT_SCALE_FACTOR}} scales fonts, but {{ic|QT_SCREEN_SCALE_FACTORS}} does not scale fonts.<br />
* If you also set the font DPI manually in ''xrdb'' to support other toolkits, {{ic|QT_SCALE_FACTORS}} will give you huge fonts.<br />
* If you have multiple screens of differing DPI ie: [[#Side display]] you may need to do {{ic|1=QT_SCREEN_SCALE_FACTORS="2;2"}}<br />
}}<br />
<br />
An [https://bugreports.qt.io/browse/QTBUG-53022 alternative] is e.g.:<br />
<br />
QT_FONT_DPI=96 vym<br />
<br />
=== GDK 3 (GTK 3) ===<br />
<br />
{{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.}} <br />
<br />
Setting the GDK scale will scale the UI, however it will not scale icons. If you are using a minimal window manager where you are setting the dpi via Xft.dpi, GDK should scale perfectly fine with it. In other cases, [https://developer.gnome.org/gtk3/stable/gtk-x11.html do the following]:<br />
<br />
To scale UI elements by an integer factor:<br />
<br />
$ export GDK_SCALE=2<br />
<br />
To undo scaling of text, fractional scale can be used:<br />
<br />
$ export GDK_DPI_SCALE=0.5<br />
<br />
=== GTK 2 ===<br />
<br />
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|themix-full-git}}.<br />
<br />
=== Elementary (EFL) ===<br />
<br />
To scale UI elements by a factor of 1.5:<br />
<br />
export ELM_SCALE=1.5<br />
<br />
For more details see https://phab.enlightenment.org/w/elementary/<br />
<br />
=== GNUstep ===<br />
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 apps:<br />
<br />
defaults write NSGlobalDomain GSScaleFactor 1.5<br />
<br />
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.<br />
<br />
== Boot managers ==<br />
<br />
=== GRUB ===<br />
<br />
==== Lower the framebuffer resolution ====<br />
<br />
Set a lower resolution for the framebuffer as explained in [[GRUB/Tips and tricks#Setting the framebuffer resolution]].<br />
<br />
==== Change GRUB font size ====<br />
<br />
Find a ttf font that you like in {{ic|/usr/share/fonts/}}.<br />
<br />
Convert the font to a format that GRUB can utilize:<br />
<br />
# grub-mkfont -s 30 -o /boot/grubfont.pf2 /usr/share/fonts/FontFamily/FontName.ttf<br />
<br />
{{Note|Change the {{ic|-s 30}} parameter to modify the font size}}<br />
<br />
Edit {{ic|/etc/default/grub}} to set the new font as shown in [[GRUB/Tips and tricks#Background image and bitmap fonts]]:<br />
<br />
GRUB_FONT="/boot/grubfont.pf2"<br />
<br />
{{Note|{{ic|GRUB_THEME}} overrides {{ic|GRUB_FONT}} if it is used.}}<br />
<br />
Finally [[GRUB#Generate the main configuration file|regenerate the main configuration file]].<br />
<br />
=== systemd-boot ===<br />
<br />
Adding the following line and running {{ic|bootctl update}} increases font-size in the [[systemd-boot#Loader_configuration|systemd-boot]] menu:<br />
<br />
{{hc|/boot/loader/loader.conf|2=<br />
console-mode 1<br />
}}<br />
<br />
== Applications ==<br />
<br />
{{Accuracy|{{ic|--force-device-scale-factor}} only works on Chromium based (including Electron) applications.}}<br />
<br />
As a general rule, applications can be launched with a custom scaling value, e.g. {{ic|1=$ atom --force-device-scale-factor=2}}. A more permanent solution is to add this scaling factor as a flag to the relevant .conf or .desktop file (normally located at {{ic|/usr/share/applications/}}).<br />
<br />
In the latter instance, the flag should be added to the line beginning with "Exec=", e.g. {{ic|1=Exec=/usr/bin/atom --force-device-scale-factor=2 %F}}. For certain configurations, {{AUR|envscale}} can be prepended to the "Exec=" command line to dynamically determine the scale factor and set appropriate process environment variables. The next section provides more details on implementing scaling for specific applications.<br />
<br />
=== Atom ===<br />
<br />
Add {{ic|1=--force-device-scale-factor=2}} as a flag to the atom.desktop file:<br />
<br />
{{hc|/usr/share/applications/atom.desktop|2=<br />
Exec=/usr/bin/atom --force-device-scale-factor=2 %F<br />
}}<br />
<br />
=== Browsers ===<br />
<br />
==== Firefox ====<br />
<br />
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.<br />
<br />
To override those, open Firefox advanced preferences page ({{ic|about:config}}) and set parameter {{ic|layout.css.devPixelsPerPx}} to {{ic|2}} (or find the one that suits you better; {{ic|2}} is a good choice for Retina screens), but it also does not consistently scale the entirety of Firefox. If Firefox is not scaling fonts, you may want to create {{ic|userChrome.css}} and add appropriate styles to it. More information about {{ic|userChrome.css}} at [http://kb.mozillazine.org/index.php?title=UserChrome.css mozillaZine].<br />
<br />
{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|<br />
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");<br />
<br />
/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */<br />
* {<br />
font-size: 15px !important;<br />
}<br />
<br />
/* exception for badge on adblocker */<br />
.toolbarbutton-badge {<br />
font-size: 8px !important;<br />
}<br />
}}<br />
<br />
{{Warning|The AutoHiDPI extension is not compatible with Firefox Quantum (version 57 and above).}}<br />
<br />
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]{{Dead link|2020|03|29|status=404}} 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. For users of Firefox version 57 and above, the [https://addons.mozilla.org/firefox/addon/ffreszoom/ ffreszoom] add-on 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].<br />
<br />
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}}.<br />
<br />
==== Chromium / Google Chrome ====<br />
<br />
Chromium should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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}}.<br />
<br />
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}}:<br />
<br />
{{hc|~/.config/chromium-flags.conf|2=<br />
--force-device-scale-factor=2<br />
}}<br />
<br />
To make this work for Chrome, add the same option to {{ic|~/.config/chrome-flags.conf}} instead.<br />
<br />
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.<br />
<br />
==== Opera ====<br />
<br />
Opera should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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.)<br />
<br />
=== Gimp 2.8 ===<br />
<br />
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}}.)<br />
<br />
There is also the [https://github.com/jedireza/gimp-hidpi gimp-hidpi].<br />
<br />
=== Inkscape ===<br />
<br />
To scale the icons to a "usable" size go to ''Preferences > Interface'' and set the icon size to Large or Larger[http://www.inkscapeforum.com/viewtopic.php?t=18684][http://wiki.inkscape.org/wiki/index.php/HiDPI].<br />
<br />
=== IntelliJ IDEA ===<br />
<br />
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:<br />
<br />
:''File > Settings > Behaviour & Appearance > Appearance''<br />
<br />
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.<br />
<br />
=== Java applications ===<br />
<br />
==== AWT/Swing ====<br />
<br />
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,<br />
<br />
java -Dsun.java2d.uiScale=2 -jar some_swing_application.jar<br />
java -Dsun.java2d.uiScale=300% -jar some_swing_application.jar<br />
<br />
Since Java 9 the {{ic|GDK_SCALE}} environment variable is used to scale Swing applications accordingly.<br />
<br />
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}}.<br />
<br />
==== JavaFX ====<br />
<br />
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,<br />
<br />
java -Dglass.gtk.uiScale=200% -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=192dpi -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=2.0 -jar some_jfx_application.jar<br />
<br />
''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.<br />
<br />
==== Mixed AWT/Swing and JavaFX ====<br />
<br />
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.<br />
<br />
=== MATLAB ===<br />
<br />
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]:<br />
<br />
>> s = settings;s.matlab.desktop.DisplayScaleFactor<br />
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2<br />
<br />
The settings take effect after MATLAB is restarted.<br />
<br />
=== Mono applications ===<br />
<br />
According to [https://bugzilla.xamarin.com/show_bug.cgi?id=35870], 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.<br />
<br />
=== NetBeans ===<br />
<br />
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]<br />
<br />
The editor fontsize can be controlled from ''Tools > Option > Fonts & Colors''.<br />
<br />
The output window fontsize can be controlled from ''Tools > Options > Miscelaneous > Output''<br />
<br />
=== OBS Studio ===<br />
<br />
Start obs with 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]. It is partially buggy (preview window can disappear after first start, depending on window position) and prevents OBS Studio from capturing at native resolution.<br />
<br />
The downside of this option is that the UI elements will now be messed up. To mitigate this, install the Yami theme, which works well on hi-dpi displays:<br />
<br />
$ wget https://github.com/obsproject/obs-studio/archive/fd256a46837033b9a4632327ece3c572bcb3b9b1.tar.gz -O /tmp/yami.tar.gz<br />
$ cd ~/.config/obs-studio<br />
$ tar xf /tmp/yami.tar.gz --strip-components=3 --wildcards '*/UI/data/themes/Yami*'<br />
<br />
Then, open File → Settings → General → Theme and chose Yami.<br />
<br />
=== Skype ===<br />
<br />
Skype for Linux ({{AUR|skypeforlinux-stable-bin}} package) uses [[#GDK 3 (GTK 3)]].<br />
<br />
=== Slack ===<br />
<br />
Slack ({{AUR|slack-desktop}}), like all [https://electronjs.org/ Electron] apps, can be configured to use a custom scaling value by adding a {{ic|1=--force-device-scale-factor}} flag to the .desktop file. This is normally located at {{ic|/usr/share/applications/}}. The flag should be added to the line beginning with "Exec=". For example:<br />
<br />
{{hc|/usr/share/applications/slack.desktop|2=<br />
Exec=env LD_PRELOAD=/usr/lib/libcurl.so.3 /usr/bin/slack --force-device-scale-factor=1.5 %U<br />
}}<br />
<br />
=== Spotify ===<br />
<br />
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:<br />
<br />
{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|2=<br />
app.browser.zoom-level=100<br />
}}<br />
<br />
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<br />
<br />
$ spotify --force-device-scale-factor=1.5<br />
<br />
=== Steam ===<br />
<br />
==== Official HiDPI support ====<br />
<br />
* Starting on 25 of January 2018 in the beta program there is actual support for HiDPI and it should be automatically detected.<br />
* ''Steam > Settings > Interface'', check "Enlarge text and icons based on monitor size" (restart required)<br />
* If it not automatically detected use {{ic|1=GDK_SCALE=2}} to set the desired scale factor.<br />
<br />
==== Unofficial ====<br />
<br />
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. <br />
<br />
{{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}}.}}<br />
<br />
[http://steamcommunity.com/groups/metroskin/discussions/0/517142253861033946/ MetroSkin Unofficial Patch] also helps with HiDPI on Steam with Linux.<br />
<br />
=== Sublime Text 3 ===<br />
<br />
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.<br />
<br />
=== Thunderbird ===<br />
<br />
See [[#Firefox]]. To access {{ic|about:config}}, go to ''Edit > Preferences > Advanced >Config editor''.<br />
<br />
=== VirtualBox ===<br />
<br />
{{Note|This only applies to KDE with scaling enabled.}}<br />
<br />
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]).<br />
<br />
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.<br />
<br />
$ QT_SCALE_FACTOR=0.5 VirtualBox --startvm vm-name<br />
<br />
=== Wine applications ===<br />
<br />
Run<br />
<br />
$ winecfg<br />
<br />
and change the "dpi" setting found in the "Graphics" tab. This only affects the font size.<br />
<br />
=== Zathura document viewer ===<br />
<br />
No modifications required for document viewing.<br />
<br />
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]):<br />
<br />
set font "monospace normal 20"<br />
<br />
=== Zoom ===<br />
<br />
Zoom can be started with a proper scaling by overriding the {{ic|1=QT_SCALE_FACTOR}} environment variable.<br />
<br />
$ QT_SCALE_FACTOR=2 zoom<br />
<br />
=== Unsupported applications ===<br />
<br />
{{AUR|run_scaled-git}} can be used to scale applications (which uses {{Pkg|xpra}} internally).<br />
<br />
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}}.<br />
<br />
[[x11vnc]] has an experimental option {{ic|-appshare}}, which opens one viewer per application window. Perhaps something could be hacked up with that.<br />
<br />
== Multiple displays ==<br />
<br />
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]].<br />
<br />
=== Side display ===<br />
<br />
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:<br />
<br />
$ xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1<br />
<br />
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.<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
{{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].}}<br />
<br />
{{Note|If you are using the {{ic|modesetting}} driver you will get mouse flickering. This can be solved by scaling your non-scaled screen by 0.9999x0.9999.}}<br />
<br />
=== Multiple external monitors ===<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 0.5x0.5 --output DP2 --right-of eDP1 --output HDMI1 --right-of DP2<br />
<br />
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.<br />
<br />
=== Mirroring ===<br />
<br />
If all you want is to mirror ("unify") displays, this is easy as well:<br />
<br />
With AxB your native HiDPI resolution (for ex 3200x1800) and CxD your external screen resolution (e.g. 1920x1200)<br />
<br />
$ xrandr --output HDMI --scale [A/C]x[B/D]<br />
<br />
In this example which is QHD (3200/1920 = 1.66 and 1800/1200 = 1.5)<br />
<br />
$ xrandr --output HDMI --scale 1.66x1.5<br />
<br />
For UHD to 1080p (3840/1920=2 2160/1080=2)<br />
<br />
$ xrandr --output HDMI --scale 2x2<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
=== Tools ===<br />
<br />
There are several tools which automate the commands described above.<br />
<br />
* [https://gist.github.com/wvengen/178642bbc8236c1bdb67 This script] extend a non-HiDPI external display above a HiDPI internal display.<br />
* [https://github.com/ashwinvis/xrandr-extend xrandr-extend].<br />
* {{AUR|xlayoutdisplay}} is a CLI front end for xrandr which detects and sets correct DPI: [https://github.com/alex-courtis/xlayoutdisplay README]<br />
<br />
== Linux console ==<br />
<br />
The [[w:Linux console|Linux console]] changes the font to {{ic|TER16x32}} accordingly based on the resolution of the display. If your monitor is not recognised as hidpi, the default font can be changed.In that case,use {{ic|1=fbcon=font:TER16x32}} on the kernel command line.<br />
<br />
=== Fonts outside the kernel ===<br />
<br />
The largest font present in the {{Pkg|kbd}} package is {{ic|latarcyrheb-sun32}} and other packages like {{Pkg|terminus-font}} contain further alternatives, such as {{ic|ter-132n}} (normal) and {{ic|ter-132b}} (bold). See [[Linux console#Fonts]] for configuration details. Also see [[Linux console#Persistent configuration]] in particular for applying the font setting during the early userspace boot sequence.<br />
<br />
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.<br />
<br />
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.<br />
<br />
== See also ==<br />
<br />
* [http://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)<br />
* [http://www.eizo.com/library/basics/pixel_density_4k/ Understanding pixel density]<br />
* [http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/ Mixed DPI and the X Window System]</div>SECuREhttps://wiki.archlinux.org/index.php?title=Lenovo_ThinkPad_X1_Extreme_(Gen_2)&diff=609154Lenovo ThinkPad X1 Extreme (Gen 2)2020-05-01T10:10:13Z<p>SECuRE: touchpad: add verification/explicit choice of selected Xorg input driver</p>
<hr />
<div>[[Category:Lenovo]]<br />
[[ja:Lenovo ThinkPad X1 Extreme (Gen 2)]]<br />
{{Related articles start}}<br />
{{Related|Laptop/Lenovo}}<br />
{{Related|Lenovo ThinkPad X1 Extreme}}<br />
{{Related articles end}}<br />
{| class="wikitable" style="float: right; clear: right;"<br />
| '''Device''' || '''Status''' || '''Modules'''<br />
|-<br />
| Intel UHD 630 Graphics || {{G|Working}} || i915<br />
|-<br />
| NVIDIA GeForce GTX 1650 || {{G|Working}} || nvidia<br />
|-<br />
| Intel AX200 Wifi || {{G|Working}} || iwlwifi<br />
|-<br />
| Intel HDA || {{G|Working}} || snd_hda_intel<br />
|-<br />
| Synaptics touchpad || {{G|Working}} || libinput<br />
|-<br />
| Chicony Electronics || {{G|Working}} || uvcvideo<br />
|-<br />
| Card reader || {{G|Working}} || xhci_hcd<br />
|-<br />
| Intel AX200 Bluetooth || {{G|Working}} || btusb<br />
|-<br />
| Intel Thunderbolt || {{G|Working}} || thunderbolt<br />
|-<br />
| Synaptics fingerprint reader || {{Y| Initial Support Complete}} || <br />
|}<br />
<br />
The [https://www.lenovo.com/us/en/laptops/thinkpad/thinkpad-x/X1-Extreme-Gen-2/p/22TP2TXX1E2 Thinkpad X1E Gen 2] is a thin-and-light 15.6" workstation/multimedia laptop from Lenovo's 2019 ThinkPad X lineup.<br />
<br />
This page specifically concerns the specifics of running Arch Linux on this laptop. See [[Laptop]] for generic laptop-related information, or [[ThinkPad]] for other ThinkPad laptops.<br />
<br />
== Hardware ==<br />
<br />
=== Thunderbolt 3 ===<br />
<br />
To use Thunderbolt 3, ensure you are on the latest BIOS firmware (doing the following steps on older BIOSes may brick your device):<br />
<br />
1. Go into BIOS<br />
<br />
2. Enable BIOS Assist mode: (Thunderbolt 3 -> Enable BIOS assist mode) *Ensure you're on the latest BIOS!*<br />
<br />
=== Battery ===<br />
<br />
==== Invalid stats workaround ====<br />
<br />
As of writing, [https://bbs.archlinux.org/viewtopic.php?pid=1859876 a bug exists] where the battery data can appear corrupt, wildly incorrect, or seem to change drastically from boot to boot. To workaround this bug you should add battery to the {{ic|/etc/mkinitcpio.conf}}.<br />
<br />
MODULES=('''battery''')<br />
<br />
Remember to [[regenerate the initramfs]] for these changes to take effect.<br />
<br />
{{Note|You can also build the battery module into your kernel.}}<br />
<br />
==== Battery life and graphics ====<br />
<br />
[https://bbs.archlinux.org/viewtopic.php?id=238389 bbswitch does not work] on this laptop to disable the NVIDIA card when not in use. To disable the NVIDIA card you can run:<br />
<br />
# tee /sys/bus/pci/devices/0000\:01\:00.1/remove <<<1<br />
# tee /sys/bus/pci/devices/0000\:01\:00.0/remove <<<1<br />
<br />
{{Note|It may be much easier to just use optimus manager with the necessary power options described in [[#Graphics]]}}<br />
<br />
=== Graphics ===<br />
<br />
==== Nouveau ====<br />
<br />
Currently (5.2.9-arch1), the Nouveau driver can cause quite a lot of kernel panics when using the webcamera. You should blacklist this driver to prevent it from being loaded. <br />
<br />
==== NVIDIA ====<br />
<br />
===== Prime features =====<br />
<br />
The NVIDIA driver now supports PRIME Offloading. [http://download.nvidia.com/XFree86/Linux-x86_64/435.17/README/primerenderoffload.html Following this guide] you can try out this new mode. However, [https://forum.manjaro.org/t/nvidia-render-offloading-help-getting-external-monitor-working/99430/22 external display ports will not work with only this method].<br />
<br />
===== Power Management =====<br />
<br />
To get the best power options the graphics card may be configured to use low power mode by [http://download.nvidia.com/XFree86/Linux-x86_64/435.17/README/dynamicpowermanagement.html following the guide here]<br />
<br />
===== Optimus manager =====<br />
<br />
Currently, one of the easiest solutions for this laptop is to use [https://github.com/Askannz/optimus-manager optimus-manager] with the hybrid backend. This requires the most up to date nvidia and xorg-server packages.<br />
<br />
This allows easy switching between the PRIME offloading feature above, and a mode where external display ports (HDMI and USB-C) work.<br />
<br />
Steps to setup after a fresh install:<br />
* install nvidia proprietary driver 'prime', not bumblebee. (in manjaro use automatic Hardware Detection in Manjaro Settings Manager)<br />
* reboot<br />
* install {{AUR|optimus-manager}}<br />
* reboot<br />
* `optimus-manager --switch nvidia` # this will restart your X session, but not make the change persistent<br />
* `lspci -k | grep -A 2 -E "(VGA|3D)"` should say: Kernel driver in use: nvidia<br />
* `xrandr` should list HDMI output - try to configure screen, should work<br />
* `nvidia-settings` should work<br />
* `optimus-manager --set-startup nvidia` makes it persistent<br />
* check: reboot, external display should still work<br />
<br />
<br />
=== OLED Display ===<br />
<br />
==== Brightness control ====<br />
<br />
OLED screens have no backlight, brightness cannot be controlled by changing backlight power in the traditional way. Instead, it can be controlled using PWM by enabling following option:<br />
<br />
echo "options i915 enable_dpcd_backlight=1" >> /etc/modprobe.d/i915.conf<br />
<br />
Alternatively, you can add a kernel parameter. For example, if you are using GRUB, edit /etc/default/grub with <br />
<br />
GRUB_CMDLINE_LINUX_DEFAULT="i915.enable_dpcd_backlight=1"<br />
<br />
Don't forget to [[GRUB#Generate the main configuration file|update the grub configuration]] to apply the changes.<br />
<br />
Brightness control is not yet supported by standard tools. You can try this one https://github.com/deimosfr/oled_backlight<br />
<br />
=== Audio ===<br />
<br />
==== Audio pop on shutdown and startup ====<br />
<br />
To work around the loud audio artifacts on startup/shutdown follow the guide for enabling the audio powersave: [[Power management#Audio]].<br />
<br />
=== Fingerprint ===<br />
<br />
The 2.0 version of fprint [https://gitlab.freedesktop.org/libfprint/libfprint/issues/181 supports this device] after a firmware update.<br />
<br />
To get fingerprint working right now:<br />
<br />
{{Note|The Firmware for this is still in the testing phase at LVFS. Proceed with caution. }}<br />
<br />
Install the following packages available on the [[AUR]] :<br />
<br />
* {{AUR|libfprint-git}}<br />
* {{AUR|fprintd-libfprint2}}<br />
<br />
And setup [[fwupd]]<br />
<br />
The firmware updates currently require the newest version of fwupd and you must manually download the updates:<br />
<br />
* https://fwupd.org/lvfs/devices/com.synaptics.prometheus.firmware<br />
* https://fwupd.org/lvfs/devices/com.synaptics.prometheus.config<br />
<br />
using the latest version of the fwupd tool you should be able to run:<br />
<br />
fwupdmgr get-devices<br />
<br />
and see a "Prometheus" device in the list.<br />
<br />
Install the firmware by running<br />
<br />
fwupdmgr install *.cab<br />
<br />
on each downloaded .cab file<br />
<br />
{{Note|At this point, a reboot may be required }}<br />
<br />
You should then be able to enroll your fingerprints with [[Fprint#Configuration]]<br />
<br />
{{Note|For some reason, [https://gitlab.freedesktop.org/libfprint/libfprint/issues/207 the fprint.service can take some time to start. if fprint reports no devices, wait until fprint.service has completely stopped (it should become inactive in systemctl) To fix this, reset the fingerprint data in your bios settings] }}<br />
<br />
=== Card reader ===<br />
<br />
The optional card reader that the Lenovo can install in your laptop is a Alcor Micro AU9560. There are some tools you can use to test your card reader.<br />
<br />
==== Installation ====<br />
<br />
<br />
Install {{Pkg|ccid}} and {{Pkg|opensc}} from [[official repositories]]. Then, [[Start]] and enable {{ic|pcscd.socket}}.<br />
<br />
systemctl enable pcscd<br />
systemctl start pcscd<br />
<br />
==== Testing ====<br />
<br />
First, verify that your card reader can be found by pcsc:<br />
<br />
opensc-tool --list-readers<br />
<br />
Now, insert a smart card and run the following to verify that pcsc is able to read your card:<br />
<br />
pcsc_scan<br />
<br />
=== Webcam ===<br />
<br />
The webcam in this laptop is capable of "Windows Hello" which has a Linux version called [[Howdy]]. The device you should use to configure howdy on this laptop is {{ic|/dev/video0}}.<br />
<br />
=== Keyboard ===<br />
<br />
==== Backlight ====<br />
<br />
If you would like to enable the keyboard backlight, run:<br />
<br />
echo 2 | tee /sys/class/leds/tpacpi::kbd_backlight/brightness<br />
<br />
The "2" represents the brightness and can be any value between 0 and 2 (inclusive) for the laptop. For example, to turn off the keyboard backlight, you would run:<br />
<br />
echo 0 | tee /sys/class/leds/tpacpi::kbd_backlight/brightness<br />
<br />
==== Skipping keystrokes ====<br />
<br />
There is an issue with keystrokes being skipped at times ([https://forums.lenovo.com/t5/ThinkPad-X-Series-Laptops/X1-Extreme-Gen-2-missing-keystrokes/td-p/4569936?page=72 see the Lenovo forums]). This is resolved with system firmware version 1.30. See [[#Firmware|Firmware]] to check your current version and upgrade.<br />
<br />
=== Touchpad ===<br />
<br />
The touchpad works out-of-the-box with libinput. However, it will be very insensitive.<br />
<br />
Make sure to not install {{Pkg|xf86-input-synaptics}} - this driver is deprecated, lacks all features mentioned below, but is still installed by default with the {{Grp|xorg-drivers}} group.<br />
<br />
You can check which input driver Xorg is using for your touchpad with:<br />
<br />
grep 'Using input driver' /var/log/Xorg.0.log | grep 'SynPS/2 Synaptics TouchPad'<br />
# Expected output: [ 248.282] (II) Using input driver 'libinput' for 'SynPS/2 Synaptics TouchPad'<br />
<br />
You can explicitly chose an input driver by placing an Xorg configuration snippet like the following in /etc/X11/xorg.conf.d/99-synaptics.conf:<br />
<br />
Section "InputClass"<br />
Identifier "touchpad catchall"<br />
MatchIsTouchpad "on"<br />
Driver "libinput"<br />
EndSection<br />
<br />
==== Acceleration ====<br />
<br />
You can adjust acceleration using the command:<br />
<br />
xinput set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Accel Speed' 0.5<br />
<br />
==== Two-Finger Right Click ====<br />
<br />
Additionally, if you wish to disable right-clicking so that you use two finger click as your right click, run:<br />
<br />
xinput set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Click Method Enabled' 0 1 <br />
<br />
==== Tap Clicking ====<br />
<br />
If you would like for a tap on the touchpad to be registered as a click, use:<br />
<br />
xinput set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Tapping Enabled' 1<br />
<br />
== Firmware ==<br />
<br />
BIOS and firmware updates are available via [[fwupd]], the Lenovo Vantage application on Windows, or from [https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x1-extreme-gen-2/downloads Lenovo's website].<br />
<br />
The latest BIOS version is highly recommended. All information on this page should assume the latest BIOS unless explicitly stated otherwise.<br />
<br />
{{Note|To install Arch Linux you need to disable [[Secure Boot]]. If you cannot do so (e.g. because of {{ic|error: failed to save storage - write protected}}), it may help to reset the BIOS to factory defaults (F9) and/or upgrade your BIOS.}}<br />
<br />
=== Check BIOS version ===<br />
<br />
From Lenovo's firmware readme, to check the system's installed BIOS version:<br />
<br />
{{bc|<br />
DETERMINING WHICH VERSION IS INSTALLED<br />
<br />
[Checking on ThinkPad Setup]<br />
<br />
1. Turn on the computer.<br />
2. While the "To interrupt normal startup, press Enter" message is displayed<br />
at the lower-left area or lower-center of the screen, press the F1 key.<br />
The ThinkPad Setup menu will be displayed. If a password prompt appears,<br />
type the correct password.<br />
3. Locate the UEFI BIOS Version line.<br />
"UEFI BIOS version (BIOS ID)" will be shown on the UEFI BIOS Version line.<br />
4. Turn off the computer.<br />
}}<br />
<br />
Alternatively, use fwupdmgr from [[fwupd]] without rebooting:<br />
<br />
{{hc|head=$ fwupdmgr get-devices|output=<br />
...<br />
├─System Firmware:<br />
│ Current version: 0.1.30<br />
...<br />
}}<br />
<br />
=== Upgrading BIOS ===<br />
<br />
Download the zip file labelled "BIOS Update Utility (Linux)" from [https://support.lenovo.com/us/en/downloads/ds540308 Lenovo's support website]. Extract the zip file, then use [[fwupd]] to update the firmware:<br />
<br />
$ su<br />
# fwupdmgr install <filename>.cab<br />
<br />
Then reboot immediately to finish the upgrade.<br />
<br />
== Software ==<br />
<br />
=== Throttling fix ===<br />
<br />
You will see a dmesg error that talks about CPU throttling. <br />
<br />
There are a few ways to fix this. You should only use one of the following as they both attempt to undervolt.<br />
<br />
==== Throttled ====<br />
<br />
To fix this install {{Pkg|throttled}}, then run <br />
<br />
systemctl enable --now lenovo_fix.service<br />
<br />
==== CPU undervolting ====<br />
<br />
Undervolting the CPU/Intel GPU works well with [[Undervolting_CPU#intel-undervolt|intel-undervolt]].</div>SECuREhttps://wiki.archlinux.org/index.php?title=HiDPI&diff=593704HiDPI2020-01-01T22:11:43Z<p>SECuRE: /* X Resources */ add a comment for the non-Xft.dpi options mentioned in the Xresources example</p>
<hr />
<div>[[Category:Graphics]]<br />
[[ja:HiDPI]]<br />
[[zh-hans:HiDPI]]<br />
{{Related articles start}}<br />
{{Related|Font configuration}}<br />
{{Related articles end}}<br />
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.<br />
<br />
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.<br />
<br />
== Desktop environments ==<br />
<br />
=== GNOME ===<br />
To enable HiDPI, navigate to ''Settings > Devices > Displays > Scale'' and choose an appropriate value. Or, use gsettings:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "[{'Gdk/WindowScalingFactor', <2>}]"<br />
$ gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
{{Note|1=GNOME only allows integer scaling numbers to be set. 1 = 100%, 2 = 200%, etc. See Fractional Scaling below.}}<br />
<br />
==== Fractional Scaling ====<br />
<br />
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.<br />
<br />
===== Wayland =====<br />
<br />
Enable the experimental fractional scaling feature:<br />
<br />
$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"<br />
<br />
then open ''Settings > Devices > Displays'' (the new options may only appear after a restart).<br />
<br />
===== Xorg =====<br />
<br />
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]].<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 1.25x1.25<br />
<br />
{{Note|To allow the mouse to reach the whole screen, you may need to use the {{ic|--panning}} option as explained in [[#Side display]].}}<br />
<br />
{{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}}<br />
<br />
GNOME ignores X settings due to its xsettings Plugin in Gnome Settings Daemon, where DPI setting is hard coded.<br />
There is blog entry for [http://blog.drtebi.com/2012/12/changing-dpi-setting-on-gnome-34.html recompiling Gnome Settings Daemon].<br />
In the source documentation there is another way mentioned to set X settings DPI:<br />
<br />
You can use the dconf Editor and navigate to key <br />
<br />
/org/gnome/settings-daemon/plugins/xsettings/overrides<br />
<br />
and complement the entry with the value<br />
<br />
'Xft/DPI': <153600><br />
<br />
From README.xsettings<br />
<br />
Noting that variants must be specified in the usual way (wrapped in <>).<br />
<br />
Note also that DPI in the above example is expressed in 1024ths of an inch.<br />
<br />
==== Text Scaling ====<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.5<br />
<br />
===== GTK+ vs Gnome Shell elements on Xorg =====<br />
<br />
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]] toolkit. Note that this is a long-standing issue to which a recent patch has been submitted.[https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/486] However, as of October 2019, the proposed patch has yet to be merged with the main GNOME codebase. In the interim, 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:<br />
<br />
{{hc|usr/share/themes/Adapta/gnome-shell/gnome-shell.css|2=<br />
stage { font-size: 20pt; font-family: Roboto, Noto Sans, Sans-Serif; color: #263238; }<br />
}}<br />
<br />
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.<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Cantarell Bold 22' ## Change as needed<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-uses-system-font false<br />
<br />
=== KDE Plasma ===<br />
<br />
You can use Plasma's settings to fine tune font, icon, and widget scaling. This solution affects both Qt and GTK applications.<br />
<br />
To adjust font, widget, and icon scaling together:<br />
<br />
# ''System Settings > Display and Monitor > Display Configuration > Scale Display''<br />
# Drag the slider to the desired size<br />
# Restart for the settings to take effect<br />
<br />
To adjust only font scaling:<br />
<br />
# ''System Settings > Fonts''<br />
# 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.<br />
<br />
To adjust only icon scaling:<br />
<br />
# ''System Settings > Icons > Advanced''<br />
# Choose the desired icon size for each category listed. This should take effect immediately.<br />
<br />
'''Display Scale not integer bug'''<br />
{{Accuracy|This doesn't seem to be necessary any more, only do it if you encounter this issue.}}<br />
When using not integer values for Display Scale it may causes font render issue in some Qt application. A workaround for this is to:<br />
<br />
# Set the scale value to {{ic|1}}<br />
# Adjust your font and icons and use the "Force fonts DPI" ( this affects all apps, also GTK but not create issue with the fonts )<br />
# Restart Plasma<br />
# If required tune the GTK apps using the variables {{ic|GDK_SCALE}}/{{ic|GDK_DPI_SCALE}} (as described above)<br />
<br />
==== Tray icons with fixed size ====<br />
<br />
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}}.<br />
<br />
=== Xfce ===<br />
<br />
Xfce supports HiDPI scaling which can be enabled using the settings manager:<br />
<br />
# Go to ''Settings Manager > Appearance > Settings > Window Scaling'' and select 2 as the scaling factor.<br />
# Go to ''Settings Manager > Window Manager > Style'' and select {{ic|Default-xhdpi}} theme.<br />
<br />
Alternatively, it is possible to do the same from command line using {{ic|xfconf-query}}:<br />
<br />
xfconf-query -c xsettings -p /Gdk/WindowScalingFactor -s 2<br />
xfconf-query -c xfwm4 -p /general/theme -s Default-xhdpi<br />
<br />
The steps above would set 2x scaled resolution for Xfce and other GTK 3 apps.<br />
<br />
Scaling for Qt 5 apps should be set manually, see [[#Qt 5]].<br />
<br />
=== Cinnamon ===<br />
<br />
Has good support out of the box.<br />
<br />
=== Enlightenment ===<br />
<br />
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.<br />
<br />
== X Resources ==<br />
<br />
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]]:<br />
<br />
{{hc|~/.Xresources|2=<br />
Xft.dpi: 192<br />
<br />
! These might also be useful depending on your monitor and personal preference:<br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintfull<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
}}<br />
<br />
For {{ic|Xft.dpi}}, using integer multiples of 96 usually works best, e.g. 192 for 200% scaling such as on a Dell XPS notebook.<br />
<br />
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).<br />
<br />
This will make the font render properly in most toolkits and applications. In some applications, icon resolution and/or sizes might still be incorrect, but that should be reported as a bug with the application.<br />
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.<br />
<br />
== X Server ==<br />
<br />
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.<br />
<br />
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:<br />
<br />
{{hc|$ xdpyinfo {{!}} grep -B 2 resolution|<br />
screen #0:<br />
dimensions: 3200x1800 pixels (423x238 millimeters)<br />
resolution: 192x192 dots per inch<br />
}}<br />
<br />
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.<br />
<br />
If the DPI displayed by xdpyinfo is not correct, see [[Xorg#Display size and DPI]] for how to fix it.<br />
<br />
== GUI toolkits ==<br />
<br />
=== Qt 5 ===<br />
<br />
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:<br />
<br />
export QT_AUTO_SCREEN_SCALE_FACTOR=1<br />
<br />
If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen ({{ic|QT_SCREEN_SCALE_FACTORS}}) or globally ({{ic|QT_SCALE_FACTOR}}). For more details see the [https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/ Qt blog post] or [https://doc.qt.io/qt-5/highdpi.html Qt developer documentation].<br />
<br />
{{Note|<br />
* 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.<br />
* {{ic|QT_SCALE_FACTOR}} scales fonts, but {{ic|QT_SCREEN_SCALE_FACTORS}} does not scale fonts.<br />
* If you also set the font DPI manually in ''xrdb'' to support other toolkits, {{ic|QT_SCALE_FACTORS}} will give you huge fonts.<br />
* If you have multiple screens of differing DPI ie: [[#Side display]] you may need to do {{ic|1=QT_SCREEN_SCALE_FACTORS="2;2"}}<br />
}}<br />
<br />
An [https://bugreports.qt.io/browse/QTBUG-53022 alternative] is e.g.:<br />
<br />
QT_FONT_DPI=96 vym<br />
<br />
=== GDK 3 (GTK 3) ===<br />
<br />
{{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.}} <br />
<br />
Setting the GDK scale will scale the UI, however it will not scale icons. If you are using a minimal window manager where you are setting the dpi via Xft.dpi, GDK should scale perfectly fine with it. In other cases, do the following:<br />
<br />
To scale UI elements by a factor of two:<br />
<br />
export GDK_SCALE=2<br />
<br />
To undo scaling of text:<br />
<br />
export GDK_DPI_SCALE=0.5<br />
<br />
=== GTK 2 ===<br />
<br />
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}}.<br />
<br />
=== Elementary (EFL) ===<br />
<br />
To scale UI elements by a factor of 1.5:<br />
<br />
export ELM_SCALE=1.5<br />
<br />
For more details see https://phab.enlightenment.org/w/elementary/<br />
<br />
== Boot managers ==<br />
<br />
=== GRUB ===<br />
<br />
==== Lower the framebuffer resolution ====<br />
<br />
Set a lower resolution for the framebuffer as explained in [[GRUB/Tips and tricks#Setting the framebuffer resolution]].<br />
<br />
==== Change GRUB font size ====<br />
<br />
Find a ttf font that you like in {{ic|/usr/share/fonts/}}.<br />
<br />
Convert the font to a format that GRUB can utilize:<br />
<br />
# grub-mkfont -s 30 -o /boot/grubfont.pf2 /usr/share/fonts/FontFamily/FontName.ttf<br />
<br />
{{Note|Change the {{ic|-s 30}} parameter to modify the font size}}<br />
<br />
Edit {{ic|/etc/default/grub}} to set the new font as shown in [[GRUB/Tips and tricks#Background image and bitmap fonts]]:<br />
<br />
GRUB_FONT="/boot/grubfont.pf2"<br />
<br />
Update GRUB configuration by running {{ic|grub-mkconfig -o /boot/grub/grub.cfg}}<br />
<br />
=== systemd-boot ===<br />
<br />
Adding the following line and running {{ic|bootctl update}} increases font-size in the [[systemd-boot#Loader_configuration|systemd-boot]] menu:<br />
<br />
{{hc|/boot/loader/loader.conf|2=<br />
console-mode 1<br />
}}<br />
<br />
== Applications ==<br />
<br />
{{Accuracy|{{ic|--force-device-scale-factor}} only works on Chromium based (including Electron) applications.}}<br />
<br />
As a general rule, applications can be launched with a custom scaling value, e.g. {{ic|1=$ atom --force-device-scale-factor=2}}. A more permanent solution is to add this scaling factor as a flag to the relevant .conf or .desktop file (normally located at {{ic|/usr/share/applications/}}). In the latter instance, the flag should be added to the line beginning with "Exec=", e.g. {{ic|1=Exec=/usr/bin/atom --force-device-scale-factor=2 %F}}. The next section provides more details on implementing this for specific applications.<br />
<br />
=== Atom ===<br />
<br />
Add {{ic|1=--force-device-scale-factor=2}} as a flag to the atom.desktop file:<br />
<br />
{{hc|/usr/share/applications/atom.desktop|2=<br />
Exec=/usr/bin/atom --force-device-scale-factor=2 %F<br />
}}<br />
<br />
=== Browsers ===<br />
<br />
==== Firefox ====<br />
<br />
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.<br />
<br />
To override those, open Firefox advanced preferences page ({{ic|about:config}}) and set parameter {{ic|layout.css.devPixelsPerPx}} to {{ic|2}} (or find the one that suits you better; {{ic|2}} is a good choice for Retina screens), but it also does not consistently scale the entirety of Firefox. If Firefox is not scaling fonts, you may want to create {{ic|userChrome.css}} and add appropriate styles to it. More information about {{ic|userChrome.css}} at [http://kb.mozillazine.org/index.php?title=UserChrome.css mozillaZine].<br />
<br />
{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|<br />
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");<br />
<br />
/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */<br />
* {<br />
font-size: 15px !important;<br />
}<br />
<br />
/* exception for badge on adblocker */<br />
.toolbarbutton-badge {<br />
font-size: 8px !important;<br />
}<br />
}}<br />
<br />
{{Warning|The AutoHiDPI extension is not compatible with Firefox Quantum (version 57 and above).}}<br />
<br />
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. For users of Firefox version 57 and above, the [https://addons.mozilla.org/firefox/addon/ffreszoom/ ffreszoom] add-on 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].<br />
<br />
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}}.<br />
<br />
You can also use the Wayland-enabled packages of Firefox from the AUR: {{AUR|firefox-wayland}} (compiles from source) or {{AUR|fedora-firefox-wayland-bin}} (binary from Fedora). You might experience some minor visual glitches with these packages.<br />
<br />
==== Chromium / Google Chrome ====<br />
<br />
Chromium should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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}}.<br />
<br />
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}}:<br />
<br />
{{hc|~/.config/chromium-flags.conf|2=<br />
--force-device-scale-factor=2<br />
}}<br />
<br />
To make this work for Chrome, add the same option to {{ic|~/.config/chrome-flags.conf}} instead.<br />
<br />
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.<br />
<br />
==== Opera ====<br />
<br />
Opera should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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.)<br />
<br />
=== Gimp 2.8 ===<br />
<br />
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}}.)<br />
<br />
There is also the [https://github.com/jedireza/gimp-hidpi gimp-hidpi].<br />
<br />
=== Inkscape ===<br />
<br />
To scale the icons to a "usable" size go to ''Preferences > Interface'' and set the icon size to Large or Larger[http://www.inkscapeforum.com/viewtopic.php?t=18684][http://wiki.inkscape.org/wiki/index.php/HiDPI].<br />
<br />
=== IntelliJ IDEA ===<br />
<br />
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:<br />
<br />
:''File > Settings > Behaviour & Appearance > Appearance''<br />
<br />
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.<br />
<br />
=== Java applications ===<br />
<br />
==== AWT/Swing ====<br />
<br />
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,<br />
<br />
java -Dsun.java2d.uiScale=2 -jar some_swing_application.jar<br />
java -Dsun.java2d.uiScale=300% -jar some_swing_application.jar<br />
<br />
Since Java 9 the {{ic|GDK_SCALE}} environment variable is used to scale Swing applications accordingly.<br />
<br />
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}}.<br />
<br />
==== JavaFX ====<br />
<br />
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,<br />
<br />
java -Dglass.gtk.uiScale=200% -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=192dpi -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=2.0 -jar some_jfx_application.jar<br />
<br />
''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.<br />
<br />
==== Mixed AWT/Swing and JavaFX ====<br />
<br />
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.<br />
<br />
=== MATLAB ===<br />
<br />
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]:<br />
<br />
>> s = settings;s.matlab.desktop.DisplayScaleFactor<br />
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2<br />
<br />
The settings take effect after MATLAB is restarted.<br />
<br />
=== Mono applications ===<br />
<br />
According to [https://bugzilla.xamarin.com/show_bug.cgi?id=35870], Mono applications should be scalable like [[#GDK 3 (GTK 3)|GTK 3]] applications.<br />
<br />
=== NetBeans ===<br />
<br />
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]<br />
<br />
The editor fontsize can be controlled from ''Tools > Option > Fonts & Colors''.<br />
<br />
The output window fontsize can be controlled from ''Tools > Options > Miscelaneous > Output''<br />
<br />
=== Skype ===<br />
<br />
Skype for Linux ({{AUR|skypeforlinux-stable-bin}} package) uses [[#GDK 3 (GTK 3)]].<br />
<br />
=== Slack ===<br />
<br />
Slack ({{AUR|slack-desktop}}), like all [https://electronjs.org/ Electron] apps, can be configured to use a custom scaling value by adding a {{ic|1=--force-device-scale-factor}} flag to the .desktop file. This is normally located at {{ic|/usr/share/applications/}}. The flag should be added to the line beginning with "Exec=". For example:<br />
<br />
{{hc|/usr/share/applications/slack.desktop|2=<br />
Exec=env LD_PRELOAD=/usr/lib/libcurl.so.3 /usr/bin/slack --force-device-scale-factor=1.5 %U<br />
}}<br />
<br />
=== Spotify ===<br />
<br />
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:<br />
<br />
{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|2=<br />
app.browser.zoom-level=100<br />
}}<br />
<br />
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<br />
<br />
$ spotify --force-device-scale-factor=1.5<br />
<br />
=== Steam ===<br />
<br />
==== Official HiDPI support ====<br />
<br />
* Starting on 25 of January 2018 in the beta program there is actual support for HiDPI and it should be automatically detected.<br />
* ''Steam > Settings > Interface'', check "Enlarge text and icons based on monitor size" (restart required)<br />
* If it not automatically detected use {{ic|1=GDK_SCALE=2}} to set the desired scale factor.<br />
<br />
==== Unofficial ====<br />
<br />
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. <br />
<br />
{{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}}.}}<br />
<br />
[http://steamcommunity.com/groups/metroskin/discussions/0/517142253861033946/ MetroSkin Unofficial Patch] also helps with HiDPI on Steam with Linux.<br />
<br />
=== Sublime Text 3 ===<br />
<br />
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.<br />
<br />
=== Thunderbird ===<br />
<br />
See [[#Firefox]]. To access {{ic|about:config}}, go to ''Edit > Preferences > Advanced >Config editor''.<br />
<br />
=== VirtualBox ===<br />
<br />
{{Note|This only applies to KDE with scaling enabled.}}<br />
<br />
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]).<br />
<br />
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.<br />
<br />
$ QT_SCALE_FACTOR=0.5 VirtualBox --startvm vm-name<br />
<br />
=== Wine applications ===<br />
<br />
Run<br />
<br />
$ winecfg<br />
<br />
and change the "dpi" setting found in the "Graphics" tab. This only affects the font size.<br />
<br />
=== Zathura document viewer ===<br />
<br />
No modifications required for document viewing.<br />
<br />
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]):<br />
<br />
set font "monospace normal 20"<br />
<br />
=== Zoom ===<br />
<br />
Zoom can be started with a proper scaling by overriding the {{ic|1=QT_SCALE_FACTOR}} environment variable.<br />
<br />
$ QT_SCALE_FACTOR=2 zoom<br />
<br />
=== Unsupported applications ===<br />
<br />
{{AUR|run_scaled-git}} can be used to scale applications (which uses {{Pkg|xpra}} internally).<br />
<br />
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}}.<br />
<br />
[[x11vnc]] has an experimental option {{ic|-appshare}}, which opens one viewer per application window. Perhaps something could be hacked up with that.<br />
<br />
== Multiple displays ==<br />
<br />
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]].<br />
<br />
=== Side display ===<br />
<br />
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:<br />
<br />
$ xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1<br />
<br />
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.<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
{{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].}}<br />
<br />
{{Note|If you are using the {{ic|modesetting}} driver you will get mouse flickering. This can be solved by scaling your non-scaled screen by 0.9999x0.9999.}}<br />
<br />
=== Multiple external monitors ===<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 0.5x0.5 --output DP2 --right-of eDP1 --output HDMI1 --right-of DP2<br />
<br />
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.<br />
<br />
=== Mirroring ===<br />
<br />
If all you want is to mirror ("unify") displays, this is easy as well:<br />
<br />
With AxB your native HiDPI resolution (for ex 3200x1800) and CxD your external screen resolution (e.g. 1920x1200)<br />
<br />
$ xrandr --output HDMI --scale [A/C]x[B/D]<br />
<br />
In this example which is QHD (3200/1920 = 1.66 and 1800/1200 = 1.5)<br />
<br />
$ xrandr --output HDMI --scale 1.66x1.5<br />
<br />
For UHD to 1080p (3840/1920=2 2160/1080=2)<br />
<br />
$ xrandr --output HDMI --scale 2x2<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
=== Tools ===<br />
<br />
There are several tools which automate the commands described above.<br />
<br />
* [https://gist.github.com/wvengen/178642bbc8236c1bdb67 This script] extend a non-HiDPI external display above a HiDPI internal display.<br />
* [https://github.com/ashwinvis/xrandr-extend xrandr-extend].<br />
* {{AUR|xlayoutdisplay}} is a CLI front end for xrandr which detects and sets correct DPI: [https://github.com/alex-courtis/xlayoutdisplay README]<br />
<br />
== Linux console ==<br />
<br />
The default [[w:Linux console|Linux console]] font will be very small on HiDPI displays, the largest font present in the {{Pkg|kbd}} package is {{ic|latarcyrheb-sun32}} and other packages like {{Pkg|terminus-font}} contain further alternatives, such as {{ic|ter-132n}}(normal) and {{ic|ter-132b}}(bold). See [[Linux console#Fonts]] for configuration details. Also see [[Linux console#Persistent configuration]] in particular for applying the font setting during the early userspace boot sequence.<br />
<br />
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.<br />
<br />
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.<br />
<br />
== See also ==<br />
<br />
* [http://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)<br />
* [http://www.eizo.com/library/basics/pixel_density_4k/ Understanding pixel density]<br />
* [http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/ Mixed DPI and the X Window System]</div>SECuREhttps://wiki.archlinux.org/index.php?title=HiDPI&diff=593703HiDPI2020-01-01T22:10:53Z<p>SECuRE: /* X Resources */ recommend filing bugs for apps which don’t scale correctly</p>
<hr />
<div>[[Category:Graphics]]<br />
[[ja:HiDPI]]<br />
[[zh-hans:HiDPI]]<br />
{{Related articles start}}<br />
{{Related|Font configuration}}<br />
{{Related articles end}}<br />
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.<br />
<br />
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.<br />
<br />
== Desktop environments ==<br />
<br />
=== GNOME ===<br />
To enable HiDPI, navigate to ''Settings > Devices > Displays > Scale'' and choose an appropriate value. Or, use gsettings:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "[{'Gdk/WindowScalingFactor', <2>}]"<br />
$ gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
{{Note|1=GNOME only allows integer scaling numbers to be set. 1 = 100%, 2 = 200%, etc. See Fractional Scaling below.}}<br />
<br />
==== Fractional Scaling ====<br />
<br />
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.<br />
<br />
===== Wayland =====<br />
<br />
Enable the experimental fractional scaling feature:<br />
<br />
$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"<br />
<br />
then open ''Settings > Devices > Displays'' (the new options may only appear after a restart).<br />
<br />
===== Xorg =====<br />
<br />
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]].<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 1.25x1.25<br />
<br />
{{Note|To allow the mouse to reach the whole screen, you may need to use the {{ic|--panning}} option as explained in [[#Side display]].}}<br />
<br />
{{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}}<br />
<br />
GNOME ignores X settings due to its xsettings Plugin in Gnome Settings Daemon, where DPI setting is hard coded.<br />
There is blog entry for [http://blog.drtebi.com/2012/12/changing-dpi-setting-on-gnome-34.html recompiling Gnome Settings Daemon].<br />
In the source documentation there is another way mentioned to set X settings DPI:<br />
<br />
You can use the dconf Editor and navigate to key <br />
<br />
/org/gnome/settings-daemon/plugins/xsettings/overrides<br />
<br />
and complement the entry with the value<br />
<br />
'Xft/DPI': <153600><br />
<br />
From README.xsettings<br />
<br />
Noting that variants must be specified in the usual way (wrapped in <>).<br />
<br />
Note also that DPI in the above example is expressed in 1024ths of an inch.<br />
<br />
==== Text Scaling ====<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.5<br />
<br />
===== GTK+ vs Gnome Shell elements on Xorg =====<br />
<br />
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]] toolkit. Note that this is a long-standing issue to which a recent patch has been submitted.[https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/486] However, as of October 2019, the proposed patch has yet to be merged with the main GNOME codebase. In the interim, 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:<br />
<br />
{{hc|usr/share/themes/Adapta/gnome-shell/gnome-shell.css|2=<br />
stage { font-size: 20pt; font-family: Roboto, Noto Sans, Sans-Serif; color: #263238; }<br />
}}<br />
<br />
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.<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Cantarell Bold 22' ## Change as needed<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-uses-system-font false<br />
<br />
=== KDE Plasma ===<br />
<br />
You can use Plasma's settings to fine tune font, icon, and widget scaling. This solution affects both Qt and GTK applications.<br />
<br />
To adjust font, widget, and icon scaling together:<br />
<br />
# ''System Settings > Display and Monitor > Display Configuration > Scale Display''<br />
# Drag the slider to the desired size<br />
# Restart for the settings to take effect<br />
<br />
To adjust only font scaling:<br />
<br />
# ''System Settings > Fonts''<br />
# 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.<br />
<br />
To adjust only icon scaling:<br />
<br />
# ''System Settings > Icons > Advanced''<br />
# Choose the desired icon size for each category listed. This should take effect immediately.<br />
<br />
'''Display Scale not integer bug'''<br />
{{Accuracy|This doesn't seem to be necessary any more, only do it if you encounter this issue.}}<br />
When using not integer values for Display Scale it may causes font render issue in some Qt application. A workaround for this is to:<br />
<br />
# Set the scale value to {{ic|1}}<br />
# Adjust your font and icons and use the "Force fonts DPI" ( this affects all apps, also GTK but not create issue with the fonts )<br />
# Restart Plasma<br />
# If required tune the GTK apps using the variables {{ic|GDK_SCALE}}/{{ic|GDK_DPI_SCALE}} (as described above)<br />
<br />
==== Tray icons with fixed size ====<br />
<br />
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}}.<br />
<br />
=== Xfce ===<br />
<br />
Xfce supports HiDPI scaling which can be enabled using the settings manager:<br />
<br />
# Go to ''Settings Manager > Appearance > Settings > Window Scaling'' and select 2 as the scaling factor.<br />
# Go to ''Settings Manager > Window Manager > Style'' and select {{ic|Default-xhdpi}} theme.<br />
<br />
Alternatively, it is possible to do the same from command line using {{ic|xfconf-query}}:<br />
<br />
xfconf-query -c xsettings -p /Gdk/WindowScalingFactor -s 2<br />
xfconf-query -c xfwm4 -p /general/theme -s Default-xhdpi<br />
<br />
The steps above would set 2x scaled resolution for Xfce and other GTK 3 apps.<br />
<br />
Scaling for Qt 5 apps should be set manually, see [[#Qt 5]].<br />
<br />
=== Cinnamon ===<br />
<br />
Has good support out of the box.<br />
<br />
=== Enlightenment ===<br />
<br />
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.<br />
<br />
== X Resources ==<br />
<br />
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]]:<br />
<br />
{{hc|~/.Xresources|2=<br />
Xft.dpi: 192<br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintfull<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
}}<br />
<br />
For {{ic|Xft.dpi}}, using integer multiples of 96 usually works best, e.g. 192 for 200% scaling such as on a Dell XPS notebook.<br />
<br />
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).<br />
<br />
This will make the font render properly in most toolkits and applications. In some applications, icon resolution and/or sizes might still be incorrect, but that should be reported as a bug with the application.<br />
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.<br />
<br />
== X Server ==<br />
<br />
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.<br />
<br />
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:<br />
<br />
{{hc|$ xdpyinfo {{!}} grep -B 2 resolution|<br />
screen #0:<br />
dimensions: 3200x1800 pixels (423x238 millimeters)<br />
resolution: 192x192 dots per inch<br />
}}<br />
<br />
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.<br />
<br />
If the DPI displayed by xdpyinfo is not correct, see [[Xorg#Display size and DPI]] for how to fix it.<br />
<br />
== GUI toolkits ==<br />
<br />
=== Qt 5 ===<br />
<br />
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:<br />
<br />
export QT_AUTO_SCREEN_SCALE_FACTOR=1<br />
<br />
If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen ({{ic|QT_SCREEN_SCALE_FACTORS}}) or globally ({{ic|QT_SCALE_FACTOR}}). For more details see the [https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/ Qt blog post] or [https://doc.qt.io/qt-5/highdpi.html Qt developer documentation].<br />
<br />
{{Note|<br />
* 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.<br />
* {{ic|QT_SCALE_FACTOR}} scales fonts, but {{ic|QT_SCREEN_SCALE_FACTORS}} does not scale fonts.<br />
* If you also set the font DPI manually in ''xrdb'' to support other toolkits, {{ic|QT_SCALE_FACTORS}} will give you huge fonts.<br />
* If you have multiple screens of differing DPI ie: [[#Side display]] you may need to do {{ic|1=QT_SCREEN_SCALE_FACTORS="2;2"}}<br />
}}<br />
<br />
An [https://bugreports.qt.io/browse/QTBUG-53022 alternative] is e.g.:<br />
<br />
QT_FONT_DPI=96 vym<br />
<br />
=== GDK 3 (GTK 3) ===<br />
<br />
{{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.}} <br />
<br />
Setting the GDK scale will scale the UI, however it will not scale icons. If you are using a minimal window manager where you are setting the dpi via Xft.dpi, GDK should scale perfectly fine with it. In other cases, do the following:<br />
<br />
To scale UI elements by a factor of two:<br />
<br />
export GDK_SCALE=2<br />
<br />
To undo scaling of text:<br />
<br />
export GDK_DPI_SCALE=0.5<br />
<br />
=== GTK 2 ===<br />
<br />
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}}.<br />
<br />
=== Elementary (EFL) ===<br />
<br />
To scale UI elements by a factor of 1.5:<br />
<br />
export ELM_SCALE=1.5<br />
<br />
For more details see https://phab.enlightenment.org/w/elementary/<br />
<br />
== Boot managers ==<br />
<br />
=== GRUB ===<br />
<br />
==== Lower the framebuffer resolution ====<br />
<br />
Set a lower resolution for the framebuffer as explained in [[GRUB/Tips and tricks#Setting the framebuffer resolution]].<br />
<br />
==== Change GRUB font size ====<br />
<br />
Find a ttf font that you like in {{ic|/usr/share/fonts/}}.<br />
<br />
Convert the font to a format that GRUB can utilize:<br />
<br />
# grub-mkfont -s 30 -o /boot/grubfont.pf2 /usr/share/fonts/FontFamily/FontName.ttf<br />
<br />
{{Note|Change the {{ic|-s 30}} parameter to modify the font size}}<br />
<br />
Edit {{ic|/etc/default/grub}} to set the new font as shown in [[GRUB/Tips and tricks#Background image and bitmap fonts]]:<br />
<br />
GRUB_FONT="/boot/grubfont.pf2"<br />
<br />
Update GRUB configuration by running {{ic|grub-mkconfig -o /boot/grub/grub.cfg}}<br />
<br />
=== systemd-boot ===<br />
<br />
Adding the following line and running {{ic|bootctl update}} increases font-size in the [[systemd-boot#Loader_configuration|systemd-boot]] menu:<br />
<br />
{{hc|/boot/loader/loader.conf|2=<br />
console-mode 1<br />
}}<br />
<br />
== Applications ==<br />
<br />
{{Accuracy|{{ic|--force-device-scale-factor}} only works on Chromium based (including Electron) applications.}}<br />
<br />
As a general rule, applications can be launched with a custom scaling value, e.g. {{ic|1=$ atom --force-device-scale-factor=2}}. A more permanent solution is to add this scaling factor as a flag to the relevant .conf or .desktop file (normally located at {{ic|/usr/share/applications/}}). In the latter instance, the flag should be added to the line beginning with "Exec=", e.g. {{ic|1=Exec=/usr/bin/atom --force-device-scale-factor=2 %F}}. The next section provides more details on implementing this for specific applications.<br />
<br />
=== Atom ===<br />
<br />
Add {{ic|1=--force-device-scale-factor=2}} as a flag to the atom.desktop file:<br />
<br />
{{hc|/usr/share/applications/atom.desktop|2=<br />
Exec=/usr/bin/atom --force-device-scale-factor=2 %F<br />
}}<br />
<br />
=== Browsers ===<br />
<br />
==== Firefox ====<br />
<br />
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.<br />
<br />
To override those, open Firefox advanced preferences page ({{ic|about:config}}) and set parameter {{ic|layout.css.devPixelsPerPx}} to {{ic|2}} (or find the one that suits you better; {{ic|2}} is a good choice for Retina screens), but it also does not consistently scale the entirety of Firefox. If Firefox is not scaling fonts, you may want to create {{ic|userChrome.css}} and add appropriate styles to it. More information about {{ic|userChrome.css}} at [http://kb.mozillazine.org/index.php?title=UserChrome.css mozillaZine].<br />
<br />
{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|<br />
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");<br />
<br />
/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */<br />
* {<br />
font-size: 15px !important;<br />
}<br />
<br />
/* exception for badge on adblocker */<br />
.toolbarbutton-badge {<br />
font-size: 8px !important;<br />
}<br />
}}<br />
<br />
{{Warning|The AutoHiDPI extension is not compatible with Firefox Quantum (version 57 and above).}}<br />
<br />
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. For users of Firefox version 57 and above, the [https://addons.mozilla.org/firefox/addon/ffreszoom/ ffreszoom] add-on 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].<br />
<br />
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}}.<br />
<br />
You can also use the Wayland-enabled packages of Firefox from the AUR: {{AUR|firefox-wayland}} (compiles from source) or {{AUR|fedora-firefox-wayland-bin}} (binary from Fedora). You might experience some minor visual glitches with these packages.<br />
<br />
==== Chromium / Google Chrome ====<br />
<br />
Chromium should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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}}.<br />
<br />
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}}:<br />
<br />
{{hc|~/.config/chromium-flags.conf|2=<br />
--force-device-scale-factor=2<br />
}}<br />
<br />
To make this work for Chrome, add the same option to {{ic|~/.config/chrome-flags.conf}} instead.<br />
<br />
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.<br />
<br />
==== Opera ====<br />
<br />
Opera should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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.)<br />
<br />
=== Gimp 2.8 ===<br />
<br />
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}}.)<br />
<br />
There is also the [https://github.com/jedireza/gimp-hidpi gimp-hidpi].<br />
<br />
=== Inkscape ===<br />
<br />
To scale the icons to a "usable" size go to ''Preferences > Interface'' and set the icon size to Large or Larger[http://www.inkscapeforum.com/viewtopic.php?t=18684][http://wiki.inkscape.org/wiki/index.php/HiDPI].<br />
<br />
=== IntelliJ IDEA ===<br />
<br />
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:<br />
<br />
:''File > Settings > Behaviour & Appearance > Appearance''<br />
<br />
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.<br />
<br />
=== Java applications ===<br />
<br />
==== AWT/Swing ====<br />
<br />
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,<br />
<br />
java -Dsun.java2d.uiScale=2 -jar some_swing_application.jar<br />
java -Dsun.java2d.uiScale=300% -jar some_swing_application.jar<br />
<br />
Since Java 9 the {{ic|GDK_SCALE}} environment variable is used to scale Swing applications accordingly.<br />
<br />
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}}.<br />
<br />
==== JavaFX ====<br />
<br />
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,<br />
<br />
java -Dglass.gtk.uiScale=200% -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=192dpi -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=2.0 -jar some_jfx_application.jar<br />
<br />
''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.<br />
<br />
==== Mixed AWT/Swing and JavaFX ====<br />
<br />
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.<br />
<br />
=== MATLAB ===<br />
<br />
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]:<br />
<br />
>> s = settings;s.matlab.desktop.DisplayScaleFactor<br />
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2<br />
<br />
The settings take effect after MATLAB is restarted.<br />
<br />
=== Mono applications ===<br />
<br />
According to [https://bugzilla.xamarin.com/show_bug.cgi?id=35870], Mono applications should be scalable like [[#GDK 3 (GTK 3)|GTK 3]] applications.<br />
<br />
=== NetBeans ===<br />
<br />
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]<br />
<br />
The editor fontsize can be controlled from ''Tools > Option > Fonts & Colors''.<br />
<br />
The output window fontsize can be controlled from ''Tools > Options > Miscelaneous > Output''<br />
<br />
=== Skype ===<br />
<br />
Skype for Linux ({{AUR|skypeforlinux-stable-bin}} package) uses [[#GDK 3 (GTK 3)]].<br />
<br />
=== Slack ===<br />
<br />
Slack ({{AUR|slack-desktop}}), like all [https://electronjs.org/ Electron] apps, can be configured to use a custom scaling value by adding a {{ic|1=--force-device-scale-factor}} flag to the .desktop file. This is normally located at {{ic|/usr/share/applications/}}. The flag should be added to the line beginning with "Exec=". For example:<br />
<br />
{{hc|/usr/share/applications/slack.desktop|2=<br />
Exec=env LD_PRELOAD=/usr/lib/libcurl.so.3 /usr/bin/slack --force-device-scale-factor=1.5 %U<br />
}}<br />
<br />
=== Spotify ===<br />
<br />
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:<br />
<br />
{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|2=<br />
app.browser.zoom-level=100<br />
}}<br />
<br />
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<br />
<br />
$ spotify --force-device-scale-factor=1.5<br />
<br />
=== Steam ===<br />
<br />
==== Official HiDPI support ====<br />
<br />
* Starting on 25 of January 2018 in the beta program there is actual support for HiDPI and it should be automatically detected.<br />
* ''Steam > Settings > Interface'', check "Enlarge text and icons based on monitor size" (restart required)<br />
* If it not automatically detected use {{ic|1=GDK_SCALE=2}} to set the desired scale factor.<br />
<br />
==== Unofficial ====<br />
<br />
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. <br />
<br />
{{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}}.}}<br />
<br />
[http://steamcommunity.com/groups/metroskin/discussions/0/517142253861033946/ MetroSkin Unofficial Patch] also helps with HiDPI on Steam with Linux.<br />
<br />
=== Sublime Text 3 ===<br />
<br />
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.<br />
<br />
=== Thunderbird ===<br />
<br />
See [[#Firefox]]. To access {{ic|about:config}}, go to ''Edit > Preferences > Advanced >Config editor''.<br />
<br />
=== VirtualBox ===<br />
<br />
{{Note|This only applies to KDE with scaling enabled.}}<br />
<br />
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]).<br />
<br />
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.<br />
<br />
$ QT_SCALE_FACTOR=0.5 VirtualBox --startvm vm-name<br />
<br />
=== Wine applications ===<br />
<br />
Run<br />
<br />
$ winecfg<br />
<br />
and change the "dpi" setting found in the "Graphics" tab. This only affects the font size.<br />
<br />
=== Zathura document viewer ===<br />
<br />
No modifications required for document viewing.<br />
<br />
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]):<br />
<br />
set font "monospace normal 20"<br />
<br />
=== Zoom ===<br />
<br />
Zoom can be started with a proper scaling by overriding the {{ic|1=QT_SCALE_FACTOR}} environment variable.<br />
<br />
$ QT_SCALE_FACTOR=2 zoom<br />
<br />
=== Unsupported applications ===<br />
<br />
{{AUR|run_scaled-git}} can be used to scale applications (which uses {{Pkg|xpra}} internally).<br />
<br />
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}}.<br />
<br />
[[x11vnc]] has an experimental option {{ic|-appshare}}, which opens one viewer per application window. Perhaps something could be hacked up with that.<br />
<br />
== Multiple displays ==<br />
<br />
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]].<br />
<br />
=== Side display ===<br />
<br />
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:<br />
<br />
$ xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1<br />
<br />
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.<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
{{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].}}<br />
<br />
{{Note|If you are using the {{ic|modesetting}} driver you will get mouse flickering. This can be solved by scaling your non-scaled screen by 0.9999x0.9999.}}<br />
<br />
=== Multiple external monitors ===<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 0.5x0.5 --output DP2 --right-of eDP1 --output HDMI1 --right-of DP2<br />
<br />
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.<br />
<br />
=== Mirroring ===<br />
<br />
If all you want is to mirror ("unify") displays, this is easy as well:<br />
<br />
With AxB your native HiDPI resolution (for ex 3200x1800) and CxD your external screen resolution (e.g. 1920x1200)<br />
<br />
$ xrandr --output HDMI --scale [A/C]x[B/D]<br />
<br />
In this example which is QHD (3200/1920 = 1.66 and 1800/1200 = 1.5)<br />
<br />
$ xrandr --output HDMI --scale 1.66x1.5<br />
<br />
For UHD to 1080p (3840/1920=2 2160/1080=2)<br />
<br />
$ xrandr --output HDMI --scale 2x2<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
=== Tools ===<br />
<br />
There are several tools which automate the commands described above.<br />
<br />
* [https://gist.github.com/wvengen/178642bbc8236c1bdb67 This script] extend a non-HiDPI external display above a HiDPI internal display.<br />
* [https://github.com/ashwinvis/xrandr-extend xrandr-extend].<br />
* {{AUR|xlayoutdisplay}} is a CLI front end for xrandr which detects and sets correct DPI: [https://github.com/alex-courtis/xlayoutdisplay README]<br />
<br />
== Linux console ==<br />
<br />
The default [[w:Linux console|Linux console]] font will be very small on HiDPI displays, the largest font present in the {{Pkg|kbd}} package is {{ic|latarcyrheb-sun32}} and other packages like {{Pkg|terminus-font}} contain further alternatives, such as {{ic|ter-132n}}(normal) and {{ic|ter-132b}}(bold). See [[Linux console#Fonts]] for configuration details. Also see [[Linux console#Persistent configuration]] in particular for applying the font setting during the early userspace boot sequence.<br />
<br />
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.<br />
<br />
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.<br />
<br />
== See also ==<br />
<br />
* [http://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)<br />
* [http://www.eizo.com/library/basics/pixel_density_4k/ Understanding pixel density]<br />
* [http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/ Mixed DPI and the X Window System]</div>SECuREhttps://wiki.archlinux.org/index.php?title=HiDPI&diff=593702HiDPI2020-01-01T22:08:38Z<p>SECuRE: /* X Resources */ recommend integer multiples of 96 for Xft.dpi</p>
<hr />
<div>[[Category:Graphics]]<br />
[[ja:HiDPI]]<br />
[[zh-hans:HiDPI]]<br />
{{Related articles start}}<br />
{{Related|Font configuration}}<br />
{{Related articles end}}<br />
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.<br />
<br />
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.<br />
<br />
== Desktop environments ==<br />
<br />
=== GNOME ===<br />
To enable HiDPI, navigate to ''Settings > Devices > Displays > Scale'' and choose an appropriate value. Or, use gsettings:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "[{'Gdk/WindowScalingFactor', <2>}]"<br />
$ gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
{{Note|1=GNOME only allows integer scaling numbers to be set. 1 = 100%, 2 = 200%, etc. See Fractional Scaling below.}}<br />
<br />
==== Fractional Scaling ====<br />
<br />
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.<br />
<br />
===== Wayland =====<br />
<br />
Enable the experimental fractional scaling feature:<br />
<br />
$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"<br />
<br />
then open ''Settings > Devices > Displays'' (the new options may only appear after a restart).<br />
<br />
===== Xorg =====<br />
<br />
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]].<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 1.25x1.25<br />
<br />
{{Note|To allow the mouse to reach the whole screen, you may need to use the {{ic|--panning}} option as explained in [[#Side display]].}}<br />
<br />
{{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}}<br />
<br />
GNOME ignores X settings due to its xsettings Plugin in Gnome Settings Daemon, where DPI setting is hard coded.<br />
There is blog entry for [http://blog.drtebi.com/2012/12/changing-dpi-setting-on-gnome-34.html recompiling Gnome Settings Daemon].<br />
In the source documentation there is another way mentioned to set X settings DPI:<br />
<br />
You can use the dconf Editor and navigate to key <br />
<br />
/org/gnome/settings-daemon/plugins/xsettings/overrides<br />
<br />
and complement the entry with the value<br />
<br />
'Xft/DPI': <153600><br />
<br />
From README.xsettings<br />
<br />
Noting that variants must be specified in the usual way (wrapped in <>).<br />
<br />
Note also that DPI in the above example is expressed in 1024ths of an inch.<br />
<br />
==== Text Scaling ====<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.5<br />
<br />
===== GTK+ vs Gnome Shell elements on Xorg =====<br />
<br />
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]] toolkit. Note that this is a long-standing issue to which a recent patch has been submitted.[https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/486] However, as of October 2019, the proposed patch has yet to be merged with the main GNOME codebase. In the interim, 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:<br />
<br />
{{hc|usr/share/themes/Adapta/gnome-shell/gnome-shell.css|2=<br />
stage { font-size: 20pt; font-family: Roboto, Noto Sans, Sans-Serif; color: #263238; }<br />
}}<br />
<br />
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.<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Cantarell Bold 22' ## Change as needed<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-uses-system-font false<br />
<br />
=== KDE Plasma ===<br />
<br />
You can use Plasma's settings to fine tune font, icon, and widget scaling. This solution affects both Qt and GTK applications.<br />
<br />
To adjust font, widget, and icon scaling together:<br />
<br />
# ''System Settings > Display and Monitor > Display Configuration > Scale Display''<br />
# Drag the slider to the desired size<br />
# Restart for the settings to take effect<br />
<br />
To adjust only font scaling:<br />
<br />
# ''System Settings > Fonts''<br />
# 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.<br />
<br />
To adjust only icon scaling:<br />
<br />
# ''System Settings > Icons > Advanced''<br />
# Choose the desired icon size for each category listed. This should take effect immediately.<br />
<br />
'''Display Scale not integer bug'''<br />
{{Accuracy|This doesn't seem to be necessary any more, only do it if you encounter this issue.}}<br />
When using not integer values for Display Scale it may causes font render issue in some Qt application. A workaround for this is to:<br />
<br />
# Set the scale value to {{ic|1}}<br />
# Adjust your font and icons and use the "Force fonts DPI" ( this affects all apps, also GTK but not create issue with the fonts )<br />
# Restart Plasma<br />
# If required tune the GTK apps using the variables {{ic|GDK_SCALE}}/{{ic|GDK_DPI_SCALE}} (as described above)<br />
<br />
==== Tray icons with fixed size ====<br />
<br />
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}}.<br />
<br />
=== Xfce ===<br />
<br />
Xfce supports HiDPI scaling which can be enabled using the settings manager:<br />
<br />
# Go to ''Settings Manager > Appearance > Settings > Window Scaling'' and select 2 as the scaling factor.<br />
# Go to ''Settings Manager > Window Manager > Style'' and select {{ic|Default-xhdpi}} theme.<br />
<br />
Alternatively, it is possible to do the same from command line using {{ic|xfconf-query}}:<br />
<br />
xfconf-query -c xsettings -p /Gdk/WindowScalingFactor -s 2<br />
xfconf-query -c xfwm4 -p /general/theme -s Default-xhdpi<br />
<br />
The steps above would set 2x scaled resolution for Xfce and other GTK 3 apps.<br />
<br />
Scaling for Qt 5 apps should be set manually, see [[#Qt 5]].<br />
<br />
=== Cinnamon ===<br />
<br />
Has good support out of the box.<br />
<br />
=== Enlightenment ===<br />
<br />
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.<br />
<br />
== X Resources ==<br />
<br />
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]]:<br />
<br />
{{hc|~/.Xresources|2=<br />
Xft.dpi: 192<br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintfull<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
}}<br />
<br />
For {{ic|Xft.dpi}}, using integer multiples of 96 usually works best, e.g. 192 for 200% scaling such as on a Dell XPS notebook.<br />
<br />
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).<br />
<br />
This will make the font render properly in most toolkits and applications, it will however not affect things such as icon size!<br />
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.<br />
<br />
== X Server ==<br />
<br />
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.<br />
<br />
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:<br />
<br />
{{hc|$ xdpyinfo {{!}} grep -B 2 resolution|<br />
screen #0:<br />
dimensions: 3200x1800 pixels (423x238 millimeters)<br />
resolution: 192x192 dots per inch<br />
}}<br />
<br />
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.<br />
<br />
If the DPI displayed by xdpyinfo is not correct, see [[Xorg#Display size and DPI]] for how to fix it.<br />
<br />
== GUI toolkits ==<br />
<br />
=== Qt 5 ===<br />
<br />
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:<br />
<br />
export QT_AUTO_SCREEN_SCALE_FACTOR=1<br />
<br />
If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen ({{ic|QT_SCREEN_SCALE_FACTORS}}) or globally ({{ic|QT_SCALE_FACTOR}}). For more details see the [https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/ Qt blog post] or [https://doc.qt.io/qt-5/highdpi.html Qt developer documentation].<br />
<br />
{{Note|<br />
* 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.<br />
* {{ic|QT_SCALE_FACTOR}} scales fonts, but {{ic|QT_SCREEN_SCALE_FACTORS}} does not scale fonts.<br />
* If you also set the font DPI manually in ''xrdb'' to support other toolkits, {{ic|QT_SCALE_FACTORS}} will give you huge fonts.<br />
* If you have multiple screens of differing DPI ie: [[#Side display]] you may need to do {{ic|1=QT_SCREEN_SCALE_FACTORS="2;2"}}<br />
}}<br />
<br />
An [https://bugreports.qt.io/browse/QTBUG-53022 alternative] is e.g.:<br />
<br />
QT_FONT_DPI=96 vym<br />
<br />
=== GDK 3 (GTK 3) ===<br />
<br />
{{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.}} <br />
<br />
Setting the GDK scale will scale the UI, however it will not scale icons. If you are using a minimal window manager where you are setting the dpi via Xft.dpi, GDK should scale perfectly fine with it. In other cases, do the following:<br />
<br />
To scale UI elements by a factor of two:<br />
<br />
export GDK_SCALE=2<br />
<br />
To undo scaling of text:<br />
<br />
export GDK_DPI_SCALE=0.5<br />
<br />
=== GTK 2 ===<br />
<br />
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}}.<br />
<br />
=== Elementary (EFL) ===<br />
<br />
To scale UI elements by a factor of 1.5:<br />
<br />
export ELM_SCALE=1.5<br />
<br />
For more details see https://phab.enlightenment.org/w/elementary/<br />
<br />
== Boot managers ==<br />
<br />
=== GRUB ===<br />
<br />
==== Lower the framebuffer resolution ====<br />
<br />
Set a lower resolution for the framebuffer as explained in [[GRUB/Tips and tricks#Setting the framebuffer resolution]].<br />
<br />
==== Change GRUB font size ====<br />
<br />
Find a ttf font that you like in {{ic|/usr/share/fonts/}}.<br />
<br />
Convert the font to a format that GRUB can utilize:<br />
<br />
# grub-mkfont -s 30 -o /boot/grubfont.pf2 /usr/share/fonts/FontFamily/FontName.ttf<br />
<br />
{{Note|Change the {{ic|-s 30}} parameter to modify the font size}}<br />
<br />
Edit {{ic|/etc/default/grub}} to set the new font as shown in [[GRUB/Tips and tricks#Background image and bitmap fonts]]:<br />
<br />
GRUB_FONT="/boot/grubfont.pf2"<br />
<br />
Update GRUB configuration by running {{ic|grub-mkconfig -o /boot/grub/grub.cfg}}<br />
<br />
=== systemd-boot ===<br />
<br />
Adding the following line and running {{ic|bootctl update}} increases font-size in the [[systemd-boot#Loader_configuration|systemd-boot]] menu:<br />
<br />
{{hc|/boot/loader/loader.conf|2=<br />
console-mode 1<br />
}}<br />
<br />
== Applications ==<br />
<br />
{{Accuracy|{{ic|--force-device-scale-factor}} only works on Chromium based (including Electron) applications.}}<br />
<br />
As a general rule, applications can be launched with a custom scaling value, e.g. {{ic|1=$ atom --force-device-scale-factor=2}}. A more permanent solution is to add this scaling factor as a flag to the relevant .conf or .desktop file (normally located at {{ic|/usr/share/applications/}}). In the latter instance, the flag should be added to the line beginning with "Exec=", e.g. {{ic|1=Exec=/usr/bin/atom --force-device-scale-factor=2 %F}}. The next section provides more details on implementing this for specific applications.<br />
<br />
=== Atom ===<br />
<br />
Add {{ic|1=--force-device-scale-factor=2}} as a flag to the atom.desktop file:<br />
<br />
{{hc|/usr/share/applications/atom.desktop|2=<br />
Exec=/usr/bin/atom --force-device-scale-factor=2 %F<br />
}}<br />
<br />
=== Browsers ===<br />
<br />
==== Firefox ====<br />
<br />
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.<br />
<br />
To override those, open Firefox advanced preferences page ({{ic|about:config}}) and set parameter {{ic|layout.css.devPixelsPerPx}} to {{ic|2}} (or find the one that suits you better; {{ic|2}} is a good choice for Retina screens), but it also does not consistently scale the entirety of Firefox. If Firefox is not scaling fonts, you may want to create {{ic|userChrome.css}} and add appropriate styles to it. More information about {{ic|userChrome.css}} at [http://kb.mozillazine.org/index.php?title=UserChrome.css mozillaZine].<br />
<br />
{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|<br />
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");<br />
<br />
/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */<br />
* {<br />
font-size: 15px !important;<br />
}<br />
<br />
/* exception for badge on adblocker */<br />
.toolbarbutton-badge {<br />
font-size: 8px !important;<br />
}<br />
}}<br />
<br />
{{Warning|The AutoHiDPI extension is not compatible with Firefox Quantum (version 57 and above).}}<br />
<br />
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. For users of Firefox version 57 and above, the [https://addons.mozilla.org/firefox/addon/ffreszoom/ ffreszoom] add-on 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].<br />
<br />
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}}.<br />
<br />
You can also use the Wayland-enabled packages of Firefox from the AUR: {{AUR|firefox-wayland}} (compiles from source) or {{AUR|fedora-firefox-wayland-bin}} (binary from Fedora). You might experience some minor visual glitches with these packages.<br />
<br />
==== Chromium / Google Chrome ====<br />
<br />
Chromium should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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}}.<br />
<br />
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}}:<br />
<br />
{{hc|~/.config/chromium-flags.conf|2=<br />
--force-device-scale-factor=2<br />
}}<br />
<br />
To make this work for Chrome, add the same option to {{ic|~/.config/chrome-flags.conf}} instead.<br />
<br />
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.<br />
<br />
==== Opera ====<br />
<br />
Opera should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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.)<br />
<br />
=== Gimp 2.8 ===<br />
<br />
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}}.)<br />
<br />
There is also the [https://github.com/jedireza/gimp-hidpi gimp-hidpi].<br />
<br />
=== Inkscape ===<br />
<br />
To scale the icons to a "usable" size go to ''Preferences > Interface'' and set the icon size to Large or Larger[http://www.inkscapeforum.com/viewtopic.php?t=18684][http://wiki.inkscape.org/wiki/index.php/HiDPI].<br />
<br />
=== IntelliJ IDEA ===<br />
<br />
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:<br />
<br />
:''File > Settings > Behaviour & Appearance > Appearance''<br />
<br />
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.<br />
<br />
=== Java applications ===<br />
<br />
==== AWT/Swing ====<br />
<br />
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,<br />
<br />
java -Dsun.java2d.uiScale=2 -jar some_swing_application.jar<br />
java -Dsun.java2d.uiScale=300% -jar some_swing_application.jar<br />
<br />
Since Java 9 the {{ic|GDK_SCALE}} environment variable is used to scale Swing applications accordingly.<br />
<br />
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}}.<br />
<br />
==== JavaFX ====<br />
<br />
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,<br />
<br />
java -Dglass.gtk.uiScale=200% -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=192dpi -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=2.0 -jar some_jfx_application.jar<br />
<br />
''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.<br />
<br />
==== Mixed AWT/Swing and JavaFX ====<br />
<br />
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.<br />
<br />
=== MATLAB ===<br />
<br />
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]:<br />
<br />
>> s = settings;s.matlab.desktop.DisplayScaleFactor<br />
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2<br />
<br />
The settings take effect after MATLAB is restarted.<br />
<br />
=== Mono applications ===<br />
<br />
According to [https://bugzilla.xamarin.com/show_bug.cgi?id=35870], Mono applications should be scalable like [[#GDK 3 (GTK 3)|GTK 3]] applications.<br />
<br />
=== NetBeans ===<br />
<br />
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]<br />
<br />
The editor fontsize can be controlled from ''Tools > Option > Fonts & Colors''.<br />
<br />
The output window fontsize can be controlled from ''Tools > Options > Miscelaneous > Output''<br />
<br />
=== Skype ===<br />
<br />
Skype for Linux ({{AUR|skypeforlinux-stable-bin}} package) uses [[#GDK 3 (GTK 3)]].<br />
<br />
=== Slack ===<br />
<br />
Slack ({{AUR|slack-desktop}}), like all [https://electronjs.org/ Electron] apps, can be configured to use a custom scaling value by adding a {{ic|1=--force-device-scale-factor}} flag to the .desktop file. This is normally located at {{ic|/usr/share/applications/}}. The flag should be added to the line beginning with "Exec=". For example:<br />
<br />
{{hc|/usr/share/applications/slack.desktop|2=<br />
Exec=env LD_PRELOAD=/usr/lib/libcurl.so.3 /usr/bin/slack --force-device-scale-factor=1.5 %U<br />
}}<br />
<br />
=== Spotify ===<br />
<br />
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:<br />
<br />
{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|2=<br />
app.browser.zoom-level=100<br />
}}<br />
<br />
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<br />
<br />
$ spotify --force-device-scale-factor=1.5<br />
<br />
=== Steam ===<br />
<br />
==== Official HiDPI support ====<br />
<br />
* Starting on 25 of January 2018 in the beta program there is actual support for HiDPI and it should be automatically detected.<br />
* ''Steam > Settings > Interface'', check "Enlarge text and icons based on monitor size" (restart required)<br />
* If it not automatically detected use {{ic|1=GDK_SCALE=2}} to set the desired scale factor.<br />
<br />
==== Unofficial ====<br />
<br />
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. <br />
<br />
{{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}}.}}<br />
<br />
[http://steamcommunity.com/groups/metroskin/discussions/0/517142253861033946/ MetroSkin Unofficial Patch] also helps with HiDPI on Steam with Linux.<br />
<br />
=== Sublime Text 3 ===<br />
<br />
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.<br />
<br />
=== Thunderbird ===<br />
<br />
See [[#Firefox]]. To access {{ic|about:config}}, go to ''Edit > Preferences > Advanced >Config editor''.<br />
<br />
=== VirtualBox ===<br />
<br />
{{Note|This only applies to KDE with scaling enabled.}}<br />
<br />
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]).<br />
<br />
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.<br />
<br />
$ QT_SCALE_FACTOR=0.5 VirtualBox --startvm vm-name<br />
<br />
=== Wine applications ===<br />
<br />
Run<br />
<br />
$ winecfg<br />
<br />
and change the "dpi" setting found in the "Graphics" tab. This only affects the font size.<br />
<br />
=== Zathura document viewer ===<br />
<br />
No modifications required for document viewing.<br />
<br />
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]):<br />
<br />
set font "monospace normal 20"<br />
<br />
=== Zoom ===<br />
<br />
Zoom can be started with a proper scaling by overriding the {{ic|1=QT_SCALE_FACTOR}} environment variable.<br />
<br />
$ QT_SCALE_FACTOR=2 zoom<br />
<br />
=== Unsupported applications ===<br />
<br />
{{AUR|run_scaled-git}} can be used to scale applications (which uses {{Pkg|xpra}} internally).<br />
<br />
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}}.<br />
<br />
[[x11vnc]] has an experimental option {{ic|-appshare}}, which opens one viewer per application window. Perhaps something could be hacked up with that.<br />
<br />
== Multiple displays ==<br />
<br />
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]].<br />
<br />
=== Side display ===<br />
<br />
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:<br />
<br />
$ xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1<br />
<br />
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.<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
{{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].}}<br />
<br />
{{Note|If you are using the {{ic|modesetting}} driver you will get mouse flickering. This can be solved by scaling your non-scaled screen by 0.9999x0.9999.}}<br />
<br />
=== Multiple external monitors ===<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 0.5x0.5 --output DP2 --right-of eDP1 --output HDMI1 --right-of DP2<br />
<br />
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.<br />
<br />
=== Mirroring ===<br />
<br />
If all you want is to mirror ("unify") displays, this is easy as well:<br />
<br />
With AxB your native HiDPI resolution (for ex 3200x1800) and CxD your external screen resolution (e.g. 1920x1200)<br />
<br />
$ xrandr --output HDMI --scale [A/C]x[B/D]<br />
<br />
In this example which is QHD (3200/1920 = 1.66 and 1800/1200 = 1.5)<br />
<br />
$ xrandr --output HDMI --scale 1.66x1.5<br />
<br />
For UHD to 1080p (3840/1920=2 2160/1080=2)<br />
<br />
$ xrandr --output HDMI --scale 2x2<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
=== Tools ===<br />
<br />
There are several tools which automate the commands described above.<br />
<br />
* [https://gist.github.com/wvengen/178642bbc8236c1bdb67 This script] extend a non-HiDPI external display above a HiDPI internal display.<br />
* [https://github.com/ashwinvis/xrandr-extend xrandr-extend].<br />
* {{AUR|xlayoutdisplay}} is a CLI front end for xrandr which detects and sets correct DPI: [https://github.com/alex-courtis/xlayoutdisplay README]<br />
<br />
== Linux console ==<br />
<br />
The default [[w:Linux console|Linux console]] font will be very small on HiDPI displays, the largest font present in the {{Pkg|kbd}} package is {{ic|latarcyrheb-sun32}} and other packages like {{Pkg|terminus-font}} contain further alternatives, such as {{ic|ter-132n}}(normal) and {{ic|ter-132b}}(bold). See [[Linux console#Fonts]] for configuration details. Also see [[Linux console#Persistent configuration]] in particular for applying the font setting during the early userspace boot sequence.<br />
<br />
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.<br />
<br />
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.<br />
<br />
== See also ==<br />
<br />
* [http://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)<br />
* [http://www.eizo.com/library/basics/pixel_density_4k/ Understanding pixel density]<br />
* [http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/ Mixed DPI and the X Window System]</div>SECuREhttps://wiki.archlinux.org/index.php?title=HiDPI&diff=593701HiDPI2020-01-01T22:05:11Z<p>SECuRE: Move X resources above X server, update the latter wrt how that approach is outdated and no longer used in all provided examples</p>
<hr />
<div>[[Category:Graphics]]<br />
[[ja:HiDPI]]<br />
[[zh-hans:HiDPI]]<br />
{{Related articles start}}<br />
{{Related|Font configuration}}<br />
{{Related articles end}}<br />
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.<br />
<br />
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.<br />
<br />
== Desktop environments ==<br />
<br />
=== GNOME ===<br />
To enable HiDPI, navigate to ''Settings > Devices > Displays > Scale'' and choose an appropriate value. Or, use gsettings:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "[{'Gdk/WindowScalingFactor', <2>}]"<br />
$ gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
{{Note|1=GNOME only allows integer scaling numbers to be set. 1 = 100%, 2 = 200%, etc. See Fractional Scaling below.}}<br />
<br />
==== Fractional Scaling ====<br />
<br />
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.<br />
<br />
===== Wayland =====<br />
<br />
Enable the experimental fractional scaling feature:<br />
<br />
$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"<br />
<br />
then open ''Settings > Devices > Displays'' (the new options may only appear after a restart).<br />
<br />
===== Xorg =====<br />
<br />
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]].<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 1.25x1.25<br />
<br />
{{Note|To allow the mouse to reach the whole screen, you may need to use the {{ic|--panning}} option as explained in [[#Side display]].}}<br />
<br />
{{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}}<br />
<br />
GNOME ignores X settings due to its xsettings Plugin in Gnome Settings Daemon, where DPI setting is hard coded.<br />
There is blog entry for [http://blog.drtebi.com/2012/12/changing-dpi-setting-on-gnome-34.html recompiling Gnome Settings Daemon].<br />
In the source documentation there is another way mentioned to set X settings DPI:<br />
<br />
You can use the dconf Editor and navigate to key <br />
<br />
/org/gnome/settings-daemon/plugins/xsettings/overrides<br />
<br />
and complement the entry with the value<br />
<br />
'Xft/DPI': <153600><br />
<br />
From README.xsettings<br />
<br />
Noting that variants must be specified in the usual way (wrapped in <>).<br />
<br />
Note also that DPI in the above example is expressed in 1024ths of an inch.<br />
<br />
==== Text Scaling ====<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.5<br />
<br />
===== GTK+ vs Gnome Shell elements on Xorg =====<br />
<br />
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]] toolkit. Note that this is a long-standing issue to which a recent patch has been submitted.[https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/486] However, as of October 2019, the proposed patch has yet to be merged with the main GNOME codebase. In the interim, 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:<br />
<br />
{{hc|usr/share/themes/Adapta/gnome-shell/gnome-shell.css|2=<br />
stage { font-size: 20pt; font-family: Roboto, Noto Sans, Sans-Serif; color: #263238; }<br />
}}<br />
<br />
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.<br />
<br />
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:<br />
<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Cantarell Bold 22' ## Change as needed<br />
$ gsettings set org.gnome.desktop.wm.preferences titlebar-uses-system-font false<br />
<br />
=== KDE Plasma ===<br />
<br />
You can use Plasma's settings to fine tune font, icon, and widget scaling. This solution affects both Qt and GTK applications.<br />
<br />
To adjust font, widget, and icon scaling together:<br />
<br />
# ''System Settings > Display and Monitor > Display Configuration > Scale Display''<br />
# Drag the slider to the desired size<br />
# Restart for the settings to take effect<br />
<br />
To adjust only font scaling:<br />
<br />
# ''System Settings > Fonts''<br />
# 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.<br />
<br />
To adjust only icon scaling:<br />
<br />
# ''System Settings > Icons > Advanced''<br />
# Choose the desired icon size for each category listed. This should take effect immediately.<br />
<br />
'''Display Scale not integer bug'''<br />
{{Accuracy|This doesn't seem to be necessary any more, only do it if you encounter this issue.}}<br />
When using not integer values for Display Scale it may causes font render issue in some Qt application. A workaround for this is to:<br />
<br />
# Set the scale value to {{ic|1}}<br />
# Adjust your font and icons and use the "Force fonts DPI" ( this affects all apps, also GTK but not create issue with the fonts )<br />
# Restart Plasma<br />
# If required tune the GTK apps using the variables {{ic|GDK_SCALE}}/{{ic|GDK_DPI_SCALE}} (as described above)<br />
<br />
==== Tray icons with fixed size ====<br />
<br />
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}}.<br />
<br />
=== Xfce ===<br />
<br />
Xfce supports HiDPI scaling which can be enabled using the settings manager:<br />
<br />
# Go to ''Settings Manager > Appearance > Settings > Window Scaling'' and select 2 as the scaling factor.<br />
# Go to ''Settings Manager > Window Manager > Style'' and select {{ic|Default-xhdpi}} theme.<br />
<br />
Alternatively, it is possible to do the same from command line using {{ic|xfconf-query}}:<br />
<br />
xfconf-query -c xsettings -p /Gdk/WindowScalingFactor -s 2<br />
xfconf-query -c xfwm4 -p /general/theme -s Default-xhdpi<br />
<br />
The steps above would set 2x scaled resolution for Xfce and other GTK 3 apps.<br />
<br />
Scaling for Qt 5 apps should be set manually, see [[#Qt 5]].<br />
<br />
=== Cinnamon ===<br />
<br />
Has good support out of the box.<br />
<br />
=== Enlightenment ===<br />
<br />
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.<br />
<br />
== X Resources ==<br />
<br />
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]]:<br />
<br />
{{hc|~/.Xresources|2=<br />
Xft.dpi: 180<br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintfull<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
}}<br />
<br />
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).<br />
<br />
This will make the font render properly in most toolkits and applications, it will however not affect things such as icon size!<br />
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.<br />
<br />
== X Server ==<br />
<br />
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.<br />
<br />
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:<br />
<br />
{{hc|$ xdpyinfo {{!}} grep -B 2 resolution|<br />
screen #0:<br />
dimensions: 3200x1800 pixels (423x238 millimeters)<br />
resolution: 192x192 dots per inch<br />
}}<br />
<br />
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.<br />
<br />
If the DPI displayed by xdpyinfo is not correct, see [[Xorg#Display size and DPI]] for how to fix it.<br />
<br />
== GUI toolkits ==<br />
<br />
=== Qt 5 ===<br />
<br />
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:<br />
<br />
export QT_AUTO_SCREEN_SCALE_FACTOR=1<br />
<br />
If automatic detection of DPI does not produce the desired effect, scaling can be set manually per-screen ({{ic|QT_SCREEN_SCALE_FACTORS}}) or globally ({{ic|QT_SCALE_FACTOR}}). For more details see the [https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/ Qt blog post] or [https://doc.qt.io/qt-5/highdpi.html Qt developer documentation].<br />
<br />
{{Note|<br />
* 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.<br />
* {{ic|QT_SCALE_FACTOR}} scales fonts, but {{ic|QT_SCREEN_SCALE_FACTORS}} does not scale fonts.<br />
* If you also set the font DPI manually in ''xrdb'' to support other toolkits, {{ic|QT_SCALE_FACTORS}} will give you huge fonts.<br />
* If you have multiple screens of differing DPI ie: [[#Side display]] you may need to do {{ic|1=QT_SCREEN_SCALE_FACTORS="2;2"}}<br />
}}<br />
<br />
An [https://bugreports.qt.io/browse/QTBUG-53022 alternative] is e.g.:<br />
<br />
QT_FONT_DPI=96 vym<br />
<br />
=== GDK 3 (GTK 3) ===<br />
<br />
{{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.}} <br />
<br />
Setting the GDK scale will scale the UI, however it will not scale icons. If you are using a minimal window manager where you are setting the dpi via Xft.dpi, GDK should scale perfectly fine with it. In other cases, do the following:<br />
<br />
To scale UI elements by a factor of two:<br />
<br />
export GDK_SCALE=2<br />
<br />
To undo scaling of text:<br />
<br />
export GDK_DPI_SCALE=0.5<br />
<br />
=== GTK 2 ===<br />
<br />
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}}.<br />
<br />
=== Elementary (EFL) ===<br />
<br />
To scale UI elements by a factor of 1.5:<br />
<br />
export ELM_SCALE=1.5<br />
<br />
For more details see https://phab.enlightenment.org/w/elementary/<br />
<br />
== Boot managers ==<br />
<br />
=== GRUB ===<br />
<br />
==== Lower the framebuffer resolution ====<br />
<br />
Set a lower resolution for the framebuffer as explained in [[GRUB/Tips and tricks#Setting the framebuffer resolution]].<br />
<br />
==== Change GRUB font size ====<br />
<br />
Find a ttf font that you like in {{ic|/usr/share/fonts/}}.<br />
<br />
Convert the font to a format that GRUB can utilize:<br />
<br />
# grub-mkfont -s 30 -o /boot/grubfont.pf2 /usr/share/fonts/FontFamily/FontName.ttf<br />
<br />
{{Note|Change the {{ic|-s 30}} parameter to modify the font size}}<br />
<br />
Edit {{ic|/etc/default/grub}} to set the new font as shown in [[GRUB/Tips and tricks#Background image and bitmap fonts]]:<br />
<br />
GRUB_FONT="/boot/grubfont.pf2"<br />
<br />
Update GRUB configuration by running {{ic|grub-mkconfig -o /boot/grub/grub.cfg}}<br />
<br />
=== systemd-boot ===<br />
<br />
Adding the following line and running {{ic|bootctl update}} increases font-size in the [[systemd-boot#Loader_configuration|systemd-boot]] menu:<br />
<br />
{{hc|/boot/loader/loader.conf|2=<br />
console-mode 1<br />
}}<br />
<br />
== Applications ==<br />
<br />
{{Accuracy|{{ic|--force-device-scale-factor}} only works on Chromium based (including Electron) applications.}}<br />
<br />
As a general rule, applications can be launched with a custom scaling value, e.g. {{ic|1=$ atom --force-device-scale-factor=2}}. A more permanent solution is to add this scaling factor as a flag to the relevant .conf or .desktop file (normally located at {{ic|/usr/share/applications/}}). In the latter instance, the flag should be added to the line beginning with "Exec=", e.g. {{ic|1=Exec=/usr/bin/atom --force-device-scale-factor=2 %F}}. The next section provides more details on implementing this for specific applications.<br />
<br />
=== Atom ===<br />
<br />
Add {{ic|1=--force-device-scale-factor=2}} as a flag to the atom.desktop file:<br />
<br />
{{hc|/usr/share/applications/atom.desktop|2=<br />
Exec=/usr/bin/atom --force-device-scale-factor=2 %F<br />
}}<br />
<br />
=== Browsers ===<br />
<br />
==== Firefox ====<br />
<br />
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.<br />
<br />
To override those, open Firefox advanced preferences page ({{ic|about:config}}) and set parameter {{ic|layout.css.devPixelsPerPx}} to {{ic|2}} (or find the one that suits you better; {{ic|2}} is a good choice for Retina screens), but it also does not consistently scale the entirety of Firefox. If Firefox is not scaling fonts, you may want to create {{ic|userChrome.css}} and add appropriate styles to it. More information about {{ic|userChrome.css}} at [http://kb.mozillazine.org/index.php?title=UserChrome.css mozillaZine].<br />
<br />
{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|<br />
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");<br />
<br />
/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */<br />
* {<br />
font-size: 15px !important;<br />
}<br />
<br />
/* exception for badge on adblocker */<br />
.toolbarbutton-badge {<br />
font-size: 8px !important;<br />
}<br />
}}<br />
<br />
{{Warning|The AutoHiDPI extension is not compatible with Firefox Quantum (version 57 and above).}}<br />
<br />
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. For users of Firefox version 57 and above, the [https://addons.mozilla.org/firefox/addon/ffreszoom/ ffreszoom] add-on 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].<br />
<br />
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}}.<br />
<br />
You can also use the Wayland-enabled packages of Firefox from the AUR: {{AUR|firefox-wayland}} (compiles from source) or {{AUR|fedora-firefox-wayland-bin}} (binary from Fedora). You might experience some minor visual glitches with these packages.<br />
<br />
==== Chromium / Google Chrome ====<br />
<br />
Chromium should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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}}.<br />
<br />
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}}:<br />
<br />
{{hc|~/.config/chromium-flags.conf|2=<br />
--force-device-scale-factor=2<br />
}}<br />
<br />
To make this work for Chrome, add the same option to {{ic|~/.config/chrome-flags.conf}} instead.<br />
<br />
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.<br />
<br />
==== Opera ====<br />
<br />
Opera should use the [[#GDK 3 (GTK 3)]] settings.<br />
<br />
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.)<br />
<br />
=== Gimp 2.8 ===<br />
<br />
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}}.)<br />
<br />
There is also the [https://github.com/jedireza/gimp-hidpi gimp-hidpi].<br />
<br />
=== Inkscape ===<br />
<br />
To scale the icons to a "usable" size go to ''Preferences > Interface'' and set the icon size to Large or Larger[http://www.inkscapeforum.com/viewtopic.php?t=18684][http://wiki.inkscape.org/wiki/index.php/HiDPI].<br />
<br />
=== IntelliJ IDEA ===<br />
<br />
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:<br />
<br />
:''File > Settings > Behaviour & Appearance > Appearance''<br />
<br />
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.<br />
<br />
=== Java applications ===<br />
<br />
==== AWT/Swing ====<br />
<br />
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,<br />
<br />
java -Dsun.java2d.uiScale=2 -jar some_swing_application.jar<br />
java -Dsun.java2d.uiScale=300% -jar some_swing_application.jar<br />
<br />
Since Java 9 the {{ic|GDK_SCALE}} environment variable is used to scale Swing applications accordingly.<br />
<br />
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}}.<br />
<br />
==== JavaFX ====<br />
<br />
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,<br />
<br />
java -Dglass.gtk.uiScale=200% -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=192dpi -jar some_jfx_application.jar<br />
java -Dglass.gtk.uiScale=2.0 -jar some_jfx_application.jar<br />
<br />
''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.<br />
<br />
==== Mixed AWT/Swing and JavaFX ====<br />
<br />
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.<br />
<br />
=== MATLAB ===<br />
<br />
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]:<br />
<br />
>> s = settings;s.matlab.desktop.DisplayScaleFactor<br />
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2<br />
<br />
The settings take effect after MATLAB is restarted.<br />
<br />
=== Mono applications ===<br />
<br />
According to [https://bugzilla.xamarin.com/show_bug.cgi?id=35870], Mono applications should be scalable like [[#GDK 3 (GTK 3)|GTK 3]] applications.<br />
<br />
=== NetBeans ===<br />
<br />
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]<br />
<br />
The editor fontsize can be controlled from ''Tools > Option > Fonts & Colors''.<br />
<br />
The output window fontsize can be controlled from ''Tools > Options > Miscelaneous > Output''<br />
<br />
=== Skype ===<br />
<br />
Skype for Linux ({{AUR|skypeforlinux-stable-bin}} package) uses [[#GDK 3 (GTK 3)]].<br />
<br />
=== Slack ===<br />
<br />
Slack ({{AUR|slack-desktop}}), like all [https://electronjs.org/ Electron] apps, can be configured to use a custom scaling value by adding a {{ic|1=--force-device-scale-factor}} flag to the .desktop file. This is normally located at {{ic|/usr/share/applications/}}. The flag should be added to the line beginning with "Exec=". For example:<br />
<br />
{{hc|/usr/share/applications/slack.desktop|2=<br />
Exec=env LD_PRELOAD=/usr/lib/libcurl.so.3 /usr/bin/slack --force-device-scale-factor=1.5 %U<br />
}}<br />
<br />
=== Spotify ===<br />
<br />
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:<br />
<br />
{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|2=<br />
app.browser.zoom-level=100<br />
}}<br />
<br />
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<br />
<br />
$ spotify --force-device-scale-factor=1.5<br />
<br />
=== Steam ===<br />
<br />
==== Official HiDPI support ====<br />
<br />
* Starting on 25 of January 2018 in the beta program there is actual support for HiDPI and it should be automatically detected.<br />
* ''Steam > Settings > Interface'', check "Enlarge text and icons based on monitor size" (restart required)<br />
* If it not automatically detected use {{ic|1=GDK_SCALE=2}} to set the desired scale factor.<br />
<br />
==== Unofficial ====<br />
<br />
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. <br />
<br />
{{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}}.}}<br />
<br />
[http://steamcommunity.com/groups/metroskin/discussions/0/517142253861033946/ MetroSkin Unofficial Patch] also helps with HiDPI on Steam with Linux.<br />
<br />
=== Sublime Text 3 ===<br />
<br />
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.<br />
<br />
=== Thunderbird ===<br />
<br />
See [[#Firefox]]. To access {{ic|about:config}}, go to ''Edit > Preferences > Advanced >Config editor''.<br />
<br />
=== VirtualBox ===<br />
<br />
{{Note|This only applies to KDE with scaling enabled.}}<br />
<br />
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]).<br />
<br />
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.<br />
<br />
$ QT_SCALE_FACTOR=0.5 VirtualBox --startvm vm-name<br />
<br />
=== Wine applications ===<br />
<br />
Run<br />
<br />
$ winecfg<br />
<br />
and change the "dpi" setting found in the "Graphics" tab. This only affects the font size.<br />
<br />
=== Zathura document viewer ===<br />
<br />
No modifications required for document viewing.<br />
<br />
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]):<br />
<br />
set font "monospace normal 20"<br />
<br />
=== Zoom ===<br />
<br />
Zoom can be started with a proper scaling by overriding the {{ic|1=QT_SCALE_FACTOR}} environment variable.<br />
<br />
$ QT_SCALE_FACTOR=2 zoom<br />
<br />
=== Unsupported applications ===<br />
<br />
{{AUR|run_scaled-git}} can be used to scale applications (which uses {{Pkg|xpra}} internally).<br />
<br />
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}}.<br />
<br />
[[x11vnc]] has an experimental option {{ic|-appshare}}, which opens one viewer per application window. Perhaps something could be hacked up with that.<br />
<br />
== Multiple displays ==<br />
<br />
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]].<br />
<br />
=== Side display ===<br />
<br />
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:<br />
<br />
$ xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1<br />
<br />
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.<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
{{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].}}<br />
<br />
{{Note|If you are using the {{ic|modesetting}} driver you will get mouse flickering. This can be solved by scaling your non-scaled screen by 0.9999x0.9999.}}<br />
<br />
=== Multiple external monitors ===<br />
<br />
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.<br />
<br />
$ xrandr --output eDP1 --scale 0.5x0.5 --output DP2 --right-of eDP1 --output HDMI1 --right-of DP2<br />
<br />
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.<br />
<br />
=== Mirroring ===<br />
<br />
If all you want is to mirror ("unify") displays, this is easy as well:<br />
<br />
With AxB your native HiDPI resolution (for ex 3200x1800) and CxD your external screen resolution (e.g. 1920x1200)<br />
<br />
$ xrandr --output HDMI --scale [A/C]x[B/D]<br />
<br />
In this example which is QHD (3200/1920 = 1.66 and 1800/1200 = 1.5)<br />
<br />
$ xrandr --output HDMI --scale 1.66x1.5<br />
<br />
For UHD to 1080p (3840/1920=2 2160/1080=2)<br />
<br />
$ xrandr --output HDMI --scale 2x2<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
=== Tools ===<br />
<br />
There are several tools which automate the commands described above.<br />
<br />
* [https://gist.github.com/wvengen/178642bbc8236c1bdb67 This script] extend a non-HiDPI external display above a HiDPI internal display.<br />
* [https://github.com/ashwinvis/xrandr-extend xrandr-extend].<br />
* {{AUR|xlayoutdisplay}} is a CLI front end for xrandr which detects and sets correct DPI: [https://github.com/alex-courtis/xlayoutdisplay README]<br />
<br />
== Linux console ==<br />
<br />
The default [[w:Linux console|Linux console]] font will be very small on HiDPI displays, the largest font present in the {{Pkg|kbd}} package is {{ic|latarcyrheb-sun32}} and other packages like {{Pkg|terminus-font}} contain further alternatives, such as {{ic|ter-132n}}(normal) and {{ic|ter-132b}}(bold). See [[Linux console#Fonts]] for configuration details. Also see [[Linux console#Persistent configuration]] in particular for applying the font setting during the early userspace boot sequence.<br />
<br />
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.<br />
<br />
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.<br />
<br />
== See also ==<br />
<br />
* [http://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)<br />
* [http://www.eizo.com/library/basics/pixel_density_4k/ Understanding pixel density]<br />
* [http://wok.oblomov.eu/tecnologia/mixed-dpi-x11/ Mixed DPI and the X Window System]</div>SECuREhttps://wiki.archlinux.org/index.php?title=Syslog-ng&diff=584385Syslog-ng2019-10-04T07:37:31Z<p>SECuRE: Fix reload command (missing @default)</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Logging]]<br />
[[Category:Daemons]]<br />
[[ja:Syslog-ng]]<br />
{{Related articles start}}<br />
{{Related|rsyslog}}<br />
{{Related articles end}}<br />
<br />
[[w:syslog-ng|syslog-ng]] is a [[w:syslog|syslog]] implementation which can take log messages from sources and forward them to destinations, based on powerful filter directives.<br />
<br />
{{Note|With [[systemd/Journal|systemd's journal]], syslog-ng is not needed by most users.}}<br />
<br />
== Overview ==<br />
<br />
syslog-ng takes incoming log messages from defined '[[#Sources|sources]]' and forwards them to the appropriate [[#Destinations|destinations]], based on powerful [[#Creating Filters for Messages|filter]] directives. In a typical simple set-up, syslog-ng will read messages from three sources:<br />
<br />
# the default {{ic|/dev/log}} device, where most logs are sent<br />
# syslog-ng "internal" log messages<br />
# {{ic|/proc/kmsg}} kernel messages<br />
<br />
Sources are defined using the "source" directive. These incoming messages are then filtered according to defined filters ("filter" keyword), i.e. according to originating program or log level, and sent to the appropriate "destination". Destinations include log files (e.g. {{ic|/var/log/messages.log}}), printing messages on a console and remote servers. The pivotal function is [[#Log Paths|log]]. This function defines which filters should be applied to a certain source, and where the resulting messages should be sent to.<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|syslog-ng}} package.<br />
<br />
To use syslog-ng, [[start]]/[[enable]] {{ic|syslog-ng@default.service}}.<br />
<br />
=== systemd/journald integration ===<br />
<br />
syslog-ng pulls in the messages from the systemd journal by default. Keeping {{ic|1=ForwardToSyslog=no}} in {{ic|/etc/systemd/journald.conf}} is recommended in order to avoid the overhead associated with the socket and to avoid [https://github.com/balabit/syslog-ng/issues/314 needless error messages in the log]. If on the other hand you do not want to store your logs twice and turn ''journald'''s {{ic|1=Storage=none}}, you '''will''' need {{ic|1=ForwardToSyslog=yes}}, as ''syslog-ng'' tries to follow the 'journald' journal file.<br />
<br />
See [[#syslog-ng and systemd journal]] for more details.<br />
<br />
== Sources ==<br />
syslog-ng receives log messages from a source. To define a source you should follow the following syntax:<br />
source <identifier> { source-driver(params); source-driver(params); ... };<br />
<br />
You can look at the identifiers and source-drivers in the [https://www.syslog-ng.com/technical-documents official manuals]. <br />
This will follow the manual to explain the configuration file above. The unix-stream() source-driver opens the given AF_UNIX<br />
[[wikipedia:Berkeley_sockets|socket]] and starts listening on it for messages. <br />
The internal() source-driver gets messages generated by syslog-ng.<br />
<br />
Therefore, the following means: {{ic|src}} gets messages from the {{ic|/dev/log}} socket and syslog-ng.<br />
source src { unix-stream("/dev/log"); internal(); };<br />
<br />
The kernel sends log messages to {{ic|/proc/kmsg}} and the file() driver reads log messages from files. Therefore, the following means:<br />
kernsrc gets messages from file {{ic|/proc/kmsg}}<br />
source kernsrc { file("/proc/kmsg"); };<br />
<br />
In the default configuration file after emerging syslog-ng, the source is defined as:<br />
source src { unix-stream("/dev/log"); internal(); pipe("/proc/kmsg"); };<br />
<br />
Reading messages by {{ic|pipe("/proc/kmsg")}} gives a better performance but because it opens its argument in read-write mode can be a security<br />
hazard as the [https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.20/administration-guide/21#TOPIC-1121850 syslog-ng admin guide] states:<br />
<br />
"Pipe is very similar to the file() driver, but there are a few differences, for example pipe() opens its argument in read-write mode, therefore it is not recommended to be used on special files like {{ic|/proc/kmsg}}." (You can follow this discussion in [https://forums.gentoo.org/viewtopic-t-558161.html this post].)<br />
<br />
To open a port to read data from a remote server a source must be defined with this syntax:<br />
source s_net { udp(); };<br />
<br />
for UDP or<br />
source s_net { tcp(); };<br />
<br />
to receive log messages via TCP. Both listen on port 514.<br />
<br />
=== syslog-ng and systemd journal ===<br />
Starting with syslog-ng version 3.6.1 the default {{ic|system()}} source on Linux systems using systemd uses journald as its standard {{ic|system()}} source.<br />
<br />
If you wish to use both the journald and syslog-ng files, ensure the following settings are in effect. For systemd-journald, in the {{ic|/etc/systemd/journald.conf}} file, {{ic|1=Storage=}} either set to {{ic|auto}} or unset (which defaults to auto) and {{ic|1=ForwardToSyslog=}} set to {{ic|no}} or unset (defaults to no). For {{ic|/etc/syslog-ng/syslog-ng.conf}}, you need the following {{ic|source}} stanza:<br />
<br />
{{bc|<nowiki><br />
source src {<br />
system();<br />
internal();<br />
};</nowiki>}}<br />
<br />
If, on the other hand, you wish ''not'' to retain the journald logs, but only syslog-ng's text logs, set {{ic|<nowiki>Storage=volatile</nowiki>}} and {{ic|1=ForwardToSyslog=yes}} in {{ic|/etc/systemd/journald.conf}}. This will store journald in ram. As of syslog-ng 3.6.3, syslog-ng is using journald as the system(); source so if you set {{ic|1=Storage=none}}, the systemd journal will drop all messages and '''not''' forward them to syslog-ng.<br />
<br />
After the change [[restart]] the {{ic|systemd-journald.service}} and {{ic|syslog-ng@default.service}} daemons.<br />
<br />
== Destinations ==<br />
In syslog-ng, log messages are sent to files. The syntax is very similar to sources:<br />
destination <identifier> {destination-driver(params); destination-driver(params); ... };<br />
<br />
You will be normally logging to a file, but you could log to a different destination-driver: pipe, Unix socket, TCP-UDP ports,<br />
terminals or to specific programs. Therefore, this means sending authlog messages to {{ic|/var/log/auth.log}}:<br />
destination authlog { file("/var/log/auth.log"); };<br />
<br />
If the user is logged in, {{ic|usertty()}} sends messages to the terminal of the specified user. If you want to send console messages<br />
to root's terminal if it is logged in:<br />
destination console { usertty("root"); };<br />
<br />
Messages can be sent to a pipe with {{ic|pipe()}}. The following sends xconsole messages to the pipe {{ic|/dev/xconsole}}.<br />
This needs some more configuration, so you could look at the sub-section xconsole below.<br />
destination xconsole { pipe("/dev/xconsole"); };<br />
<br />
To send messages on the network, use {{ic|udp()}}. The following will send your log data out to another server.<br />
destination remote_server { udp("10.0.0.2" port(514)); };<br />
<br />
== Creating Filters for Messages ==<br />
The syntax for the filter statement is:<br />
filter <identifier> { expression; };<br />
<br />
Functions can be used in the expression, such as the function {{ic|facility()}} which selects messages based on the facility codes. <br />
The Linux kernel has a few facilities you can use for logging. Each facility has a log-level; where debug is the most verbose,<br />
and panic only shows serious errors. You can find the facilities, log levels and priority names in {{ic|/usr/include/sys/syslog.h}}.<br />
To filter those messages coming from authorization, like <br />
''<nowiki>May 11 23:42:31 mimosinnet su(pam_unix)[18569]: session opened for user root by (uid=1000)</nowiki>'', use the following:<br />
filter f_auth { facility(auth); };<br />
<br />
The facility expression can use the boolean operators {{ic|and}}, {{ic|or}}, and {{ic|not}}, so the following filter<br />
selects those messages not coming from authorization, network news or mail:<br />
filter f_debug { not facility(auth, authpriv, news, mail); };<br />
<br />
The function {{ic|level()}} selects messages based on its priority level, so if you want to select informational levels:<br />
filter f_info { level(info); };<br />
<br />
Functions and boolean operators can be combined in more complex expressions. The following line filters messages with a priority level from<br />
informational to warning not coming from auth, authpriv, mail and news facilities:<br />
filter f_messages { level(info..warn) and not facility(auth, authpriv, mail, news); };<br />
<br />
Messages can also be selected by matching a regular expression in the message with the function {{ic|match("regex" value("TEMPLATE"))}}. For example:<br />
filter f_failed { match("failed" value("MESSAGE")); };<br />
<br />
here is a list of templates : <br />
"AMPM", "BSDTAG", "DATE, C_DATE, R_DATE, S_DATE", "DAY, C_DAY, R_DAY, S_DAY", "FACILITY", "FACILITY_NUM", "FULLDATE, C_FULLDATE, R_FULLDATE, S_FULLDATE", "FULLHOST", "FULLHOST_FROM", "HOUR, C_HOUR, R_HOUR, S_HOUR", "HOUR12, C_HOUR12, R_HOUR12, S_HOUR12", "HOST", "HOST_FROM", "ISODATE, C_ISODATE, R_ISODATE, S_ISODATE", "LEVEL_NUM", "LOGHOST", "MIN, C_MIN, R_MIN, S_MIN", "MONTH, C_MONTH, R_MONTH, S_MONTH", "MONTH_ABBREV, C_MONTH_ABBREV, R_MONTH_ABBREV, S_MONTH_ABBREV", "MONTH_NAME, C_MONTH_NAME, R_MONTH_NAME, S_MONTH_NAME", "MONTH_WEEK, C_MONTH_WEEK, R_MONTH_WEEK, S_MONTH_WEEK", "MSEC, C_MSEC, R_MSEC, S_MSEC", "MSG or MESSAGE", "MSGHDR", "MSGID", "MSGONLY", "PID", "PRI", "PRIORITY or LEVEL", "PROGRAM", "SDATA, .SDATA.SDID.SDNAME", "SEC, C_SEC, R_SEC, S_SEC", "SOURCEIP", "SEQNUM", "STAMP, R_STAMP, S_STAMP", "SYSUPTIME", "TAG", "TAGS", "TZ, C_TZ, R_TZ, S_TZ", "TZOFFSET, C_TZOFFSET, R_TZOFFSET, S_TZOFFSET", "UNIXTIME, C_UNIXTIME, R_UNIXTIME, S_UNIXTIME", "USEC, C_USEC, R_USEC, S_USEC", "YEAR, C_YEAR, R_YEAR, S_YEAR", "WEEK, C_WEEK, R_WEEK, S_WEEK", "WEEK_ABBREV, C_WEEK_ABBREV, R_WEEK_ABBREV, S_WEEK_ABBREV", "WEEK_DAY, C_WEEK_DAY, R_WEEK_DAY, S_WEEK_DAY", "WEEKDAY, C_WEEKDAY, R_WEEKDAY, S_WEEKDAY", "WEEK_DAY_NAME, C_WEEK_DAY_NAME, R_WEEK_DAY_NAME, S_WEEK_DAY_NAME".<br />
<br />
To filter messages received from a particular remote host, the {{ic|host()}} function must be used:<br />
filter f_host { host( "192.168.1.1" ); };<br />
<br />
== Log Paths ==<br />
syslog-ng connects sources, filters and destinations with log statements. The syntax is:<br />
log {source(s1); source(s2); ...<br />
filter(f1); filter(f2); ...<br />
destination(d1); destination(d2); ...<br />
flags(flag1[, flag2...]); };<br />
<br />
The following for example sends messages from {{ic|src}} source to {{ic|mailinfo}} destination filtered by {{ic|f_info}} filter.<br />
log { source(src); filter(f_mail); filter(f_info); destination(mailinfo); };<br />
<br />
== Tips and Tricks ==<br />
After understanding the logic behind syslog-ng, many possible and complex configuration are possible. Here there are some examples.<br />
<br />
=== Have syslog-ng reload the configuration file ===<br />
<br />
You can make syslog-ng re-evaluate the configuration file. You can do so manually by sending a {{ic|SIGHUP}} to the process, or call the reload function with systemctl:<br />
# systemctl reload syslog-ng@default<br />
<br />
=== Failover Logging to Remote Host ===<br />
This setup shows how to send the default unencrypted syslog packets across both TCP and UDP protocols, using the standard port (514) and an alternate port. This is sending the same output to the same machine 4 different ways to try and make sure packets make it. Mostly useful if you are debugging a remote server that fails to reboot. The different ports and protocols are to make it past any firewall filters or other network problems. Also useful for port-forwarding and using tunnels. Something like this setup is ideal to tunnel across an ssh connection that the prone-to-failover host initiates through a reverse connection.<br />
<br />
{{bc|<nowiki>#sending to a remote syslog server on TCP and UDP ports (not encrypted)<br />
destination askapache_failover_loghost {<br />
tcp("208.86.158.195" port(25214));<br />
udp("208.86.158.195" port(25214));<br />
udp("mysyslog1.dyndns.org" port(514));<br />
};<br />
log { <br />
source(src); <br />
destination(askapache_failover_loghost);<br />
};</nowiki><br />
}}<br />
<br />
And then on the loghost receiving these logs:<br />
<br />
{{bc|<nowiki>#a USB redirected console for flexible viewing<br />
destination debugging_console {<br />
file("/dev/ttyU1");<br />
};<br />
<br />
# listens on IP addresses and ports, sets the incoming settings<br />
source prone_to_failover_host {<br />
tcp(ip(208.86.158.195),port(25214));<br />
udp(ip(208.86.158.195) port(25214));<br />
<br />
udp(default-facility(syslog) default-priority(emerg));<br />
tcp(default-facility(syslog) default-priority(emerg));<br />
}<br />
<br />
# log it<br />
log {<br />
source(prone_to_failover_host); <br />
destination(debugging_console);<br />
};</nowiki><br />
}}<br />
<br />
=== Move log to another file ===<br />
In order to move some log from {{ic|/var/log/messages}} to another file:<br />
<br />
{{bc|<nowiki>#sshd configuration<br />
destination ssh { file("/var/log/ssh.log"); };<br />
filter f_ssh { program("sshd"); };<br />
log { source(src); filter(f_ssh); destination(ssh); };</nowiki><br />
}}<br />
<br />
=== Configuring as a loghost ===<br />
Configuring your system to be a loghost is quite simple. Drop the following into your configuration, and create the needed directory.<br />
With this simple configuration, log filenames will be based on the [[Wikipedia:FQDN|FQDN]] of the remote host,<br />
and located in {{ic|/var/log/remote/}}. After creating the remote directory, reload your syslog-ng configuration.<br />
<br />
{{bc|<nowiki>source net { udp(); };<br />
destination remote { file("/var/log/remote/${FULLHOST}-log"); };<br />
log { source(net); destination(remote); };</nowiki><br />
}}<br />
<br />
=== Improve Performance ===<br />
syslog-ng's performance can be improved in different ways:<br />
<br />
==== Write every so often ====<br />
It seems that the old {{ic|sync(X)}} '''option''' is called {{ic|flush_lines(X)}} now, where the writing to the file is buffered for {{ic|X}} lines. Default is 0 (no buffering).<br />
<br />
==== Avoid redundant processing and disk space ====<br />
A single log message can be sent to different log files several times. For example, in the initial configuration file, we have the following definitions:<br />
<br />
{{bc|<nowiki>destination cron { file("/var/log/cron.log"); };<br />
destination messages { file("/var/log/messages"); };<br />
filter f_cron { facility(cron); };<br />
filter f_messages { level(info..warn) <br />
and not facility(auth, authpriv, mail, news); };<br />
log { source(src); filter(f_cron); destination(cron); };<br />
log { source(src); filter(f_messages); destination(messages); };</nowiki><br />
}}<br />
<br />
The same message from the {{ic|cron}} facility will end up in both the {{ic|cron.log}} and {{ic|messages}} files. To change this behavior we can use the {{ic|final}} flag, <br />
ending up further processing with the message. Therefore, in this example, if we want messages from the {{ic|cron}} facility not ending up in the<br />
messages file, we should change the cron's log sentence by:<br />
<br />
log { source(src); filter(f_cron); destination(cron); flags(final); };<br />
<br />
another way is to exclude the {{ic|cron}} facility from {{ic|f_messages}} filter:<br />
filter f_messages { level(info..warn) and not facility(cron, auth, authpriv, mail, news); };<br />
<br />
=== PostgreSQL Destination ===<br />
This section will use two roles: {{ic|syslog}} and {{ic|logwriter}}. {{ic|syslog}} will be the administrator of the database {{ic|syslog}} and {{ic|logwriter}} will only be able to add records to the {{ic|logs}} table.<br />
<br />
No longer needed to create table for logs. syslog-ng will create automatically.<br />
psql -U postgres<br />
<br />
postgres=# CREATE ROLE syslog WITH LOGIN;<br />
postgres=# \password syslog # Using the \password function is secure because<br />
postgres=# CREATE ROLE logwriter WITH LOGIN;<br />
postgres=# \password logwriter # the password is not saved in history.<br />
postgres=# CREATE DATABASE syslog OWNER syslog;<br />
postgres=# \q # You are done here for the moment<br />
<br />
Edit {{ic|pg_hba.conf}} to allow {{ic|syslog}} and {{ic|logwriter}} to establish a connection to PostgreSQL.<br />
<br />
{{hc|/var/lib/postgres/data/pg_hba.conf|<br />
# TYPE DATABASE USER CIDR-ADDRESS METHOD<br />
<br />
host syslog logwriter 192.168.0.1/24 md5<br />
host syslog syslog 192.168.0.10/32 md5<br />
}}<br />
<br />
Tell PostgreSQL to reload the configuration files:<br />
<br />
# systemctl reload postgresql<br />
<br />
Edit {{ic|/etc/syslog-ng/syslog-ng.conf}} so that it knows where and how to write to PostgreSQL. syslog-ng will utilize the {{ic|logwriter}} role.<br />
<br />
{{bc|<nowiki>...<br />
#<br />
# SQL logging support<br />
#<br />
<br />
destination d_pgsql {<br />
sql(type(pgsql)<br />
host("127.0.0.1") username("logwriter") password("password")<br />
database("syslog")<br />
table("logs_${HOST}_${R_YEAR}${R_MONTH}${R_DAY}") #or whatever you want, example ${HOST}" for hosts, ${LEVEL}" for levels.. etc<br />
columns("datetime timestamp with time zone", "host varchar(32)", "program varchar(16)", "pid varchar(16)", "message varchar(200)")<br />
values("$R_ISODATE", "$HOST", "$PROGRAM", "$PID", "$MSG")<br />
indexes("datetime", "host", "program", "pid", "message"));<br />
};<br />
<br />
log { source(src); destination(d_pgsql); };</nowiki><br />
}}<br />
<br />
Finally, restart syslog-ng.<br />
# systemctl restart syslog-ng<br />
<br />
And check to see if things are being logged.<br />
psql -U logwriter -d syslog<br />
syslog=> SELECT * FROM <your table name> ORDER BY datetime DESC LIMIT 10;<br />
<br />
=== ISO 8601 timestamps ===<br />
'''Before''' :<br />
#logger These timestamps are not optimal.<br />
#tail -n 1 /var/log/messages.log<br />
Feb 18 14:25:01 hostname logger: These timestamps are not optimal.<br />
#<br />
<br />
Add {{ic|ts_format(iso);}} to {{ic|/etc/syslog-ng/syslog-ng.conf}} in the options section. Example:<br />
options {<br />
stats_freq (0);<br />
flush_lines (0);<br />
time_reopen (10);<br />
log_fifo_size (1000);<br />
long_hostnames(off); <br />
use_dns (no);<br />
use_fqdn (no);<br />
create_dirs (no);<br />
keep_hostname (yes);<br />
perm(0640);<br />
group("log");<br />
ts_format(iso); #make ISO-8601 timestamps<br />
#frac-digits(3); #optional time to nearest millisecond <br />
};<br />
<br />
Then:<br />
# systemctl reload syslog-ng<br />
<br />
'''After''' :<br />
#logger Now THAT is a timestamp!<br />
#tail -n 2 /var/log/messages.log<br />
Feb 18 14:25:01 hostname logger: These timestamps are not optimal.<br />
2010-02-18T20:23:58-05:00 electron logger: Now THAT is a timestamp!<br />
#<br />
<br />
=== RFC 3339 timestamps ===<br />
Same as above, except use {{ic|rfc3339}} instead of {{ic|iso}} for {{ic|ts_format}}<br />
<br />
=== Log Levels ===<br />
<br />
Log levels are defined separately for each logged facility in syslog-ng config. Available log levels are listed in /usr/include/sys/syslog.h :<br />
<br />
define LOG_EMERG 0 /* system is unusable */<br />
define LOG_ALERT 1 /* action must be taken immediately */<br />
define LOG_CRIT 2 /* critical conditions */<br />
define LOG_ERR 3 /* error conditions */<br />
define LOG_WARNING 4 /* warning conditions */<br />
define LOG_NOTICE 5 /* normal but significant condition */<br />
define LOG_INFO 6 /* informational */<br />
define LOG_DEBUG 7 /* debug-level messages */<br />
<br />
=== Macros and Variables ===<br />
Macros can be used in both templates, and in destination file names. [https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.20/administration-guide/60#TOPIC-1122008 Macros of syslog-ng OSE].<br />
<br />
The following code will write the log lines to {{ic|/var/log/test.log}} in the format of {{ic|<nowiki>macroname=value@</nowiki>}}. <br />
<br />
{{bc|<nowiki>template t_test { template("PROGRAM=$PROGRAM@PID=$PID@BSDTAG=$BSDTAG@TAG=$TAG@TAGS=$TAGS@FACILITY=$FACILITY@FACILITY_NUM=$FACILITY_NUM@LEVEL=$LEVEL@LEVEL_NUM=$LEVEL_NUM@PRI=$PRI@PRIORITY=$PRIORITY@FULLHOST=$FULLHOST@FULLHOST_FROM=$FULLHOST_FROM@HOST=$HOST@HOST_FROM=$HOST_FROM@LOGHOST=$LOGHOST@MSGHDR=$MSGHDR@MSGID=$MSGID@MSGONLY=$MSGONLY@MSG=$MSG@MESSAGE=$MESSAGE@SOURCE=$SOURCE@SOURCEIP=$SOURCEIP@SOURCE_IP=$SOURCE_IP@SEQNUM=$SEQNUM@UNIXTIME=$UNIXTIME@FULLDATE=$FULLDATE@ISODATE=$ISODATE@DATE=$DATE@STAMP=$STAMP@TZ=$TZ@TZOFFSET=$TZOFFSET@SEC=$SEC@MIN=$MIN@HOUR=$HOUR@HOUR12=$HOUR12@DAY=$DAY@WEEK=$WEEK@WEEK_DAY=$WEEK_DAY@WEEK_DAY_ABBREV=$WEEK_DAY_ABBREV@WEEK_DAY_NAME=$WEEK_DAY_NAME@MONTH=$MONTH@MONTH_ABBREV=$MONTH_ABBREV@MONTH_NAME=$MONTH_NAME@MONTH_WEEK=$MONTH_WEEK@YEAR=$YEAR@YEAR_DAY=$YEAR_DAY<br />
\n"); template_escape(no); };<br />
<br />
destination d_test { file("/var/log/test.log" template(t_test)); };<br />
<br />
log { source(s_local); destination(d_test); flags(final); };<br />
</nowiki>}}<br />
<br />
You can create your own value list as below once syslog-ng is restarted with:<br />
{{ic|<nowiki>tail /var/log/test.log|tr "@" "\n"</nowiki>}}<br />
<br />
{{bc|<nowiki><br />
PROGRAM=kernel<br />
PID=<br />
BSDTAG=4A<br />
TAG=04<br />
TAGS=.source.s_local<br />
FACILITY=kern<br />
FACILITY_NUM=0<br />
LEVEL=warning<br />
LEVEL_NUM=4<br />
PRI=4<br />
PRIORITY=warning<br />
FULLHOST=www.askapache.com<br />
FULLHOST_FROM=www.askapache.com<br />
HOST=www.askapache.com<br />
HOST_FROM=www.askapache.com<br />
LOGHOST=<br />
MSGHDR=kernel: <br />
MSGID=<br />
MSGONLY=Firewall: *INVALID* IN=eth0 OUT= MAC=00:00 SRC=x.x.x.x DST=198.101.159.98 LEN=40 TOS=0x00 PREC=0x00 TTL=113 ID=7730 DF PROTO=TCP SPT=52369 DPT=80 WINDOW=0 RES=0x00 ACK RST URGP=0 <br />
MSG=Firewall: *INVALID* IN=eth0 OUT= MAC=00:00 SRC=x.x.x.x DST=198.101.159.98 LEN=40 TOS=0x00 PREC=0x00 TTL=113 ID=7730 DF PROTO=TCP SPT=52369 DPT=80 WINDOW=0 RES=0x00 ACK RST URGP=0 <br />
MESSAGE=Firewall: *INVALID* IN=eth0 OUT= MAC=00:00 SRC=x.x.x.x DST=198.101.159.98 LEN=40 TOS=0x00 PREC=0x00 TTL=113 ID=7730 DF PROTO=TCP SPT=52369 DPT=80 WINDOW=0 RES=0x00 ACK RST URGP=0 <br />
SOURCE=s_local<br />
SOURCEIP=127.0.0.1<br />
SOURCE_IP=<br />
UNIXTIME=1369742458<br />
FULLDATE=2013 May 28 08:00:58<br />
ISODATE=2013-05-28T08:00:58-04:00<br />
DATE=May 28 08:00:58<br />
STAMP=2013-05-28T08:00:58-04:00<br />
TZ=-04:00<br />
TZOFFSET=-04:00<br />
SEC=58<br />
MIN=00<br />
HOUR=08<br />
HOUR12=<br />
DAY=28<br />
WEEK=21<br />
WEEK_DAY=3<br />
WEEK_DAY_ABBREV=Tue<br />
WEEK_DAY_NAME=Tuesday<br />
MONTH=05<br />
MONTH_ABBREV=May<br />
MONTH_NAME=May<br />
MONTH_WEEK=4<br />
YEAR=2013<br />
YEAR_DAY=148<br />
</nowiki>}}<br />
<br />
=== Receive and parse common syslog messages ===<br />
Starting from version 3.16 syslog-ng is capable to receive and parse messages on the most common ports with the most common parsers using the [https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.20/administration-guide/17#TOPIC-1121831 default-network-drivers()] source driver.<br />
* Default listening ports:<br />
** 514, both TCP and UDP, for RFC3164 (BSD-syslog) formatted traffic<br />
** 601 TCP, for RFC5424 (IETF-syslog) formatted traffic<br />
** 6514 TCP, for TLS-encrypted traffic<br />
* Automatic parsers:<br />
** RFC3164 message parser<br />
** RFC5424 message parser<br />
** [https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.20/administration-guide/68#TOPIC-1122040 Cisco parser]<br />
** Structured [https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.20/administration-guide/ewmm-intro EWMM parser]<br />
** Other application adapters (Splunk Common Information Model (CIM), iptables, or sudo)<br />
<br />
=== See Also ===<br />
* [[Netconsole]] A kernel module that sends all kernel log messages (i.e. dmesg) over the network to another computer, without involving user space (e.g. syslogd).<br />
<br />
== External Links ==<br />
* [https://www.syslog-ng.com/products/open-source-log-management/ syslog-ng OSE Main Page]<br />
* [https://github.com/balabit/syslog-ng syslog-ng OSE Project Page on GitHub]<br />
* [https://www.syslog-ng.com/technical-documents Portal to syslog-ng Documentation]<br />
** [https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.20/administration-guide The syslog-ng 3.20 Administrator Guide]<br />
** [https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.20/administration-guide/60#TOPIC-1122008 List of syslog-ng 3.20 Macros]<br />
* [https://www.syslog-ng.com/community/ syslog-ng Blogs]<br />
* [http://freshmeat.sourceforge.net/projects/syslog-ng/ syslog-ng Project Page on Freecode]<br />
* [https://wiki.gentoo.org/wiki/Syslog-ng Gentoo syslog-ng wiki]<br />
* [https://wiki.gentoo.org/wiki/Security_Handbook/Logging Gentoo Security Handbook on Logging]<br />
* [https://www.pcwdld.com/what-is-syslog-including-servers-and-ports What is Syslog? Logging with PostgreSQL HOWTO]<br />
* [[wikipedia:ISO 8601|ISO 8601]] on Wikipedia<br />
* [https://tools.ietf.org/html/rfc3164 RFC 3164] - The BSD syslog Protocol<br />
* [https://tools.ietf.org/html/rfc3164 RFC 5424] - The Syslog Protocol<br />
** [https://tools.ietf.org/html/rfc5425 RFC 5425] - Transport Layer Security (TLS) Transport Mapping for Syslog<br />
** [https://tools.ietf.org/html/rfc5425 RFC 5426] - Transmission of Syslog Messages over UDP<br />
** [https://tools.ietf.org/html/rfc5425 RFC 5427] - Textual Conventions for Syslog Management<br />
** [https://tools.ietf.org/html/rfc5425 RFC 5428] - MIB for PacketCable and IPCablecom-Compliant Devices<br />
* [https://tools.ietf.org/html/rfc3339 RFC 3339] - Date and Time on the Internet: Timestamps</div>SECuREhttps://wiki.archlinux.org/index.php?title=HiDPI&diff=374182HiDPI2015-05-19T19:54:25Z<p>SECuRE: Remove note that hidpi support will take some time, it’s in the stable release now.</p>
<hr />
<div>[[Category:Graphics]]<br />
[[ja:HiDPI]]<br />
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 Apple products or high-end "ultrabooks", as well as in 4K (Ultra HD) or even 5K monitors.<br />
<br />
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.<br />
<br />
== Desktop environments ==<br />
<br />
=== GNOME ===<br />
<br />
To enable HiDPI, use gsettings:<br />
<br />
gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
=== KDE ===<br />
<br />
{{Out of date|Needs to be updated for KDE 5.}}<br />
KDE still has its share of HiDPI [https://community.kde.org/KDE/High-dpi_issues issues] but HiDPI support can be improved by changing the below settings:<br />
<br />
# Increase font dpi (System Settings → Application Appearance → Fonts → Force font dpi, enter a number such as 125, 144 or 150 etc)<br />
# Increase icon sizes (System Settings → Application Appearance → Icons → Advanced, here choose a higher icon size for all icons, eg. just increase each icon type by one step) <br />
<br />
=== Xfce ===<br />
<br />
Go to Settings Editor (you can find it in Settings Manager), and change the DPI parameter in {{ic|xsettings}} → {{ic|Xft}}. The value of 180 seems to work well on Retina screens.<br />
<br />
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.<br />
<br />
=== Cinnamon ===<br />
<br />
Supports HiDPI since 2.2. Even without rebuilding GTK3, the support is pretty good (e.g. window borders are correctly sized, which is not the case under Xfce).<br />
<br />
=== Enlightenment ===<br />
<br />
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.<br />
<br />
== X Server ==<br />
<br />
Some programs use the physical width to detect the DPI. 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]).<br />
<br />
To verify that the X Server has properly detected the physical dimensions of your monitor, run:<br />
<br />
$ xdpyinfo | grep -B 2 resolution<br />
screen #0:<br />
dimensions: 3200x1800 pixels (423x238 millimeters)<br />
resolution: 192x192 dots per inch<br />
<br />
This examples uses inaccurate dimensions (423mm x 328mm, even though the Dell XPS 9530 has 346mm x 194mm) to have a clean multiple of 96 dpi, in this case 192 dpi. This tends to work better than using the correct DPI — Pango renders fonts crisper in i3 for example.<br />
<br />
If the DPI displayed by xdpyinfo is not correct, see [[Xorg#Display_size_and_DPI]] for how to fix it.<br />
<br />
== X Resources ==<br />
<br />
If you are not using a desktop environment such as GNOME, KDE, Xfce, or other that manipulates the X settings for you, you can set the desired Xft DPI setting manually in {{ic|~/.Xresources}}:<br />
<br />
{{hc|~/.Xresources|<nowiki><br />
Xft.dpi: 180<br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintfull<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
</nowiki>}}<br />
<br />
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).<br />
<br />
This will make the font render properly in most toolkits and applications, it will however not affect things such as icon size!<br />
<br />
== Browsers ==<br />
<br />
=== Firefox ===<br />
<br />
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).<br />
<br />
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.<br />
<br />
From Firefox version 38 onwards, your system (GTK+ 3.10) settings should be taken into account.[https://bugzilla.mozilla.org/show_bug.cgi?id=975919]<br />
<br />
=== Chromium / Google Chrome ===<br />
<br />
Full HiDPI support in Chrome is now available in the main branch {{AUR| google-chrome}} as of version 43.0.2357.2-1 and works out of the box as tested with Gnome and Cinnamon. Additionally, using older Chrome packages from AUR, and possibly chromium packages as well (not tested) the browser can be launched with the command line flag {{ic|--force-device-scale-factor}} and a scaling value. This will scale all content and ui, including tab and font size. For example:<br />
<br />
{{bc|1=google-chrome --force-device-scale-factor=2}}<br />
<br />
Using this option, a scaling factor of 1 would be normal scaling. Floating point values can be used.<br />
<br />
=== Opera ===<br />
<br />
Since version 24 one can alter Opera's DPI by starting it with the {{ic|1=--alt-high-dpi-setting=X}} command line option, where X is the desired DPI. For example, with {{ic|1=--alt-high-dpi-setting=144}} Opera will assume that DPI is 144. Newer versions of opera will auto detect the DPI using the font DPI setting (in KDE: the force font DPI setting.)<br />
<br />
Generally speaking, Opera's HiDPI support is excellent. Since it is also built using Chrome's blink renderer, and has an extension which runs most Chrome extensions, it is a very viable alternative to Chrome with much better HiDPI support.<br />
<br />
== Mail clients ==<br />
<br />
=== Thunderbird ===<br />
<br />
See [[#Firefox]]. To access {{ic|about:config}}, go to Edit → Preferences → Advanced → Config editor.<br />
<br />
=== Geary ===<br />
<br />
[https://wiki.gnome.org/Apps/Geary Geary]'s native UI elements are rendered by GTK3, so HiDPI works out of the box. However, the messages themselves are rendered by webkitgtk, which at the moment does not have HiDPI-support built-in, so the messages will appear blurry.<br />
<br />
There is a patched webkitgtk version, {{AUR|webkitgtk-hidpi}} in the [[AUR]], that will properly render webkit pages for HiDPI displays. Note that compilation of webkitgtk can take several hours. For a pre-built version you can install with pacman, see [https://github.com/hckr/webkitgtk-hidpi-bin here].<br />
<br />
== Skype ==<br />
<br />
Skype is a Qt program, and needs to be configured separately. You cannot change the DPI setting for it, but at least you can change font size. Install {{Pkg|qt4}} and run {{ic|qtconfig-qt4}} to do it.<br />
<br />
== IntelliJ IDEA ==<br />
<br />
If HiDPI support does not work, you have to add {{ic|1=-Dhidpi=true}} to your vmoptions file.[https://youtrack.jetbrains.com/issue/IDEA-114944]<br />
/usr/share/intellij-idea-ultimate-edition/bin/idea.vmoptions<br />
/usr/share/intellij-idea-ultimate-edition/bin/idea64.vmoptions<br />
<br />
== NetBeans ==<br />
<br />
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]<br />
<br />
The editor fontsize can be controlled from Tools → Option → Fonts & Colors.<br />
<br />
The output window fontsize can be controlled from Tools → Options → Miscelaneous → Output<br />
<br />
== Gimp 2.8 ==<br />
<br />
Use a high DPI theme, or [http://gimpforums.com/thread-increase-all-icons-on-hidpi-screen?pid=39113#pid39113 adjust] {{ic|1=gtkrc}} of an existing theme. For example set {{ic|1=GimpToolPalette::tool-icon-size}} to {{ic|1=dialog}}.<br />
<br />
== VLC ==<br />
<br />
The git vit version {{AUR|vlc-git}} on the AUR seems to solve some of the problems.<br />
<br />
== Other / Older applications ==<br />
<br />
One approach is to run the application full screen and without decoration in its own VNC desktop. Then scale the viewer. With Vncdesk ({{AUR|vncdesk-git}} from the [[AUR]]) you can set up a desktop per application, then start server and client with a simple command such as {{ic|vncdesk 2}}.<br />
<br />
[[x11vnc]] has an experimental option {{ic|-appshare}}, which opens one viewer per application window. Perhaps something could be hacked up with that.<br />
<br />
== GUI Toolkits ==<br />
<br />
=== Qt 5 ===<br />
<br />
Qt5 applications can often be run at higher dpi by setting the QT_DEVICE_PIXEL_RATIO environment variable. Note that the variable has to be set to a whole integer, so setting it to 1.5 will not work.<br />
<br />
This can for instance be enabled by creating a file {{ic|/etc/profile.d/qt-hidpi.sh}}<br />
<br />
export QT_DEVICE_PIXEL_RATIO=2<br />
<br />
And set the executable bit on it.<br />
<br />
=== GDK 3 (GTK+ 3) ===<br />
<br />
To scale UI elements by a factor of two:<br />
<br />
export GDK_SCALE=2<br />
<br />
To undo scaling of text:<br />
<br />
export GDK_DPI_SCALE=0.5<br />
<br />
== External displays ==<br />
The HiDPI setting is desktop-wide so that non-HiDPI external displays show everything too large. One workaround is to using [[xrandr]]'s scale option. To have a non-HiDPI monitor (on DP1) right of an internal HiDPI display (eDP1), one could run:<br />
<br />
xrandr --output eDP1 --auto --output DP1 --auto --scale 2x2 --right-of eDP1<br />
<br />
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].<br />
<br />
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).<br />
<br />
An example of the panning syntax for a 4k laptop with an external 1920x1080 monitor to the right:<br />
<br />
xrandr --output eDP1 --auto --output HDMI1 --auto --panning 3840x2160+3840+0 --scale 2x2 --right-of eDP1<br />
<br />
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:<br />
<br />
xrandr --output eDP1 --auto --output HDMI1 --auto --panning [C*E]x[D*F]+[A]+0 --scale [E]x[F] --right-of eDP1<br />
<br />
== Console ==<br />
<br />
The default console font will be very small on hidpi displays, the largest font is {{ic|sun12x22}}, to enable it (temporarily):<br />
<br />
$ setfont sun12x22<br />
<br />
See [[Fonts#Console_fonts]] for more.<br />
<br />
== See also ==<br />
<br />
* [http://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)<br />
* [[Font_configuration]]</div>SECuREhttps://wiki.archlinux.org/index.php?title=HiDPI&diff=368974HiDPI2015-04-08T06:49:29Z<p>SECuRE: /* Chromium / Google Chrome */</p>
<hr />
<div>[[Category:Graphics]]<br />
[[ja:HiDPI]]<br />
'''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 Apple products or high-end "ultrabooks", as well as in 4K (Ultra HD) or even 5K monitors.<br />
<br />
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.<br />
<br />
== Desktop environments ==<br />
<br />
=== GNOME ===<br />
<br />
To enable HiDPI, use gsettings:<br />
<br />
gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
=== KDE ===<br />
<br />
{{Out of date|Needs to be updated for KDE 5.}}<br />
KDE still has its share of HiDPI [https://community.kde.org/KDE/High-dpi_issues issues] but HiDPI support can be improved by changing the below settings:<br />
<br />
# Increase font dpi (System Settings → Application Appearance → Fonts → Force font dpi, enter a number such as 125, 144 or 150 etc)<br />
# Increase icon sizes (System Settings → Application Appearance → Icons → Advanced, here choose a higher icon size for all icons, eg. just increase each icon type by one step) <br />
<br />
=== Xfce ===<br />
<br />
Go to Settings Editor (you can find it in Settings Manager), and change the DPI parameter in {{ic|xsettings}} → {{ic|Xft}}. The value of 180 seems to work well on Retina screens.<br />
<br />
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.<br />
<br />
=== Cinnamon ===<br />
<br />
Supports HiDPI since 2.2. Even without rebuilding GTK3, the support is pretty good (e.g. window borders are correctly sized, which isn't the case under Xfce).<br />
<br />
=== Enlightenment ===<br />
<br />
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.<br />
<br />
== X Server ==<br />
<br />
Some programs use the physical width to detect the DPI. 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]).<br />
<br />
To verify that the X Server has properly detected the physical dimensions of your monitor, run:<br />
<br />
$ xdpyinfo | grep -B 2 resolution<br />
screen #0:<br />
dimensions: 3200x1800 pixels (423x238 millimeters)<br />
resolution: 192x192 dots per inch<br />
<br />
This examples uses inaccurate dimensions (423mm x 328mm, even though the Dell XPS 9530 has 346mm x 194mm) to have a clean multiple of 96 dpi, in this case 192 dpi. This tends to work better than using the correct DPI — Pango renders fonts crisper in i3 for example.<br />
<br />
If the DPI displayed by xdpyinfo is not correct, see [[Xorg#Display_size_and_DPI]] for how to fix it.<br />
<br />
== X Resources ==<br />
<br />
If you are not using a desktop environment such as GNOME, KDE, Xfce, or other that manipulates the X settings for you, you can set the desired Xft DPI setting manually in {{ic|~/.Xresources}}:<br />
<br />
{{hc|~/.Xresources|<nowiki><br />
Xft.dpi: 180<br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintfull<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
</nowiki>}}<br />
<br />
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).<br />
<br />
This will make the font render properly in most toolkits and applications, it will however not affect things such as icon size!<br />
<br />
== Browsers ==<br />
<br />
=== Firefox ===<br />
<br />
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).<br />
<br />
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.<br />
<br />
From Firefox version 38 onwards, your system (GTK+ 3.10) settings should be taken into account.[https://bugzilla.mozilla.org/show_bug.cgi?id=975919]<br />
<br />
=== Chromium / Google Chrome ===<br />
<br />
HiDPI support in Chromium is available through {{AUR|chromium-dev}} by setting {{ic|1=_use_hidpi=1}} in the [[PKGBUILD]]. [https://code.google.com/p/chromium/issues/detail?id=143619 HiDPI support] was only [https://chromium.googlesource.com/chromium/src.git/+/b19dc5bf24871e40e986f0f024946b1c281e77c4 recently added], so it will take some time to become available in {{Pkg|chromium}}. In the meantime try setting default page zoom level to 200% (although it is not the most elegant solution).<br />
<br />
Full HiDPI support in Chrome is available through {{AUR| google-chrome-dev}} as of version 43.0.2357.2-1 and works out of the box as tested with Gnome. Additionally, using older Chrome packages from AUR, and possibly chromium packages as well (not tested) the browser can be launched with the command line flag {{ic|--force-device-scale-factor}} and a scaling value. This will scale all content and ui, including tab and font size. For example:<br />
<br />
{{bc|1=google-chrome --force-device-scale-factor=2}}<br />
<br />
Using this option, a scaling factor of 1 would be normal scaling. Floating point values can be used.<br />
<br />
=== Opera ===<br />
<br />
Since version 24 one can alter Opera's DPI by starting it with the {{ic|1=--alt-high-dpi-setting=X}} command line option, where X is the desired DPI. For example, with {{ic|1=--alt-high-dpi-setting=144}} Opera will assume that DPI is 144. Newer versions of opera will auto detect the DPI using the font DPI setting (in KDE: the force font DPI setting.)<br />
<br />
Generally speaking, Opera's HiDPI support is excellent. Since it is also built using Chrome's blink renderer, and has an extension which runs most Chrome extensions, it's a very viable alternative to Chrome with much better HiDPI support.<br />
<br />
== Mail clients ==<br />
<br />
=== Thunderbird ===<br />
<br />
See [[HiDPI#Firefox|Firefox]]. To access {{ic|about:config}}, go to Edit → Preferences → Advanced → Config editor.<br />
<br />
== Skype ==<br />
<br />
Skype is a Qt program, and needs to be configured separately. You cannot change the DPI setting for it, but at least you can change font size. Install {{Pkg|qt4}} and run {{ic|qtconfig-qt4}} to do it.<br />
<br />
== IntelliJ IDEA ==<br />
<br />
If HiDPI support doesn't work, you have to add {{ic|1=-Dhidpi=true}} to your vmoptions file.[https://youtrack.jetbrains.com/issue/IDEA-114944]<br />
/usr/share/intellij-idea-ultimate-edition/bin/idea.vmoptions<br />
/usr/share/intellij-idea-ultimate-edition/bin/idea64.vmoptions<br />
<br />
== NetBeans ==<br />
<br />
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]<br />
<br />
The editor fontsize can be controlled from Tools → Option → Fonts & Colors.<br />
<br />
The output window fontsize can be controlled from Tools → Options → Miscelaneous → Output<br />
<br />
== GUI Toolkits ==<br />
<br />
=== Qt 5 ===<br />
<br />
Qt5 applications can often be run at higher dpi by setting the QT_DEVICE_PIXEL_RATIO environment variable. Note that the variable has to be set to a whole integer, so setting it to 1.5 won't work.<br />
<br />
This can for instance be enabled by creating a file {{ic|/etc/profile.d/qt-hidpi.sh}}<br />
<br />
export QT_DEVICE_PIXEL_RATIO=2<br />
<br />
And set the executable bit on it.<br />
<br />
== External displays ==<br />
The HiDPI setting is desktop-wide so that non-HiDPI external displays show everything too large. One workaround is to using [[xrandr]]'s scale option. To have a non-HiDPI monitor (on DP1) right of an internal HiDPI display (eDP1), one could run:<br />
<br />
xrandr --output eDP1 --auto --output DP1 --auto --scale 2x2 --right-of eDP1<br />
<br />
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].<br />
<br />
You may run into problems with your mouse not being able to reach the whole screen. That's 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).<br />
<br />
== Console ==<br />
<br />
The default console font will be very small on hidpi displays, the largest font is {{ic|sun12x22}}, to enable it (temporarily):<br />
<br />
$ setfont sun12x22<br />
<br />
See [[Fonts#Console_fonts]] for more.<br />
<br />
== See also ==<br />
<br />
* [http://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)<br />
* [[Font_configuration]]</div>SECuREhttps://wiki.archlinux.org/index.php?title=Talk:HiDPI&diff=366263Talk:HiDPI2015-03-20T09:09:03Z<p>SECuRE: </p>
<hr />
<div>Is there already a workaround for java-based apps? They look really ugly on hidpi :/<br />
<br />
I think it would be worthwhile to change section 5 from 'Skype' to 'Instant Messengers / Chat' and add others as well. Telegram Messenger supports HiDPI perfectly, it has an option for 200% scaling in the settings. It is also supported on almost every major platform.<br />
<br />
On the X server session, 182 isn’t a multiple of 96, which would rather be 192. So dimensions should be 508*286 to get that.<br />
: You’re right, that’s a typo. I can’t update it right now because I can’t lose my session, so feel free to go ahead. [[User:SECuRE|SECuRE]] ([[User talk:SECuRE|talk]]) 09:09, 20 March 2015 (UTC)</div>SECuREhttps://wiki.archlinux.org/index.php?title=HiDPI&diff=361240HiDPI2015-02-15T11:10:18Z<p>SECuRE: Add note about the X server’s detected resolution, important for chrome/i3</p>
<hr />
<div>[[Category:Graphics]]<br />
[[ja:HiDPI]]<br />
'''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 Apple products or high-end "ultrabooks", as well as in 4K (Ultra HD) or even 5K monitors.<br />
<br />
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.<br />
<br />
== Desktop environments ==<br />
<br />
=== GNOME ===<br />
<br />
To enable HiDPI, use gsettings:<br />
<br />
gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
=== KDE ===<br />
{{Out of date|Needs to be updated for KDE 5.}}<br />
KDE still has its share of HiDPI [https://community.kde.org/KDE/High-dpi_issues issues] but HiDPI support can be improved by changing the below settings:<br />
<br />
# Increase font dpi (System Settings → Application Appearance → Fonts → Force font dpi, enter a number such as 125, 144 or 150 etc)<br />
# Increase icon sizes (System Settings → Application Appearance → Icons → Advanced, here choose a higher icon size for all icons, eg. just increase each icon type by one step) <br />
<br />
=== Xfce ===<br />
<br />
Go to Settings Editor (you can find it in Settings Manager), and change the DPI parameter in {{ic|xsettings}} → {{ic|Xft}}. The value of 180 seems to work well on Retina screens.<br />
<br />
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.<br />
<br />
=== Cinnamon ===<br />
<br />
Supports HiDPI since 2.2. Even without rebuilding GTK3, the support is pretty good (e.g. window borders are correctly sized, which isn't the case under Xfce).<br />
<br />
=== Enlightenment ===<br />
<br />
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.<br />
<br />
== X Server ==<br />
<br />
Some programs use the physical width to detect the DPI. 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]).<br />
<br />
To verify that the X Server has properly detected the physical dimensions of your monitor, run:<br />
<br />
$ xdpyinfo | grep -B 2 resolution<br />
screen #0:<br />
dimensions: 3840x2160 pixels (536x301 millimeters)<br />
resolution: 182x182 dots per inch<br />
<br />
Note that in this example, I’ve chosen to use slightly inaccurate dimensions (536mm x 301mm, even though my Dell UP2414Q has 527mm x 296mm) so that I get a clean multiple of 96 dpi, in this case 182 dpi. This tends to work better than using the correct DPI — Pango renders fonts crisper in i3 for example.<br />
<br />
If the DPI displayed by xdpyinfo is not correct, see [[Xorg#Display_size_and_DPI]] for how to fix it.<br />
<br />
== X Resources ==<br />
<br />
If you are not using a desktop environment such as GNOME, KDE, Xfce, or other that manipulates the X settings for you, you can set the desired Xft DPI setting manually in {{ic|~/.Xresources}}:<br />
<br />
{{hc|~/.Xresources|<nowiki><br />
Xft.dpi: 180<br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintfull<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
</nowiki>}}<br />
<br />
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).<br />
<br />
This will make the font render properly in most toolkits and applications, it will however not affect things such as icon size!<br />
<br />
== Browsers ==<br />
<br />
=== Firefox ===<br />
<br />
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).<br />
<br />
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.<br />
<br />
From Firefox version 38 onwards, your system (GTK+ 3.10) settings should be taken into account.[https://bugzilla.mozilla.org/show_bug.cgi?id=975919]<br />
<br />
=== Chromium / Google Chrome ===<br />
<br />
No official support yet. Watch the [https://code.google.com/p/chromium/issues/detail?id=143619 bug report]. In the meantime try setting default page zoom level to 200% (although it is not the most elegant solution).<br />
<br />
For more adventurous users, Chromium can be recompiled using the {{ic|1=-Denable_hidpi=1}} flag to use experimental HiDPI scaling. Use the [[Arch Build System|ABS]] to download the {{Pkg|chromium}} package source, then edit the [[PKGBUILD]] file to add the flag. Note that this option will partially break context menus, but will optimize the interface and all webpages.<br />
<br />
Additionally, using current Chrome packages from AUR, and possibly chromium packages as well (not tested) the browser can be launched with the command line flag {{ic|--force-device-scale-factor}} and a scaling value. This will scale all content and ui, including tab and font size. For example:<br />
<br />
{{bc|1=google-chrome --force-device-scale-factor=2}}<br />
<br />
Using this option, a scaling factor of 1 would be normal scaling. Floating point values can be used. Note that this currently (as of chrome 39) breaks the UI somewhat in terms of menus and forms. A bug report has been filed for the [https://code.google.com/p/chromium/issues/detail?id=400837 issue].<br />
<br />
=== Opera ===<br />
<br />
Since version 24 one can alter Opera's DPI by starting it with the {{ic|1=--alt-high-dpi-setting=X}} command line option, where X is the desired DPI. For example, with {{ic|1=--alt-high-dpi-setting=144}} Opera will assume that DPI is 144. Newer versions of opera will auto detect the DPI using the font DPI setting (in KDE: the force font DPI setting.)<br />
<br />
Generally speaking, Opera's HiDPI support is excellent. Since it is also built using Chrome's blink renderer, and has an extension which runs most Chrome extensions, it's a very viable alternative to Chrome with much better HiDPI support.<br />
<br />
== Mail clients ==<br />
<br />
=== Thunderbird ===<br />
<br />
See [[HiDPI#Firefox|Firefox]]. To access {{ic|about:config}}, go to Edit → Preferences → Advanced → Config editor.<br />
<br />
== Skype ==<br />
<br />
Skype is a Qt program, and needs to be configured separately. You cannot change the DPI setting for it, but at least you can change font size. Install {{Pkg|qt4}} and run {{ic|qtconfig-qt4}} to do it.<br />
<br />
== GUI Toolkits ==<br />
<br />
=== Qt 5 ===<br />
<br />
Qt5 applications can often be run at higher dpi by setting the QT_DEVICE_PIXEL_RATIO environment variable. Note that the variable has to be set to a whole integer, so setting it to 1.5 won't work.<br />
<br />
This can for instance be enabled by creating a file {{ic|/etc/profile.d/qt-hidpi.sh}}<br />
<br />
export QT_DEVICE_PIXEL_RATIO=2<br />
<br />
And set the executable bit on it.<br />
<br />
== External displays ==<br />
The HiDPI setting is desktop-wide so that non-HiDPI external displays show everything too large. One workaround is to using [[xrandr]]'s scale option. To have a non-HiDPI monitor (on DP1) right of an internal HiDPI display (eDP1), one could run:<br />
<br />
xrandr --output eDP1 --auto --output DP1 --auto --scale 2x2 --right-of eDP1<br />
<br />
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].<br />
<br />
You may run into problems with your mouse not being able to reach the whole screen. That's 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).<br />
<br />
== Console ==<br />
<br />
The default console font will be very small on hidpi displays, the largest font is {{ic|sun12x22}}, to enable it (temporarily):<br />
<br />
$ setfont sun12x22<br />
<br />
See [[Fonts#Console_fonts]] for more.<br />
<br />
== See also ==<br />
<br />
* [http://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)<br />
* [[Font_configuration]]</div>SECuRE