I've run into a few common issues running i3 on a laptop with external monitors.
- When running i3, external monitors aren't always detected properly.
- When running multiple displays with different resolutions, text scaling is inconsistent.
- I'd like to be able to automatically change configurations if I unplug my external monitor(s), plug in a projector, etc.
tl;dr: Configure xrandr, set font scaling for X11, and use autorandr.
See references for more detailed info.
Based on this article, setting different dpi per-monitor in a way that is universally supported by all applications is tricky if not impossible.
The workaround seems to be to set one universal dpi and then run all displays at resolutions that look good at that dpi, possibly with the help of scaling.
Scaling can lead to performance issues. For me, running multiple applications side-by-side on a scaled display often led to virtually unusable stuttering.
Some example xrandr configs below. Use autorandr to save and automatically load configurations.
Some past configs I've used that might be a good reference of what to do/not do.
Rather than scaling the external monitor by 1.5 to UHD resolution, I just ran everything at QHD.
xrandr \
--output eDP-1-1 --primary --mode 2560x1440 --pos 2560x0 \
--output eDP-1 --primary --mode 2560x1440 --pos 2560x0 \
--output DP-3 --mode 2560x1440 --pos 0x0 \
> /dev/null 2>&1
Scale the external monitor up to UHD. This led to performance issues on the scaled monitor when running multiple applications. I may have been better off running the laptop display (eDP) at 1920x1200.
xrandr \
--output eDP-1-1 --primary --mode 3840x2160 --pos 3840x0 \
--output eDP-1 --primary --mode 3840x2160 --pos 3840x0 \
--output DP-3 --mode 1920x1200 --scale 2x2 --pos 0x0 \
> /dev/null 2>&1
According to the Arch wiki, this only needs to be done if you're not using a desktop manager that sets it up for you. I needed to for i3.
I added this line to my ~/.Xresources
config:
Xft.dpi: 160
I used the actual dpi of my external monitor as a starting point and adjusted it until I was happy with how applications were scaled.
- autorandr: Automatically load previously-saved xrandr configurations based on your current setup. Can be configured to automatically respond to monitor plug/unplug events on-the-fly.
- arandr: drag-and-drop GUI that can be helpful as a starting point for visualizing and generating xrandr configurations.
this was really helpful, thanks!