Ubuntu – How change display scale from the command line in Ubuntu 18.04 (xorg)

18.04gnome-control-centerhdpiscalingxorg

I am trying to get in the command line the same effect as changing the display scale factor from the Gnome Control Center.

I have tried the following command, but it does not have any effect:

gsettings set org.gnome.desktop.interface scaling-factor 2

I need this command to build a sort of fractional scale factor with the combination of xrandx and the scaling factor in the Gnome Control Center. Since, the execution of xrandr resets the scaling factor in the Gnome Control Center, I would need a command to recover the value in the Gnome Control Center.

Please, any suggestion is welcome. Thanks in advance.

Best Answer

Determine your output device (mine is DP-1) by running xrandr on its own, then use this:

gsettings set org.gnome.desktop.interface scaling-factor 2
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gdk/WindowScalingFactor': <2>}"
xrandr --output DP-1 --scale 1.5x1.5
xrandr --output DP-1 --panning 3840x2160
Related Question