Skip to content

Instantly share code, notes, and snippets.

@carlosefonseca
Last active September 7, 2020 12:03
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 carlosefonseca/ab749c9f8192e622c6513e07f3593efa to your computer and use it in GitHub Desktop.
Save carlosefonseca/ab749c9f8192e622c6513e07f3593efa to your computer and use it in GitHub Desktop.
Takes booted iOS simulators and changes their current keyboard to PT_PT.
sim_set_pt_booted() {
for d in $(xcrun simctl list devices booted | grep Booted | perl -pe "s/.*\(([^ ]+)\) \(Booted\)/\1/")
do
echo -n $d
/usr/libexec/PlistBuddy -c "Set :AppleKeyboards:2 pt_PT@sw=QWERTY;hw=Automatic" -c "Set :AppleLanguages:1 pt-PT" -c "Set :AppleKeyboards:3 pt_PT@sw=QWERTY;hw=Automatic" ~/Library/Developer/CoreSimulator/Devices/$d/data/Library/Preferences/.GlobalPreferences.plist
# This is reset on restart (last checked on iOS 13.7)
/usr/libexec/PlistBuddy -c "Set :AutomaticMinimizationEnabled false" ~/Library/Developer/CoreSimulator/Devices/$d/data/Library/Preferences/com.apple.Preferences.plist
echo " Files patched. Restarting device… "
xcrun simctl shutdown $d
xcrun simctl boot $d
done
echo "Done"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment