https://wiki.archlinux.org/api.php?action=feedcontributions&user=A5dblk&feedformat=atomArchWiki - User contributions [en]2024-03-29T15:41:53ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=HiDPI&diff=761734HiDPI2022-12-21T07:12:06Z<p>A5dblk: /* LibreOffice */ Link to more information about setting backend</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 />
=== 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 {{ic|1=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 />
=== 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 />
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 />
{{Accuracy|Installation from archive other than the source of the {{Pkg|obs-studio}} package is not supported.}}<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 choose Yami.<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 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 />
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 />
The [[w:Linux console|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]) accordingly based on the resolution of the display and not its pixel density. 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 terminal. Which in many cases 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>A5dblkhttps://wiki.archlinux.org/index.php?title=User:A5dblk&diff=570028User:A5dblk2019-03-29T11:42:13Z<p>A5dblk: Created blank page</p>
<hr />
<div></div>A5dblkhttps://wiki.archlinux.org/index.php?title=PRoot_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=570027PRoot (简体中文)2019-03-29T11:41:50Z<p>A5dblk: 修改了翻译细节及翻译了安全性段落。</p>
<hr />
<div>[[Category:Security (简体中文)]]<br />
[[en:PRoot]]<br />
[[ja:PRoot]]<br />
[[pt:PRoot]]<br />
{{TranslationStatus (简体中文)|PRoot|2019-01-31|560586}}<br />
[https://proot-me.github.io PRoot]是一个能在用户空间内运行的程序, 功能类似于[[chroot]], {{ic|mount --bind}}和 binfmt_misc , 能让root用户使用备用根目录运行程序, 就像chroot "jail"一样。 PRoot在由于缺少root权限而无法使用chroot的情况下尤其有用。<br />
<br />
== 安装 ==<br />
PRoot可以从{{AUR|proot}}包安装。 ''pacstrap''可以在运行''proot''之前用Arch环境初始化目录。<br />
<br />
== 用法 ==<br />
安装完成之后, PRoot不需要root权限。 和chroot一样, 你必须为PRoot提供一个新目录作为新的根目录。 如果没有指定shell程序,PRoot默认将启动{{ic|/bin/sh}}。 虚拟文件系统无需手动挂载,PRoot会自动处理这个问题。<br />
proot -r ~/mychroot/<br />
此时,将启动一个shell, {{ic|/}} 对应于主机上的 {{ic|~/chroot/}} 文件夹。<br />
<br />
可以使用 {{ic|-b}} 选项明确地绑定变量:<br />
proot -b /bin/bash:/bin/sh<br />
这使得主机的/bin/bash在来宾的/bin/sh处可用<br />
<br />
PRoot在内部使用qemu用户模式模拟器来允许程序在PRoot内运行,即使程序是为主机系统以外的体系结构编译的。<br />
<br />
== 安全性 ==<br />
{{Expansion|Compare security of chroot and PRoot: Are /proc, /sys, and /dev accessible inside a PRoot? Is privilege escalation possible?}}<br />
与chroot一样,PRoot仅提供文件系统级隔离。 PRoot "jail" 中的程序共享相同的内核,硬件,进程空间和网络子系统。 chroot和PRoot并不是如同虚拟机管理程序或半虚拟化程序的,真正的虚拟化程序替代品。</div>A5dblkhttps://wiki.archlinux.org/index.php?title=PRoot_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=560587PRoot (简体中文)2018-12-27T16:04:54Z<p>A5dblk: Created page with "Category:Security ja:PRoot pt:PRoot zh-hans:PRoot [https://proot-me.github.io PRoot]是一个能在用户空间内运行的程序, 功能类似于chroot, {..."</p>
<hr />
<div>[[Category:Security]]<br />
[[ja:PRoot]]<br />
[[pt:PRoot]]<br />
[[zh-hans:PRoot]]<br />
[https://proot-me.github.io PRoot]是一个能在用户空间内运行的程序, 功能类似于[[chroot]], {{ic|mount --bind}}和 binfmt_misc , 能让root用户使用备用根目录运行程序, 就像chroot "jail"一样。 PRoot在由于缺少root权限而无法使用chroot的情况下尤其有用。<br />
<br />
== 安装 ==<br />
PRoot可以从{{AUR|proot}}包安装。 ''pacstrap''可以在运行''proot''之前用Arch环境初始化目录。<br />
<br />
== 用法 ==<br />
安装完成之后, PRoot不需要root权限。 和chroot一样, 你必须为PRoot提供一个新目录作为新的根目录。 If a program is not specified, PRoot will launch {{ic|/bin/sh}} by default. Virtual filesystems do not need to be manually mounted, as PRoot handles this automatically.<br />
proot -r ~/mychroot/<br />
At this point a shell will start, with {{ic|/}} corresponding to the {{ic|~/chroot/}} directory on the host system.<br />
<br />
Paths may be explicitly bound using the {{ic|-b}} option:<br />
proot -b /bin/bash:/bin/sh<br />
This makes the host's /bin/bash available at the guest's /bin/sh<br />
<br />
PRoot internally utilizes the qemu user-mode emulator to allow programs to be run inside the PRoot even when they are compiled for an architecture other than the host system's.<br />
<br />
== Security ==<br />
{{Expansion|Compare security of chroot and PRoot: Are /proc, /sys, and /dev accessible inside a PRoot? Is privilege escalation possible?}}<br />
Like chroot, PRoot provides only filesystem level isolation. Programs inside the PRoot "jail" share the same kernel, hardware, process space, and networking subsystem. chroot and PRoot are not designed to be substitutes for real [[virtualization]] applications, such as hypervisors and paravirtualizers.</div>A5dblkhttps://wiki.archlinux.org/index.php?title=PRoot&diff=560586PRoot2018-12-27T15:02:48Z<p>A5dblk: </p>
<hr />
<div>[[Category:Security]]<br />
[[ja:PRoot]]<br />
[[pt:PRoot]]<br />
[[zh-hans:PRoot]]<br />
[https://proot-me.github.io PRoot] is program that implements functionality similar to GNU/Linux's [[chroot]], {{ic|mount --bind}}, and binfmt_misc in user-space, allowing an unprivileged user to execute programs with an alternative root directory, much like a chroot "jail". This is useful in cases where a chroot is not possible due to a lack of root privileges.<br />
<br />
== Installation ==<br />
PRoot can be installed from the {{AUR|proot}} package. ''pacstrap'' can be used to initialize the directory with an Arch environment before running ''proot''.<br />
<br />
== Usage ==<br />
After installation, PRoot does not require root privileges. As with chroot, PRoot must be given a directory to act as the new root directory for the program to be run. If a program is not specified, PRoot will launch {{ic|/bin/sh}} by default. Virtual filesystems do not need to be manually mounted, as PRoot handles this automatically.<br />
proot -r ~/mychroot/<br />
At this point a shell will start, with {{ic|/}} corresponding to the {{ic|~/chroot/}} directory on the host system.<br />
<br />
Paths may be explicitly bound using the {{ic|-b}} option:<br />
proot -b /bin/bash:/bin/sh<br />
This makes the host's /bin/bash available at the guest's /bin/sh<br />
<br />
PRoot internally utilizes the qemu user-mode emulator to allow programs to be run inside the PRoot even when they are compiled for an architecture other than the host system's.<br />
<br />
== Security ==<br />
{{Expansion|Compare security of chroot and PRoot: Are /proc, /sys, and /dev accessible inside a PRoot? Is privilege escalation possible?}}<br />
Like chroot, PRoot provides only filesystem level isolation. Programs inside the PRoot "jail" share the same kernel, hardware, process space, and networking subsystem. chroot and PRoot are not designed to be substitutes for real [[virtualization]] applications, such as hypervisors and paravirtualizers.</div>A5dblk