Skip to content

Instantly share code, notes, and snippets.

@hirakujira
Created July 24, 2016 09:16
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 hirakujira/4e16516234f4d69f30c0a384e30f7bbf to your computer and use it in GitHub Desktop.
Save hirakujira/4e16516234f4d69f30c0a384e30f7bbf to your computer and use it in GitHub Desktop.
#/bin/bash
WIDTH=1920
HEIGHT=1080
HIRES=0
read -e -p "Please set width px of screen resolution : " WIDTH
read -e -p "Please set height px of screen resolution : " HEIGHT
read -e -p "Do you want to use HiDPI (@2x) ? (y/n) " HIRES
if [ "$HIRES" == "Y" -o "$HIRES" == "y" -o "$HIRES" == "YES" -o "$HIRES" == "yes" ]; then
HIRES=2
else
HIRES=1
fi
echo "\nScreen resolution is set to $(($WIDTH*$HIRES)) x $(($HEIGHT*$HIRES))\n"
WIDTH_HEX=$(echo "obase=16; $(($WIDTH*$HIRES))" | bc)
HEIGHT_HEX=$(echo "obase=16; $(($HEIGHT*$HIRES))" | bc)
while [[ ${#WIDTH_HEX} -lt 8 ]]; do
WIDTH_HEX="0"$WIDTH_HEX
done
while [[ ${#HEIGHT_HEX} -lt 8 ]]; do
HEIGHT_HEX="0"$HEIGHT_HEX
done
FULL_HEX=$WIDTH_HEX$HEIGHT_HEX"0000000100200000"
echo "Hex value is : "$FULL_HEX
BASE64STRING=$(echo $FULL_HEX | xxd -r -p | base64)
echo "Please set this value in your plist : "$BASE64STRING"\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment