Setting different screen scales for multiple monitors with persistent xrandr - lmmx/devnotes GitHub Wiki

I recently got a laptop with a 14" high-resolution screen, which I find too small to read at 1x. I prefer 2x 'HiDPI' which Linux Mint now supports.

My external monitor is much bigger than the laptop screen, so it's appropriate to not scale that screen up: it looks too zoomed in when you do. By default, Linux Mint's Display manager will only set a single scale. As of 20.2, fractional scaling is enabled, which means you can modify these values pretty freely.

To set different scales, I followed this guide and then wrote the following script for the .xsession script, which is then loaded as a system startup script in Mint settings.

#!/usr/bin/env bash

MONITOR_NAMES=$(xrandr --listmonitors | grep ': +' | cut -d '+' -f 2- | cut -d ' ' -f 1 | tr -d '*')
for MN in $MONITOR_NAMES; do
	if [ $MN == "eDP-1" ](/lmmx/devnotes/wiki/-$MN-==-"eDP-1"-); then
		xrandr --output $MN --scale 1x1.001 --mode 3840x2160 --rate 60.02
	elif [ $MN == *"DP-"* ](/lmmx/devnotes/wiki/-$MN-==-*"DP-"*-); then
		xrandr --output $MN --scale 2x2.001 --mode 3840x2160 --rate 30.00
	fi
done

This script allows for the possibility that the other monitor may have changed its name (when I unplugged it, it went from DP-2 to DP-3) whereas the built-in screen will always be eDP-1 (they are both the same pixel resolution otherwise you could select based on that).

The guide suggests to add it to Startup Applications and name it 'Displays'. The 'custom command' is just the location of the (chmod'd executable) script, and I also left a comment that it scales the displays.