Is it possible to configure a ‘scaled’ desktop in xorg.conf similar to using xrandr’s scale-from option

gnome3xorgxrandr

I have a 14 inch ultrabook with a resolution of 2560×1440. I currently run Gnome 3.16 in HiDPI mode with a scaling factor of 2. Since I'm unable to specify a factional scaling factor, like 1.5, I've opted to use xrandr to scale desktop for me.

xrandr --output eDP1 --scale-from 3200x1800 --panning 3200x1800

I've put the above in a script that runs shortly after logging into a Gnome session. There a couple problems with this.

  1. Sometimes the scaling is lost, like when an on-screen display appears, e.g., pressing one of the brightness controls on the laptop keyboard; and
  2. watching Netflix full-screen only overlays an additional video image over the browser only occupying top left of the laptop screen.

Regarding #1, the scaling isn't completely lost but the desktop 'shrinks' and only appears in the top left corner leaving black space to the right and bottom of the visible desktop. It appears the 'shrunk' desktop is the scaled one but stuck in the top left corner of the 3200×1800 screen.

I'm hoping if I can configure X to do the scaling, and avoid running xrandr, that the screen will stay scaled.

Best Answer

I just finished setting up a ~150% zoom under Cinnamon, hope this will help you too because GNOME is similar to Cinnamon.

I started with xrandr commands from this HiDPI ArchWiki article:

xrandr --output HDMI1 --scale 1.2x1.2 # try 1.3 also
xrandr --output HDMI1 --panning 2304x1296 # this is for 1920x1080 at 1.2

Then i wanted to set it permanent, tried xorg.conf but it does not want to catch Monitor sections of config whatever i try. I asked on ArchLinux forums and got an advice to accept it and throw away xorg.conf. Anyway, i think my config is correct and you can try and use it with changing Monitor Identifier. Most interesting part is transformation matrix. Xorg has no option for scaling, but i figured out that xrandr --scale is a shorthand for --xrandr --transform which corresponds to TransformationMatrix.

Here is my xorg.conf:

Section "Monitor"
    Identifier "TEST" # try changing this!
    Option "Panning" "2304x1296"
    Option "TransformationMatrix" "1.2 0 0 0 1.2 0 0 0 1"
EndSection

Section "Device"
    Identifier  "Intel Graphics" # change these lines according to your graphics card
    Driver  "intel"
    Option  "AccelMethod"   "sna"
    Option  "TearFree"  "true"
    Option  "Monitor-HDMI1" "TEST" # try changing this!
EndSection

This does not work for me, so i continued digging. My system has lightdm which starts first, and it needs xrandr commands to look HiDPIish. Then it starts cinnamon-session which overrides display settings and i need to run xrandr again. Lightdm is configured by etc/lightdm/lightdm.conf and by default it runs something specified in session-wrapper option. You need to create a script with desired xrandr tweaks and place it somewhere to be launched by session-wrapper. By the way, options session-setup-script and display-setup-script didn't work for me.

Then, in Cinnamon (or GNOME in your case) the best thing i could do is to use autostart feature and add xrandr script with zero timeout.

Related Question