Setting environment variables for window manager on HiDPI with GDM, wayland and company.
Because setting an environment variable via a shell init file doesn’t seem to be en vouge in modern linux distributions we need to find other ways. To spare you breaking precious hardware in the process here is the solution:
You can define “.conf” files within the directory
~/.config/environment.d/ that may contain one variable definition per line and out of these the startup environment for your window manager will be constructed.
To find out more just issue the
man environment.d command in your terminal and read through the documentation.
A simple use case is for example setting the
QT_SCALE_FACTOR variable to have QT based applications scale on HiDPI displays. You could create a file
~/.config/environment.d/50-qt-hidpi.conf with the following content: