feat(file-manager): sync the working directory by default

The panel and the shell now share their directory out of the box; whoever wants
the previous independence sets sync_cwd no. The request is only written once the
shell has published its directory, since that file is what proves its
integration hook will read the request: a shell without shell integration still
gets the cd typed into the terminal instead of losing the change.
This commit is contained in:
BlackAngelTV committed 2026-11-11 08:35:19 +01:00
1 parent 1b330bcf81
commit e7e4e849eb
7 files changed
+61 -16

No files matched your search

+8
View File
@@ -42,6 +42,14 @@ func new_shell_sync_from_env(enabled bool) *shell_sync {
func (s *shell_sync) shell_cwd_path() string { return filepath.Join(s.dir, s.window_id) }
func (s *shell_sync) request_path() string { return s.shell_cwd_path() + ".set" }
// shell_has_hook reports whether the shell has published its working directory
// at least once, which only the integration hook does. Without it nothing would
// consume the request, so the panel has to type the change into the shell.
func (s *shell_sync) shell_has_hook() bool {
_, err := os.Stat(s.shell_cwd_path())
return err == nil
}
// shell_cwd returns the working directory last published by the shell. An empty
// or relative path, or one that no longer exists, is treated as unknown rather
// than followed, as the shell may be between two writes.