https://wiki.archlinux.org/api.php?action=feedcontributions&user=Guygma&feedformat=atomArchWiki - User contributions [en]2024-03-28T18:18:37ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=XDG_user_directories&diff=576754XDG user directories2019-07-02T20:03:40Z<p>Guygma: Updated code snippet to user variable names consistent with what the configuration file expects.</p>
<hr />
<div>[[Category:Freedesktop.org]]<br />
[[ja:XDG ユーザーディレクトリ]]<br />
[[pt:XDG user directories]]<br />
[[ru:XDG user directories]]<br />
[[zh-hans:XDG user directories]]<br />
{{Related articles start}}<br />
{{Related|xdg-menu}}<br />
{{Related|Default applications}}<br />
{{Related|XDG Base Directory support}}<br />
{{Related articles end}}<br />
<br />
From [https://www.freedesktop.org/wiki/Software/xdg-user-dirs/ freedesktop.org]:<br />
:xdg-user-dirs is a tool to help manage "well known" user directories like the desktop folder and the music folder. It also handles localization (i.e. translation) of the filenames. <br />
<br />
:The way it works is that {{man|1|xdg-user-dirs-update}} is run very early in the login phase. This program reads a configuration file, and a set of default directories. It then creates localized versions of these directories in the users home directory and sets up a config file in {{ic|$XDG_CONFIG_HOME/user-dirs.dirs}} ({{ic|XDG_CONFIG_HOME}} defaults to {{ic|~/.config}}) that applications can read to find these directories.<br />
<br />
Most [[file manager]]s indicate XDG user directories with special icons.<br />
<br />
== Creating default directories ==<br />
<br />
Creating a full suite of localized default user directories within the {{ic|$HOME}} directory can be done automatically using {{pkg|xdg-user-dirs}} and running:<br />
<br />
$ xdg-user-dirs-update<br />
<br />
{{Tip|To force the creation of English-named directories, {{ic|1=LC_ALL=C xdg-user-dirs-update}} can be used.}}<br />
<br />
When executed, it will also automatically:<br />
<br />
* Create a local {{ic|~/.config/user-dirs.dirs}} configuration file: used by applications to find and use home directories specific to an account.<br />
* Create a local {{ic|~/.config/user-dirs.locale}} configuration file: used to set the language according to the locale in use.<br />
<br />
The user service {{ic|xdg-user-dirs-update.service}} will also be installed and enabled by default, in order to keep your directories up to date by running this command at the beginning of each login session.<br />
<br />
== Creating custom directories ==<br />
<br />
Both the local {{ic|~/.config/user-dirs.dirs}} and global {{ic|/etc/xdg/user-dirs.defaults}} configuration files use the following environmental variable format to point to user directories: {{ic|1=XDG_DIRNAME="directory_name"}}. The directories are relative to each user's {{ic|$HOME}} directory. An example configuration file will/may likely look like this (these are all the template directories):<br />
<br />
{{hc|1=~/.config/user-dirs.dirs|2= <br />
DESKTOP=".desktop"<br />
DOCUMENTS="documents"<br />
DOWNLOAD="downloads"<br />
MUSIC="media/music"<br />
PICTURES="media/pictures"<br />
PUBLICSHARE=".public"<br />
TEMPLATES=".templates"<br />
VIDEOS="media/videos"<br />
}}<br />
<br />
As {{pkg|xdg-user-dirs}} will source the local configuration file to point to the appropriate user directories, it is therefore possible to specify custom folders. For example, if a custom folder for the {{ic|XDG_DOWNLOAD_DIR}} variable has named {{ic|1=$HOME/Internet}} in {{ic|~/.config/user-dirs.dirs}} any application that uses this variable will use this directory.<br />
<br />
{{Note|Like with many configuration files, local settings override global settings. It will also be necessary to create any new custom directories.}}<br />
<br />
Alternatively, it is also possible to specify custom folders using the command line. For example, the following command will produce the same results as the above configuration file edit:<br />
<br />
$ xdg-user-dirs-update --set DOWNLOAD ~/Internet<br />
<br />
== Querying configured directories ==<br />
<br />
Once set, any user directory can be viewed with {{pkg|xdg-user-dirs}}. For example, the following command will show the location of the {{ic|Templates}} directory, which of course corresponds to the {{ic|XDG_TEMPLATES_DIR}} variable in the local configuration file:<br />
<br />
$ xdg-user-dir TEMPLATES</div>Guygmahttps://wiki.archlinux.org/index.php?title=UWSGI&diff=558959UWSGI2018-12-12T14:47:35Z<p>Guygma: /* Running uWSGI */ Short note to clarify expected directory structure and its relation to names of ini files below /etc/uwsgi</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Web server]]<br />
[[ja:UWSGI]]<br />
[https://uwsgi-docs.readthedocs.io/en/latest/ uWSGI] is a fast, self-healing and developer/sysadmin-friendly application container server coded in pure C.<br />
<br />
There are alternatives written in Python such as {{Pkg|gunicorn}}.<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|uwsgi}} package. Plugins need to be installed separately (their package names start with {{ic|uwsgi-plugin-}}).<br />
<br />
== Configuration ==<br />
<br />
[[Web applications]] served by uWSGI are configured in {{ic|/etc/uwsgi/}}, where each of them requires its own configuration file (ini-style). Details can be found [http://uwsgi-docs.readthedocs.org/en/latest/ in the uWSGI documentation].<br />
<br />
Alternatively, you can run uWSGI in [http://uwsgi-docs.readthedocs.org/en/latest/Emperor.html Emperor mode] (configured in {{ic|/etc/uwsgi/emperor.ini}}). It enables a single uWSGI instance to run a set of different apps (called vassals) using a single main supervisor (called emperor).<br />
<br />
{{Note|The plugins must be explicitly loaded before their options can be used, otherwise the options will not be recognized. This can be done with the {{ic|--plugins}} command-line option or with the {{ic|plugins}} variable in the config file.}}<br />
<br />
=== Web applications ===<br />
<br />
uWSGI supports many different languages and thus also many web applications.<br />
As an example the configuration file {{ic|/etc/uwsgi/example.ini}} and the prior installation of the plugin needed for your web application is assumed.<br />
<br />
==== Python ====<br />
<br />
The following is a simple example for a [[Python]] application.<br />
<br />
{{hc|/etc/uwsgi/example.ini|2=<br />
[uwsgi]<br />
chdir = /srv/http/example<br />
module = example<br />
plugins = python<br />
}}<br />
<br />
It is also possible to run uWSGI separately with the following syntax for instance:<br />
<br />
$ uwsgi --socket 127.0.0.1:3031 --plugin python2 --wsgi-file ~/foo.py --master --processes 4 --threads 2 --stats 127.0.0.1:9191 --uid --gid<br />
<br />
You should avoid running this command as root.<br />
<br />
{{Note|Pay attention to operational mode in use, preforking without --lazy-apps may cause non-obvious behavior. By default the Python plugin does not initialize the GIL. This means your app-generated threads will not run. If you need threads, remember to enable them with enable-threads. Running uWSGI in multithreading mode (with the threads options) will automatically enable threading support. This "strange" default behaviour is for performance reasons, no shame in that. [https://uwsgi-docs.readthedocs.io/en/latest/ThingsToKnow.html]}}<br />
<br />
==== PHP ====<br />
<br />
The following is a simple example for a [[PHP]] based website.<br />
<br />
{{hc|/etc/uwsgi/example.ini|2=<br />
[uwsgi]<br />
; maximum number of worker processes<br />
processes = 4<br />
; the user and group id of the process once it’s started<br />
uid = http<br />
gid = http<br />
socket = /run/uwsgi/%n.sock<br />
master = true<br />
chdir = /srv/http/%n<br />
; php<br />
plugins = php<br />
; jail our php environment<br />
php-docroot = /srv/http/%n<br />
php-index = index.php<br />
; clear environment on exit<br />
vacuum = true<br />
}}<br />
<br />
=== Web server ===<br />
<br />
uWSGI can be the backend to many web servers, that support the forwarding of access. The following are examples for configurations.<br />
<br />
{{Note|It is recommended to read through the uWSGI documentation to understand the configuration from both performance and security point of view.}}<br />
<br />
==== Nginx ====<br />
<br />
[[nginx]] can redirect access towards unix sockets or ports (on localhost or remote machine), depending on your web application.<br />
<br />
{{hc|/etc/nginx/example.conf|<nowiki><br />
# ...<br />
# forward all access to / towards <br />
location / {<br />
root /usr/share/nginx/html;<br />
index index.html index.htm;<br />
include uwsgi_params;<br />
# this is the correct uwsgi_modifier1 parameter for a php based application<br />
uwsgi_modifier1 14;<br />
# uncomment the following if you want to use the unix socket instead<br />
# uwsgi_pass unix:/var/run/uwsgi/example.sock;<br />
# access is redirected to localhost:3031<br />
uwsgi_pass 127.0.0.1:3031;<br />
}<br />
# ...<br />
</nowiki>}}<br />
<br />
{{Tip|Have a look at [https://uwsgi-docs.readthedocs.io/en/latest/Protocol.html#packet-descriptions the documentation] for the list of {{ic|uwsgi_modifier1}} parameters fitting to your web application.}}<br />
<br />
==== Nginx (in chroot) ====<br />
<br />
{{Note|This section assumes that you have deployed Nginx as described in [[Nginx#Installation in a chroot]]. It is assumed that the Nginx chroot is located in {{ic|/srv/http}}.}}<br />
<br />
First create ini file that will point to your application:<br />
<br />
{{hc|/etc/uwsgi/application1.ini|<nowiki><br />
[uwsgi]<br />
chroot = /srv/http<br />
chdir = /www/application1<br />
wsgi-file = application1.py<br />
plugins = python<br />
socket = /run/application1.sock<br />
uid = http<br />
gid = http<br />
threads = 2<br />
stats = 127.0.0.1:9191<br />
vacuum = true<br />
</nowiki>}}<br />
<br />
Since we are chrooting to {{ic|/srv/http}} above configuration will result in following unix socket being created {{ic|/srv/http/run/application1.sock}}<br />
<br />
{{Note|<br />
* Your application must be placed within {{ic|/srv/http/www/application1}} before service is started. Depending on configuration your application may be cached so you may need to restart the service when you modify it.<br />
* If you are deploying python application you may need to copy standard python libraries - if you develop under python 3 then you can copy them from {{ic|/usr/lib/python3.6}} to {{ic|/srv/http/lib/python3.6}}.<br />
You can try to run following:<br />
# cp -r -p /usr/lib/python3.6 /srv/http/lib<br />
# cp -r -p /usr/lib/*python*so /srv/http/lib<br />
}}<br />
<br />
You will need to disable notifications within your service file:<br />
<br />
{{hc|/etc/systemd/system/multi-user.target.wants/uwsgi\@application1.service|<nowiki><br />
[Unit]<br />
Description=uWSGI service unit<br />
After=syslog.target<br />
<br />
[Service]<br />
PIDFile=/run/%I.pid<br />
RemainAfterExit=yes<br />
ExecStart=/usr/bin/uwsgi --ini /etc/uwsgi/%I.ini<br />
ExecReload=/bin/kill -HUP $MAINPID<br />
ExecStop=/bin/kill -INT $MAINPID<br />
Restart=always<br />
StandardError=syslog<br />
KillSignal=SIGQUIT<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{Note|PID file will be created within {{ic|/run}} rather than {{ic|/srv/http/run}}}}<br />
<br />
After modification make sure to [[reload]] to incorporate the new or changed units.<br />
<br />
You are then free to [[enable]] and [[start]] {{ic|uwsgi@application1.service}}. <br />
<br />
Edit {{ic|/srv/http/etc/nginx/nginx.conf}} and add new {{ic|server}} section within it that would contain at least following:<br />
{{hc|/srv/http/etc/nginx/nginx.conf|<nowiki><br />
...<br />
server<br />
{<br />
listen 80;<br />
server_name 127.0.0.1;<br />
location /<br />
{<br />
root /www/application1;<br />
include uwsgi_params;<br />
uwsgi_pass unix:/run/application1.sock;<br />
}<br />
<br />
error_page 500 502 503 504 /50x.html;<br />
location = /50x.html<br />
{<br />
root /usr/share/nginx/html;<br />
}<br />
}<br />
...<br />
</nowiki>}}<br />
<br />
Make sure to now [[restart]] {{ic|nginx.service}} to have your {{ic|application1}} be served at {{ic|127.0.0.1}}.<br />
<br />
== Running uWSGI ==<br />
<br />
{{Note|This assumes the used web application has been properly configured, is being served by your web server, which redirects towards the socket or port it is using and was configured in {{ic|/etc/uwsgi/}}.}}<br />
<br />
If you plan on using a web application all the time (without it being activated on demand), you can simply [[start]] and [[enable]] {{ic|uwsgi@example}}.<br />
<br />
{{Note|For an ini file at {{ic|/etc/uwsgi/examples/ex1.ini}}, the service of interest would be {{ic|uwsgi@example-ex1.service}}. For services with dashes in the name, failure to respect this directory structure may lead to an error citing {{ic|File not found}}.}}<br />
<br />
If you plan on having your web application be started on demand you can [[start]] and [[enable]] {{ic|uwsgi@example.socket}}.<br />
<br />
To use the Emperor mode, [[start]] and [[enable]] {{ic|emperor.uwsgi.service}}.<br />
<br />
To use socket activation of this mode [[start]] and [[enable]] {{ic|emperor.uwsgi.socket}}.<br />
<br />
== Tips and tricks ==<br />
<br />
Some functionality, that uWSGI offers is not accessible by using the [[systemd]] service files provided in the [[official repositories]].<br />
Changes to them are explained in the following sections. For further information see [https://sleepmap.de/2016/securely-serving-webapps-using-uwsgi/].<br />
<br />
=== Socket activation ===<br />
<br />
Using socket activation, you want to<br />
* direct your web server to a unix socket and thereby start your uWSGI instance running the application<br />
* you most likely want to have the application be closed by uWSGI after a certain idle time<br />
* you want your web server be able to start the application again, once it is accessed<br />
<br />
uWSGI offers settings, with which you can have the instance close the application:<br />
<br />
{{hc|/etc/uwsgi/example.ini|<nowiki><br />
[uwsgi]<br />
# ...<br />
<br />
# set idle time in seconds<br />
idle = 600<br />
# kill the application after idle time was reached<br />
kill-on-idle = true<br />
<br />
# ...<br />
</nowiki>}}<br />
<br />
The current {{ic|uwsgi@.service}} file however does not allow this, because [[systemd]] treats non-zero exit codes as failure and thereby marking the unit as failed and additionally the {{ic|1=Restart=always}} directive makes a closing after idle time useless.<br />
A fix for this is to add the exit codes, that uWSGI may provide after closing an application by itself to a list, that [[systemd]] will treat as success by using the {{ic|SuccessExitStatus}} directive (for further information see [https://sleepmap.de/2016/securely-serving-webapps-using-uwsgi/]).<br />
<br />
{{hc|/etc/systemd/system/uwsgi-socket@.service|<nowiki><br />
[Unit]<br />
Description=uWSGI service unit<br />
After=syslog.target<br />
<br />
[Service]<br />
ExecStart=/usr/bin/uwsgi --ini /etc/uwsgi/%I.ini<br />
ExecReload=/bin/kill -HUP $MAINPID<br />
ExecStop=/bin/kill -INT $MAINPID<br />
Type=notify<br />
SuccessExitStatus=15 17 29 30<br />
StandardError=syslog<br />
NotifyAccess=all<br />
KillSignal=SIGQUIT<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
This will allow for proper socket activation with kill-after-idle functionality.<br />
<br />
=== Hardening uWSGI ===<br />
<br />
Web applications are exposed to the wild and depending on their quality and the security of their underlying languages, some are more dangerous to run, than others.<br />
A good way to start dealing with possible unsafe web applications is to jail them. [[systemd]] has some functionality, that can be put to use.<br />
Have a look at the following example (and for further information see {{man|5|systemd.exec}} and [https://sleepmap.de/2016/securely-serving-webapps-using-uwsgi/]):<br />
<br />
{{hc|/etc/systemd/system/uwsgi-secure@.service|<nowiki><br />
[Unit]<br />
Description=uWSGI service unit<br />
After=syslog.target<br />
<br />
[Service]<br />
ExecStart=/usr/bin/uwsgi --ini /etc/uwsgi/%I.ini<br />
ExecReload=/bin/kill -HUP $MAINPID<br />
ExecStop=/bin/kill -INT $MAINPID<br />
Type=notify<br />
SuccessExitStatus=15 17 29 30<br />
StandardError=syslog<br />
NotifyAccess=all<br />
KillSignal=SIGQUIT<br />
PrivateDevices=yes<br />
PrivateTmp=yes<br />
ProtectSystem=full<br />
ReadWriteDirectories=/etc/webapps /var/lib/<br />
ProtectHome=yes<br />
NoNewPrivileges=yes<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{Note|<br />
* Using {{ic|1=NoNewPrivileges=yes}} does not work with [[Mailman]]'s cgi frontend! Remove this setting, if you want to use it in conjunction with it.<br />
* If you want to harden your uWSGI app further, the use of namespaces is advisable. You can get a first glance on that topic in the [http://uwsgi-docs.readthedocs.io/en/latest/Namespaces.html uWSGI namespaces documentation].<br />
}}<br />
<br />
== See also ==<br />
<br />
* [http://uwsgi-docs.readthedocs.org/en/latest Official Documentation]<br />
* [https://github.com/unbit/uwsgi-docs uWSGI Github]<br />
* [https://sleepmap.de/2016/securely-serving-webapps-using-uwsgi/ Securely serving webapps using uWSGI]<br />
* [http://blog.kgriffs.com/ Fluffy White Stuff Benchmark]<br />
* [http://flask.pocoo.org/docs/deploying/uwsgi/ Flask uWSGI deploying]<br />
* [https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/uwsgi/ Django and uWSGI]<br />
* [http://uwsgi-docs.readthedocs.org/en/latest/Apache.html Apache and uWSGI]</div>Guygmahttps://wiki.archlinux.org/index.php?title=Kernel&diff=558373Kernel2018-12-05T14:32:35Z<p>Guygma: /* Other patchsets */ Removed out of place reference to ReiserFS</p>
<hr />
<div>[[Category:Kernel]]<br />
[[Category:Lists of software]]<br />
[[cs:Kernel Compilation]]<br />
[[es:Kernel]]<br />
[[fr:Noyaux Linux]]<br />
[[it:Kernels]]<br />
[[ja:カーネル]]<br />
[[ru:Kernel]]<br />
[[zh-hans:Kernels]]<br />
{{Related articles start}}<br />
{{Related|Kernel modules}}<br />
{{Related|Compile kernel module}}<br />
{{Related|Kernel Panics}}<br />
{{Related|sysctl}}<br />
{{Related articles end}}<br />
<br />
According to [[Wikipedia:Linux kernel|Wikipedia]]:<br />
:The '''Linux kernel''' is an open-source monolithic Unix-like computer [[Wikipedia:Kernel (operating system)|operating system kernel]].<br />
<br />
[[Arch Linux]] is based on the Linux kernel. There are various alternative Linux kernels available for Arch Linux in addition to the stable [[Wikipedia:Linux kernel|Linux kernel]]. This article lists some of the options available in the repositories with a brief description of each. There is also a description of patches that can be applied to the system's kernel. The article ends with an overview of custom kernel compilation with links to various methods.<br />
<br />
== Officially supported kernels ==<br />
<br />
* {{App|Stable|Vanilla Linux kernel and modules, with a few patches applied.|https://www.kernel.org/|{{Pkg|linux}}}}<br />
* {{App|Hardened|A security-focused Linux kernel applying a set of hardening patches to mitigate kernel and userspace exploits. It also enables more upstream kernel hardening features than {{Pkg|linux}} along [[AppArmor]] and [[SELinux]].|https://github.com/anthraxx/linux-hardened|{{Pkg|linux-hardened}}}}<br />
* {{App|Longterm|Long-term support (LTS) Linux kernel and modules.|https://www.kernel.org/|{{Pkg|linux-lts}}}}<br />
* {{App|ZEN Kernel|Result of a collaborative effort of kernel hackers to provide the best Linux kernel possible for everyday systems. Some more details can be found on https://liquorix.net (which provides kernel binaries based on ZEN for Debian).|https://github.com/zen-kernel/zen-kernel|{{Pkg|linux-zen}}}}<br />
<br />
== Compilation ==<br />
<br />
Arch Linux provides two methods of kernel compilation.<br />
<br />
; [[/Arch Build System]]: Takes advantage of the high quality of existing {{Pkg|linux}} [[PKGBUILD]] and the benefits of [[Wikipedia:Package management system|package management]].<br />
; [[/Traditional compilation]]: Involves manually downloading a source tarball, and compiling in your home directory as a normal user.<br />
<br />
== kernel.org kernels ==<br />
<br />
* {{App|Git|Linux kernel and modules built using sources from Linus Torvalds' Git repository|https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git|{{AUR|linux-git}}}}<br />
* {{App|Mainline|Kernels where all new features are introduced, released every 2-3 months.|https://www.kernel.org/|{{AUR|linux-mainline}}}}<br />
* {{App|Next|Bleeding edge kernels with features pending to be merged into next mainline release.|https://www.kernel.org/doc/man-pages/linux-next.html|{{AUR|linux-next-git}}}}<br />
* {{App|Longterm 3.16|Long-term support (LTS) Linux 3.16 kernel and modules.|https://www.kernel.org/|{{AUR|linux-lts316}}}}<br />
* {{App|Longterm 4.4|Long-term support (LTS) Linux 4.4 kernel and modules.|https://www.kernel.org/|{{AUR|linux-lts44}}}}<br />
* {{App|Longterm 4.9|Long-term support (LTS) Linux 4.9 kernel and modules.|https://www.kernel.org/|{{AUR|linux-lts49}}}}<br />
<br />
== Patches and patchsets ==<br />
<br />
There are lots of reasons to patch your kernel, the major ones are for performance or support for non-mainline features such as [[reiser4]] file system support. Other reasons might include fun and to see how it is done and what the improvements are.<br />
<br />
However, it is important to note that the best way to increase the speed of your system is to first tailor your kernel to your system, especially the architecture and processor type. For this reason using pre-packaged versions of custom kernels with generic architecture settings is not recommended or really worth it. A further benefit is that you can reduce the size of your kernel (and therefore build time) by not including support for things you do not have or use. For example, you might start with the stock kernel config when a new kernel version is released and remove support for things like bluetooth, video4linux, 1000Mbit ethernet, etc.; functionality you know you will not require for your specific machine. Although this page is not about customizing your kernel config, it is recommended as a first step--before moving on to using a patchset once you have grasped the fundamentals involved.<br />
<br />
The config files for the Arch kernel packages can be used as a starting point. They are in the Arch package source files, for example [https://projects.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/linux] linked from {{Pkg|linux}}. The config file of your currently running kernel may also be available in your file system at {{ic|/proc/config.gz}} if the {{ic|CONFIG_IKCONFIG_PROC}} kernel option is enabled.<br />
<br />
If you have not actually patched or customized a kernel before it is not that hard and there are many PKGBUILDs on the forum for individual patchsets. However, you are advised to start from scratch with a bit of research on the benefits of each patchset, rather than just arbitrarily picking one. This way you will learn much more about what you are doing rather than just choosing a kernel at startup and then be left wondering what it actually does.<br />
<br />
{{Warning|Patchsets are developed by a variety of people. Some of these people are actually involved in the production of the linux kernel and others are hobbyists, which may reflect its level of reliability and stability.}}<br />
<br />
=== Major patchsets ===<br />
<br />
* {{App|[[Linux-ck]]|Contains patches by Con Kolivas designed to improve system responsiveness with specific emphasis on the desktop, but suitable to any workload.|http://ck.kolivas.org/|{{AUR|linux-ck}}}}<br />
* {{App|pf-kernel|Provides you with a handful of awesome features not merged into mainline. It is based on neither existing Linux fork nor patchset, although some unofficial ports may be used if required patches have not been released officially. The most prominent patches of linux-pf are PDS CPU scheduler and UKSM.|https://gitlab.com/post-factum/pf-kernel/wikis/README|Packages:}}<br />
:* [[Unofficial_user_repositories#post-factum_kernels|Repository]] by pf-kernel developer, [https://aur.archlinux.org/account/post-factum post-factum]<br />
:* [[Unofficial_user_repositories#home-thaodan|Repository]], {{AUR|linux-pf}}, {{AUR|linux-pf-preset-default}}, {{AUR|linux-pf-lts}} by pf-kernel fork developer, [https://aur.archlinux.org/account/Thaodan Thaodan]<br />
* {{App|[[Realtime kernel]]|Maintained by a small group of core developers, led by Ingo Molnar. This patch allows nearly all of the kernel to be preempted, with the exception of a few very small regions of code ("raw_spinlock critical regions"). This is done by replacing most kernel spinlocks with mutexes that support priority inheritance, as well as moving all interrupt and software interrupts to kernel threads.|https://wiki.linuxfoundation.org/realtime/start|{{AUR|linux-rt}}, {{AUR|linux-rt-lts}}}}<br />
<br />
=== Other patchsets ===<br />
<br />
Some of the listed packages may also be available as binary packages via [[Unofficial user repositories]].<br />
<br />
* {{App|[[AppArmor]]|The [[Wikipedia:Mandatory_access_control|Mandatory Access Control]] (MAC) system, implemented upon the [[Wikipedia:Linux_Security_Modules|Linux Security Modules]] (LSM). While {{Pkg|linux}} supports apparmor this kernel has the required [[kernel parameters]] enabled by default. |https://gitlab.com/apparmor/apparmor/wikis/About|{{AUR|linux-apparmor}}}}<br />
* {{App|Aufs|The aufs-compatible linux kernel and modules, useful when using [[docker]].|http://aufs.sourceforge.net/|}}<br />
* {{App|BLD|Provides alternate CPU load distribution technique for task scheduler.|https://github.com/rmullick/bld-patches/wiki|{{AUR|linux-bld}}}}<br />
* {{App|Clear|Patches from Intel's Clear Linux project. Provides performance and security optimizations; [[WireGuard]] module. |https://github.com/clearlinux-pkgs/linux|{{AUR|linux-clear}}}}<br />
* {{App|Libre|The Linux Kernels without "binary blobs".|https://www.fsfla.org/ikiwiki/selibre/linux-libre/|{{AUR|linux-libre}}}}<br />
* {{App|Liquorix|Kernel replacement built using Debian-targeted configuration and the ZEN kernel sources. Designed for desktop, multimedia, and gaming workloads, it is often used as a Debian Linux performance replacement kernel. Damentz, the maintainer of the Liquorix patchset, is a developer for the ZEN patchset as well.|https://liquorix.net|{{AUR|linux-lqx}}}}<br />
* {{App|MultiPath TCP|The Linux Kernel and modules with Multipath TCP support.|https://multipath-tcp.org/|{{AUR|linux-mptcp}}}}<br />
* {{App|VFIO|The Linux kernel and a few patches written by Alex Williamson (acs override and i915) to enable the ability to do PCI Passthrough with KVM on some machines.|https://lwn.net/Articles/499240/|{{AUR|linux-vfio}}, {{AUR|linux-vfio-lts}}}}<br />
<br />
== See also ==<br />
<br />
* [http://www.kroah.com/lkn/ O'Reilly - Linux Kernel in a Nutshell] (free ebook)<br />
* [http://kroah.com/log/blog/2018/08/24/what-stable-kernel-should-i-use/ What stable kernel should I use?] by Greg Kroah-Hartman</div>Guygmahttps://wiki.archlinux.org/index.php?title=HiDPI&diff=558154HiDPI2018-12-02T16:57:42Z<p>Guygma: /* Firefox */ There was no mention of Firefox respecting the Xresource file, which is arguably the simplest solution and yields consistent results.</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, Settings > Devices > Displays,or use gsettings:<br />
<br />
$ gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
{{Note|1={{ic|scaling-factor}} only allows whole numbers to be set. 1 = 100%, 2 = 200%, etc...}}<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). <br />
<br />
*wayland<br />
Enable fractional Scaling experimental-feature:<br />
<br />
$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"<br />
<br />
then open Settings > Devices > Displays<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 />
$ 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 />
=== KDE ===<br />
<br />
You can use KDE'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 />
<br />
When you use not integer values for Display Scale it causes font render issue in some QT application ( ex. okular ).<br />
<br />
A workaround for this is to:<br />
# Set the scale value to 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 KDE<br />
# If required tune the GTK apps using the variables GDK_SCALE/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 />
Go to Settings Manager → Appearance → Fonts, and change the DPI parameter. The value of 180 or 192 seems to work well on Retina screens. To get a more precise number, you can use {{ic|<nowiki>xdpyinfo | grep resolution</nowiki>}}, and then double it.<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 />
Xfwm comes with two hidpi themes: Default-hdpi and Default-xhdpi. You can set them under Settings Manager → Window Manager → Style → Theme.<br />
<br />
You can set the default icon sizes of gtk2 menus, buttons and so on under Settings Manager → Settings Editor → xsettings → Gtk → IconSizes, with a line like this: {{ic|<nowiki>gtk-large-toolbar=96,96:gtk-small-toolbar=64,64:gtk-menu=64,64:gtk-dialog=96,96:gtk-button=64,64:gtk-dnd=64,64</nowiki>}}. "gtk-dnd" is for the icons during drag'n'drop, the others are quite self-explanatory. You can use any value your icon theme supports.<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 Server ==<br />
<br />
Some programs use the DPI given by the X server. Examples are i3 ([https://github.com/i3/i3/blob/next/libi3/dpi.c source]) and Chromium ([https://code.google.com/p/chromium/codesearch#chromium/src/ui/views/widget/desktop_aura/desktop_screen_x11.cc source]).<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 />
$ xdpyinfo | grep -B 2 resolution<br />
screen #0:<br />
dimensions: 3200x1800 pixels (423x238 millimeters)<br />
resolution: 192x192 dots per inch<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 />
== 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|<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 />
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 />
== 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].<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 />
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 />
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 />
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 />
== Applications ==<br />
<br />
=== Browsers ===<br />
<br />
==== Firefox ====<br />
<br />
Firefox should use the [[#GDK 3 (GTK+ 3)]] settings. However, the suggested {{ic|GDK_SCALE}} suggestion doesn't consistently scale the entirety of Firefox, and doesn't work for fractional values (e.g., a factor of 158DPI/96DPI = 1.65 for a 1080p 14" laptop). You may want to use {{ic|GDK_DPI_SCALE}} instead. Another option, which will avoid Firefox-specific settings in many setups is to use the settings in [[#Xresources]] 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 doesn't consistently scale the entirety of Firefox. If Firefox is not scaling fonts, you may want to create {{ic|userChrome.css}} and add appropriate styles to it. More information about {{ic|userChrome.css}} at [http://kb.mozillazine.org/index.php?title=UserChrome.css mozillaZine].<br />
<br />
{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|@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 following 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.<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=--force-device-scale-factor=2}}<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 />
=== Thunderbird ===<br />
<br />
See [[#Firefox]]. To access {{ic|about:config}}, go to Edit → Preferences → Advanced → Config editor.<br />
<br />
=== Wine applications ===<br />
<br />
Run<br />
$ winecfg<br />
and change the "dpi" setting found in the "Graphics" tab. This only affects the font size.<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|<nowiki><br />
Exec=env LD_PRELOAD=/usr/lib/libcurl.so.3 /usr/bin/slack --force-device-scale-factor=1.5 %U<br />
</nowiki>}}<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}}:<br />
<br />
{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|<nowiki><br />
app.browser.zoom-level=100<br />
</nowiki>}}<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 />
$ spotify --force-device-scale-factor=1.5<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 />
=== Sublime Text 3 ===<br />
Sublime Text 3 has full support for display scaling. Go to Preferences > Settings > User Settings and add {{ic|"dpi_scale": 2.0}} to your settings [http://blog.wxm.be/2014/08/30/sublime-text-3-and-high-dpi-on-linux.html (source)].<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 />
=== 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 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 />
=== Steam ===<br />
<br />
==== Official HiDPI support ====<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 />
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 />
=== Java applications ===<br />
<br />
Java applications using the AWT/Swing framework can be scaled by defining the sun.java2d.uiScale variable when invoking java. For example,<br />
<br />
java -Dsun.java2d.uiScale=2 -jar some_application.jar<br />
<br />
Since Java 9 the GDK_SCALE environment variable is used to scale Swing applications accordingly.<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)|GTK3]] applications.<br />
<br />
=== MATLAB ===<br />
<br />
Recent versions (R2017b) of [[MATLAB]] allow to set the scale factor:<br />
>> s = settings;s.matlab.desktop.DisplayScaleFactor<br />
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2<br />
The settings take effect after MATLAB is restarted.<br />
<br />
=== VirtualBox ===<br />
<br />
{{Note|This only applies to KDE with scaling enabled.}}<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 />
$ QT_SCALE_FACTOR=0.5 VirtualBox --startvm vm-name<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 />
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 />
=== Multiple external monitors ===<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 />
<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.<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 />
== 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]</div>Guygma