From e3124812e54e28b9678eee622c3bd208f5bc6d45 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 15 Sep 2024 10:38:32 +0530 Subject: [PATCH] log a warning that double --single-instance will ignore the one from macos-launch-services-cmdline --- kitty/main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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