Skip to content

Instantly share code, notes, and snippets.

@aryklein
Last active December 26, 2019 00:18
Show Gist options
  • Save aryklein/57efd27002e318e14fd0f15117a15eb1 to your computer and use it in GitHub Desktop.
Save aryklein/57efd27002e318e14fd0f15117a15eb1 to your computer and use it in GitHub Desktop.
Configuring non-HiDPI external displays in Linux

Configuring a non-HiDPI external display in a HiDPI Laptop with Linux

I have a HiDPI laptop running Arch Linux and the HiDPI setting applies to the whole desktop, so non-HiDPI external displays show everything too large.

At the time of writting this document, in Gnome Display Settings (version 3.34), there is no way to use different scale option for Built-in display and external displays.

The workaround I found to use different scale options is thru xrandr on Xorg or enabling HiDPI fractional scaling on Wayland.

On Xorg

Star Gnome on Xorg and list connected displays:

$ xrandr | grep " connected"

In my case I'm using a Dell laptop with 3200x1800 Built-in display (eDP-1) and I have connected a 1920x1080 external screen (DP-1). If I want to set my external screen (DP-1) at the right of my laptop, I need to execute:

$ xrandr --output eDP-1 --mode 3200x1800 --output DP-1 --pos 3200x0 --scale 2x2

Where:

  • --mode 3200x1800 says to use resolution 3200x1800 in eDP-1 (you can omit this and xrand will not change the resolution).
  • --pos 3200x0 is the position of the external display. In this example it is at the right of the laptop. If the laptop resolution were 3840x2160, you should use --pos 3840x0 (width and height).
  • --scale 2x2 is similar to zooming out. This is necessary as the HiDPI setting applies to the whole desktop.

NOTE: if you get mouse flickering in your non-scaled screen you can try scaling it by 0.9999x0.9999:

$ xrandr --output eDP-1 --scale 0.9999x0.9999 --output DP-1 --pos 3200x0 --scale 2x2

If you want to install your external display at the left of your laptop:

$ xrandr --output DP-1 --scale 2x2 --output eDP-1 --scale 0.9999x0.9999 --pos 3840x0

In this case --pos 3840x0 is because the external display is scaled by 2x2 and its resolution is 1920x1080: 1920 x 2 = 3840.

You can also configure resolution and possition from the Gnome Display Settings and just execute:

$ xrandr --output eDP-1 --scale 0.9999x0.9999 --output DP-1 --scale 2x2

Note: I noticed that at some point you need to execute the same command more than once to apply the changes.

On Wayland

If you go to Display Settings and change the scale factor in the external display it does not work. To solve this issue, you need to enable Gnome’s "experimental" per-monitor scaling, by runing this command in a terminal:

$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

After logging out and logging back in, the scaling for the external monitor thru Display Settings will actually work.

To disable this mode again, use:

$ gsettings set org.gnome.mutter experimental-features "[]"

Or you can use:

$ gsettings reset org.gnome.mutter experimental-features

Note: When you enable this experimental feature, any apps which don't natively support scaling will be scaled by the compositor, which means they will either appear blurry or unevenly pixelated. In other words, all apps that don't fully support Wayland.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment