Skip to content

Instantly share code, notes, and snippets.

@hjst
Created May 10, 2016 12:09
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 hjst/0be1d17deb51f0312f0221ee4d4967b4 to your computer and use it in GitHub Desktop.
Save hjst/0be1d17deb51f0312f0221ee4d4967b4 to your computer and use it in GitHub Desktop.
Configure my Dell monitor (EDID not auto-recognised) via VGA manually with xrandr
#!/bin/sh
# This cvt command calculates the modeline for a 1920×1080 display @ 60Hz
modeline=`cvt 1920 1080 60 | tail -n 1 | cut -d ' ' -f 2-`
modeline_name=`echo ${modeline} | cut -d '"' -f 2`
if xrandr | grep ${modeline_name} > /dev/null; then
# Mode already exists (probably didn't reboot yet) so don't add it
echo "Monitor already configured, skipping..."
else
echo "Adding monitor config modeline from cvt output..."
xrandr --newmode ${modeline}
xrandr --addmode VGA1 ${modeline_name}
fi
echo "Switching modes..."
xrandr --output VGA1 --mode ${modeline_name}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment