Skip to content

Instantly share code, notes, and snippets.

@anthony-wang
Created January 28, 2017 17:45
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 anthony-wang/166893ca4a642a2e757c3d736d64edd4 to your computer and use it in GitHub Desktop.
Save anthony-wang/166893ca4a642a2e757c3d736d64edd4 to your computer and use it in GitHub Desktop.
Script - Change OnePlus One DPI to 420
#!/sbin/sh
#
# /system/addon.d/changeDPIto420.sh
#
# Copyright Anthony Wang, 2016
#
# This script is based on http://forum.xda-developers.com/google-nexus-5/help/help-script-to-lcd-density-t2862245
# the original code of which is "sed -i 's/density=480/density=420/g' /system/build.prop;"
# but has been improved in this current script.
# The "sed" command: https://www.gnu.org/software/sed/manual/sed.txt
# The "-i" option specifies that the file is to be edited in-place.
# The "s/..../..../" is the Substitute command and substitutes s/old/toNEW/
# The "[0-9]*" in the first argument of the s/ command is a Regex matching for an any-digit number
# The "/g" at the end of the Substitute command is a Global replacement flag,
# meaning change every occurrance of the match pattern
#
# Additional note regarding the -i option under Mac OS X vs. Unix
# http://stackoverflow.com/questions/19456518/invalid-command-code-despite-escaping-periods-using-sed
#
sed -i 's/ro.sf.lcd_density=[0-9]*/ro.sf.lcd_density=420/g' /system/build.prop;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment