Last active
July 13, 2018 21:42
-
-
Save WardsParadox/4f129b8ef9a4015a5f601c1e6d74b763 to your computer and use it in GitHub Desktop.
Chrome PFM Merger - Requires Google Chrome in the Applications Folder
This file contains hidden or 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/python | |
# # -*- coding: utf-8 -*- | |
import plistlib | |
import os | |
from subprocess import call | |
#import base64 | |
manifestpath = os.path.abspath('/Applications/Google Chrome.app/Contents/Resources/com.google.Chrome.manifest/Contents/Resources/com.google.Chrome.manifest') | |
manifest = plistlib.readPlist(manifestpath) | |
Localizable = os.path.abspath('/Applications/Google Chrome.app/Contents/Resources/com.google.Chrome.manifest/Contents/Resources/en.lproj/Localizable.strings') | |
call(["/usr/bin/plutil", "-convert", "xml1", Localizable]) | |
strings = plistlib.readPlist(Localizable) | |
chromeinfo = plistlib.readPlist( | |
os.path.abspath("/Applications/Google Chrome.app/Contents/Info.plist")) | |
# chromeicon = os.path.abspath("/Applications/Google Chrome.app/Contents/Resources/app.icns") | |
for dict in manifest["pfm_subkeys"]: | |
dict["pfm_title"] = strings[dict["pfm_name"]+".pfm_title"] | |
dict["pfm_description"] = strings[dict["pfm_name"]+".pfm_description"] | |
newmanifest = manifest | |
#newmanifest["pfm_version"] = chromeinfo["CFBundleShortVersionString"] | |
newmanifest["pfm_title"] = "Google Chrome" | |
newmanifest["pfm_description"] = "Google Chrome Managed Settings" | |
# with open(chromeicon, 'rb') as icon: | |
# newmanifest["pfm_icon"] = base64.b64encode(icon.read()) | |
plistlib.writePlist(manifest, | |
os.path.abspath(os.path.expanduser("~/Desktop/GoogleChrome.plist".format( | |
chromeinfo["CFBundleShortVersionString"])))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment