diff options
| author | Victor Kareh <[email protected]> | 2026-04-09 17:03:54 -0400 |
|---|---|---|
| committer | Victor Kareh <[email protected]> | 2026-04-09 17:03:54 -0400 |
| commit | 932c5c0ec90fddbffb7996996df585d36b53bd8b (patch) | |
| tree | 53489be46b6f67ba0c3ac46862a56bba279115ab /src/terminal-window.c | |
| parent | 82c29555af291daf6504bdd57be8502be38282d3 (diff) | |
| download | mate-terminal-use-osc7-cwd.tar.bz2 mate-terminal-use-osc7-cwd.tar.xz | |
terminal-screen: prefer OSC 7 for current working directoryuse-osc7-cwd
Use the current directory URI (set by the shell via OSC 7 escape
sequence) to determine the working directory for new tabs, instead of
reading /proc. This works inside tmux/screen/sudo, preserves symlink
components, and is consistent with other VTE-based terminal emulators.
The /proc-based detection is kept as a fallback for shells that don't
emit OSC 7 (e.g. vte.sh is not sourced). The initial working directory
is used as a final fallback, and the separate _with_fallback variant is
folded into the main function so all callers benefit from the complete
fallback chain.
Adapted from https://gitlab.gnome.org/GNOME/gnome-terminal/-/commit/cf3cad87
Fixes #195
Diffstat (limited to 'src/terminal-window.c')
| -rw-r--r-- | src/terminal-window.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c index 75e5fd8..aaad3cb 100644 --- a/src/terminal-window.c +++ b/src/terminal-window.c @@ -3657,7 +3657,7 @@ file_new_window_callback (GtkAction *action, new_window = terminal_app_new_window (app, gtk_widget_get_screen (GTK_WIDGET (window))); - new_working_directory = terminal_screen_get_current_dir_with_fallback (priv->active_screen); + new_working_directory = terminal_screen_get_current_dir (priv->active_screen); terminal_app_new_terminal (app, new_window, profile, NULL, NULL, new_working_directory, @@ -3689,7 +3689,7 @@ file_new_tab_callback (GtkAction *action, if (_terminal_profile_get_forgotten (profile)) return; - new_working_directory = terminal_screen_get_current_dir_with_fallback (priv->active_screen); + new_working_directory = terminal_screen_get_current_dir (priv->active_screen); terminal_app_new_terminal (app, window, profile, NULL, NULL, new_working_directory, |
