Skip to content

Instantly share code, notes, and snippets.

@JAParsons
Forked from nma/UbuntuHiDPI.md
Last active April 10, 2024 22:14
Show Gist options
  • Save JAParsons/0f6ad9c909f171784cb1c185bb96f909 to your computer and use it in GitHub Desktop.
Save JAParsons/0f6ad9c909f171784cb1c185bb96f909 to your computer and use it in GitHub Desktop.
DPI Scaling Fix for Ubuntu on HiDPI 3840x2160 eDP1 with 1920x1080 External Monitor
#!/bin/bash
#Run for dual monitor scaling (3840x2160 primary and 1920x1080 secondary)
# 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 3840x2160. Sets this monitor to fit this space.
# --pos: Set my external monitor's location starting at 0x0
xrandr --output DP-2 --scale 2x2 --mode 1920x1080 --fb 3840x2160 --pos 0x0
# --scale 1x1: Our laptop monitor is equal to our global DPI setting.
# --pos 0x2160: Move our screen down so it does not overlap the external monitor. (1920 * 2 - 1920) / 2 x 1080 * 2, or 0x2160
xrandr --output eDP-1 --scale 1x1 --pos 0x2160
#fix cursor flickering
xrandr --output eDP-1 --scale 0.9999x0.9999

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 (DP-2) is Above my Laptop Screen (eDP1)

Forked from: https://gist.github.com/nma/8125f585f4111e1e55caee83c03b94a6

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