feat(file-manager): sync the working directory with the shell
The panel and the shell each kept their own directory. The new sync_cwd option keeps them in step both ways, through files in a session directory exported by kitty rather than by typing a command into the terminal: the shell applies the directory chosen in the panel from its prompt hook with builtin cd, so nothing lands in the history and a half typed multi-line command is not submitted.
This commit is contained in:
12 files changed
+425
-6
No files matched your search
@@ -927,6 +927,17 @@ class Tab: # {{{
|
||||
restored_scrollback: bytes = b'',
|
||||
) -> Window:
|
||||
"Create a new window. When dock is specified, the window is docked to dock_owner or to the tab if dock_owner is None."
|
||||
# A special window opened over another one, or docked next to it, needs
|
||||
# to know which shell it belongs to: the file manager uses it to find
|
||||
# the session file where that shell publishes its working directory. A
|
||||
# dock follows a window group, so its initial parent is the active
|
||||
# window of the tab it is created in.
|
||||
parent_window_id = overlay_for
|
||||
if parent_window_id is None and dock is not None and (aw := self.active_window) is not None:
|
||||
parent_window_id = aw.id
|
||||
if parent_window_id is not None:
|
||||
env = dict(env or {})
|
||||
env['KITTY_SPECIAL_WINDOW_PARENT'] = str(parent_window_id)
|
||||
cs = WindowCreationSpec(
|
||||
use_shell=use_shell,
|
||||
cmd=cmd,
|
||||
|
||||
Reference in new issue
Block a user