Skip to content

Instantly share code, notes, and snippets.

@baldrailers
Forked from nma/UbuntuHiDPI.md
Created September 11, 2022 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baldrailers/0c7d4df0cf9167d3ff9ab01aadfb4280 to your computer and use it in GitHub Desktop.
Save baldrailers/0c7d4df0cf9167d3ff9ab01aadfb4280 to your computer and use it in GitHub Desktop.
DPI Scaling Fix for Ubuntu on HiDPI 3840x2160 eDP1 with 1920x1080 External Monitor
#!/bin/bash
# Assumes that our global DPI default is for the Highest Resolution Monitor
# --scale 2x2: Our external monitor scale is 2x of our 4K monitor.
# --output <Name>: Just run xrandr without arguments to list device names.
# --mode: The supported mode of the --output monitor.
# --fb: 1920 * 2 x 1080 * 2 + 1080, or 3840x3240. Sets this monitors to fit this space.
# --pos: Set my external monitor's location starting at 0x0
xrandr --output HDMI2 --scale 2x2 --mode 1920x1080 --fb 3840x3240 --pos 0x0
# --scale 1x1: Our laptop monitor is equal to our global DPI setting.
# --pos 960x2160: Move our screen down so it does not overlap the external monitor. (1920 * 2 - 1920) / 2 x 1080 * 2, or 960x2160
xrandr --output eDP1 --scale 1x1 --pos 960x2160

Based on the contents http://blog.jamiek.it/2015/04/manually-fixing-multiple-screens-with.html

  • Set your Ubuntu to the highest DPI from the System Configurations
  • If not using Ubuntu, then you may need to configure based on instructions here and use a DPI calclator.
  • Please referer to the full blog post and give thanks to the OP.
  • This is just notes and a cached script for my personal laptop
  • My External Monitor (HDMI2) is Above my Laptop Screen (eDP1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment