Some applications do not properly handle fractional scaling after xrandr
, in my case I'm using Mate environment
$ cat /etc/X11/Xsession.d/45xrandr-custom
if [ "x$DESKTOP_SESSION" = "xmate" ] || [ "x$XDG_SESSION_DESKTOP" = "xmate" ]; then
/usr/bin/xrandr --output eDP-1 --scale 1.5x1.5 --brightness 0.7 --mode 1920x1080
fi
Down below I`ve tried to summarize available options how I dealt with such applications
$ cat /etc/environment | tail -n 1
JAVA_TOOL_OPTIONS="-Dsun.java2d.uiScale=2" # can be an integer or percentage
$ cat /etc/environment | tail -n 1
JAVA_TOOL_OPTIONS="-Dglass.gtk.uiScale=2.0" # can be a fractual value or percentage
$ gsettings get org.gnome.desktop.interface text-scaling-factor
1.0
$ gsettings get org.gnome.desktop.interface scaling-factor
uint32 0
$ gsettings get org.mate.interface window-scaling-factor
2
$ gsettings get org.mate.interface window-scaling-factor-qt-sync # this affects QT_SCALE_FACTOR, actual value taken from the previous parameter
true
$ echo $QT_SCALE_FACTOR
2
$ gsettings set org.gnome.desktop.interface text-scaling-factor 1.0
$ gsettings set org.gnome.desktop.interface scaling-factor 0
$ gsettings set org.mate.interface window-scaling-factor 2
$ gsettings set org.mate.interface window-scaling-factor-qt-sync true # this affects QT_SCALE_FACTOR, set to false otherwise
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{ 'Gtk/ShellShowsAppMenu': < 0 >, 'Xft/DPI': < 98304 > }" # 1024 * 96, where 96 is effective DPI
$ gsettings get org.gnome.desktop.interface cursor-size
$ gsettings set org.gnome.desktop.interface cursor-size 24
$ gsettings reset org.gnome.desktop.interface text-scaling-factor
$ gsettings reset org.gnome.desktop.interface scaling-factor
$ gsettings get com.ubuntu.user-interface scale-factor # valid for ubuntu with gnome, just for the reference
$ gsettings set com.ubuntu.user-interface scale-factor "{'HDMI1': 8, 'eDP1': 16}"
Compare settings
gsettings list-recursively > before
# change settings
gsettings list-recursively > after
diff a b | grep '[>|<]'
$ cat /etc/profile.d/hidpi_qt.sh
export QT_AUTO_SCREEN_SCALE_FACTOR="1" # enable automatic detection, for custom scale set it to 0
export QT_SCALE_FACTOR="1.5" # scale all displays, also scales fonts
export QT_SCREEN_SCALE_FACTORS="2;2" # scale per-screen, does not scale fonts
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_FONT_DPI="96"
$ cat /etc/profile.d/hidpi_gdk.sh
export GDK_SCALE="2"
export GDK_DPI_SCALE="0.5"
Navigate to about:config
and change default -1.0
value of layout.css.devPixelsPerPx
to a fractual scale value
chromium --high-dpi-support=1 --force-device-scale-factor=1.5
or permanently
$ cat ~/.config/chromium-flags.conf
--force-device-scale-factor=1.5
$ cat ~/.config/chrome-flags.conf
--force-device-scale-factor=1.5
Another challenge is getting the valid DPI & resolution configuration with multi-monitor setup, you may use xlayoutdisplay
for that
Prepare env
mkdir -p build
docker run --rm -it -v $(pwd)/build:/src --name ubuntu ubuntu:20.04 bash
Build it being inside the container
apt-get update
apt-get install -y build-essential libboost-all-dev libxrandr-dev libxcursor-dev git-core
cd /src
git clone --depth 1 https://github.com/alex-courtis/xlayoutdisplay .
ln -s /usr/lib/x86_64-linux-gnu/libboost_program_options.a /usr/lib/libboost_program_options.a
make
exit
After that run
build/xlayoutdisplay
https://www.mkammerer.de/blog/big-qt-applications-when-running-mate-on-a-hi-dpi-display/