Last active
October 24, 2019 21:41
-
-
Save pwc3/c1290b8c0c250a3af4fbd164d051e91c to your computer and use it in GitHub Desktop.
Show/HIde the floating name at the bottom of the iOS Simulator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import codecs | |
import subprocess | |
import sys | |
def parse_args(argv): | |
if argv is None: | |
argv = sys.argv[1:] | |
parser = \ | |
argparse.ArgumentParser( | |
description="Show or hide the iOS simulator's floating device name" | |
) | |
subs = parser.add_subparsers(title="commands", dest="command") | |
show = subs.add_parser("show", help="Shows the device name") | |
hide = subs.add_parser("hide", help="Hides the device name") | |
return parser.parse_args(argv) | |
def show(): | |
print "Show" | |
def hide(): | |
print "Hide" | |
def main(argv=None): | |
options = parse_args(argv) | |
proc = "defaults" | |
domain = "com.apple.iphonesimulator" | |
key = "FloatingNameMode" | |
if options.command == "show": | |
cmd = [proc, "delete", domain, key] | |
elif options.command == "hide": | |
cmd = [proc, "write", domain, key, "2"] | |
subprocess.call(cmd) | |
if __name__ == "__main__": | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment