diff --git a/launchd-template.plist b/launchd-template.plist deleted file mode 100644 index f476f0d..0000000 --- a/launchd-template.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Label - ch.veehait.macos-remap-keys - ProgramArguments - - /usr/bin/hidutil - property - --set - $REPLACEME$ - - RunAtLoad - - - diff --git a/remap.py b/remap.py index 99d575c..ac5cb87 100755 --- a/remap.py +++ b/remap.py @@ -7,6 +7,26 @@ import re import os +LAUNCHD_TEMPLATE = """\ + + + + + Label + ch.veehait.macos-remap-keys + ProgramArguments + + /usr/bin/hidutil + property + --set + {property} + + RunAtLoad + + + +""" + def filepath(string): if os.path.exists(string): return string @@ -59,10 +79,7 @@ def create_property( def launchd_definition(hidutil_property: str, outpath: str) -> str: - with open("./launchd-template.plist", "r") as f: - template = f.read() - - res = template.replace("$REPLACEME$", hidutil_property) + res = LAUNCHD_TEMPLATE.format(property=hidutil_property) with open(outpath, "w") as f: f.write(res)