Skip to content

Instantly share code, notes, and snippets.

@jamesmcallister
Created September 13, 2017 13:49
Show Gist options
  • Save jamesmcallister/a5df5d6e6fc5bf1dc8c880ad37f8e977 to your computer and use it in GitHub Desktop.
Save jamesmcallister/a5df5d6e6fc5bf1dc8c880ad37f8e977 to your computer and use it in GitHub Desktop.
xrandr external monitor dell xps 13 9350, 4k, 1920x1200
#!/bin/bash
intern=eDP1
extern=DP1
internalSettings="xrandr --output $intern --primary --mode 3200x1800 --scale 1x1"
if xrandr | grep "$extern disconnected"; then
$internalSettings --output $extern --off
echo "-> Laptop Mode"
elif xrandr | grep "$extern connected 4160x2640+0+0"; then
$internalSettings --fb 4160x2640
xrandr --output $extern --scale 2x2 --mode 3840x2160
echo "-> Desktop Mode - Asus 4K"
elif xrandr | grep "$extern connected 3840x2400+0+0"; then
$internalSettings --fb 3840x4200
xrandr --output $extern --scale 2x2 --mode 1920x1200
echo "-> Desktop Mode - Dell 1920x1200"
else
$internalSettings --fb 3840x4200
xrandr --output $extern --scale 2x2 --mode 1920x1200
echo "-> Desktop Mode 1920x1200"
fi
@krishicks
Copy link

This is one of the few situations I've seen someone post xrandr settings for a 4k external display plus 3200x1800 internal display. However, it doesn't work for my situation as I want the 4k external display to be --right-of eDP-1, and that fails for me because it exceeds 8192x8192. Are you able to use --right-of successfully?

My solution is not to use --scale at all and instead use --dpi 144 which makes everything a bit bigger on both displays, but comfortably so.

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