diff --git a/kitty/boss.py b/kitty/boss.py index 69e652a04..67aae6f43 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -463,9 +463,9 @@ class Boss: w = self.active_window_for_cwd self._new_os_window(args, CwdRequest(w)) - def new_os_window_with_wd(self, wd: Union[str, List[str]]) -> None: + def new_os_window_with_wd(self, wd: Union[str, List[str]], str_is_multiple_paths: bool = False) -> None: if isinstance(wd, str): - wd = [wd] + wd = wd.split(os.pathsep) if str_is_multiple_paths else [wd] for path in wd: special_window = SpecialWindow(None, cwd=path) self._new_os_window(special_window) @@ -1851,11 +1851,11 @@ class Boss: def new_tab_with_cwd(self, *args: str) -> None: self._create_tab(list(args), cwd_from=CwdRequest(self.active_window_for_cwd)) - def new_tab_with_wd(self, wd: Union[str, List[str]]) -> None: + def new_tab_with_wd(self, wd: Union[str, List[str]], str_is_multiple_paths: bool = False) -> None: if not self.os_window_map: self.add_os_window() if isinstance(wd, str): - wd = [wd] + wd = wd.split(os.pathsep) if str_is_multiple_paths else [wd] for path in wd: special_window = SpecialWindow(None, cwd=path) self._new_tab(special_window) diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index a4dc767bb..6b57163f3 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -1041,17 +1041,8 @@ process_cocoa_pending_actions(void) { if (cocoa_pending_actions[TOGGLE_MACOS_SECURE_KEYBOARD_ENTRY]) { call_boss(toggle_macos_secure_keyboard_entry, NULL); } if (cocoa_pending_actions[TOGGLE_FULLSCREEN]) { call_boss(toggle_fullscreen, NULL); } if (cocoa_pending_actions_data.wd) { -#define C(a, f) \ - if (cocoa_pending_actions[a]) { \ - PyObject *wds = PyUnicode_FromString(cocoa_pending_actions_data.wd); \ - PyObject *sep = PyUnicode_FromString(":"); \ - PyObject *paths = PyUnicode_Split(wds, sep, -1); \ - call_boss(f, "O", paths); \ - Py_DECREF(paths); Py_DECREF(sep); Py_DECREF(wds); \ - } - C(NEW_OS_WINDOW_WITH_WD, new_os_window_with_wd); - C(NEW_TAB_WITH_WD, new_tab_with_wd); -#undef C + if (cocoa_pending_actions[NEW_OS_WINDOW_WITH_WD]) { call_boss(new_os_window_with_wd, "sO", cocoa_pending_actions.wd, Py_True); } + if (cocoa_pending_actions[NEW_TAB_WITH_WD]) { call_boss(new_tab_with_wd, "sO", cocoa_pending_actions.wd, Py_True); } free(cocoa_pending_actions_data.wd); cocoa_pending_actions_data.wd = NULL; }