You can clone with
#Author: Travis Gibson
#This script requires an argument for the resolution width
#Thanks go out to eCharles for a patch in the comments of this link here: http://blog.echarles.net/2013/10/01/Ubuntu-13.04-On-MacbookPro-Retina
if [ -z "$1" ]; then
echo "Usage: Res.sh <resolution_width>";
erg=$( echo "$1")
check=$(xrandr -q | grep DP-2 | cut -d " " -f 4 | cut -d "x" -f 1)
if [ "$erg" -eq "$check" ]; then
echo "The screen is already at this resolution"
resolution=$(xrandr -q | grep DP-2 | cut -d " " -f 3);
if [ "$resolution" != "2880x1800+0+0" ]; then
xrandr --output DP-2 --scale 1x1;
#Necessary to work around an issue where re-scaling
#only works if the scale is set to 1x1
scale_w=$(echo "scale=4; $1/2880" | bc; exit );
xrandr --output DP-2 --scale $arg
I'm completely new when it comes to Ubuntu, or linux in general. How do you run this script?
@Avilis In Terminal, navigate to this file and type "sh Res.sh"
Thanks for sharing this script.
I adapted this script to automatically detect the screen resolution and make the correct adjustments based on those values (https://gist.github.com/npcardoso/ff937ebca6fc0a80ea3d).
I only tested it in a MBP 11,1 so let me know if it does not work for you.
I have macbook pro retina haswell 13' and this code doesn't work for my machine. How can I fix this problem ? Please help me !