diff --git a/kitty/main.py b/kitty/main.py index 71ddeafca..acebd2611 100644 --- a/kitty/main.py +++ b/kitty/main.py @@ -321,10 +321,16 @@ def macos_cmdline(argv_args: list[str]) -> list[str]: if ans and ans[0] == 'kitty': del ans[0] if '-1' in ans or '--single-instance' in ans: - # Re-exec with new argv so that the C code that handles single instance - # can pick up the modified argv - os.environ['KITTY_LAUNCHED_BY_LAUNCH_SERVICES'] = '2' # so that use_os_log is set in the re-execed process - os.execl(kitty_exe(), 'kitty', *(ans + argv_args)) + if '-1' in argv_args or '--single-instance' in argv_args: + # C code will already have setup single instance + log_error( + '--single-instance supplied in both command line arguments and macos-launch-services-cmdline,' + ' ignoring any --instance-group in macos-launch-services-cmdline') + else: + # Re-exec with new argv so that the C code that handles single instance + # can pick up the modified argv + os.environ['KITTY_LAUNCHED_BY_LAUNCH_SERVICES'] = '2' # so that use_os_log is set in the re-execed process + os.execl(kitty_exe(), 'kitty', *(ans + argv_args)) return ans + argv_args