From 6f0399481b215817960b5cf36ee03a658a2d9b89 Mon Sep 17 00:00:00 2001 From: Juhani Krekelä Date: Sat, 23 Oct 2021 16:25:59 +0300 Subject: Allow user to turn OSC 7 off Currently weltschmerz prefers working directory information obtained from OSC 7 to that from procfs. If a user has not configured their shell to emit OSC 7 escapes, the OSC 7 path may be out of date. Additionally some users want only their shell to change the terminal's conception of working directory, which is a behaviour better matched by the procfs based working directory detection. This change allows OSC 7 based working directory detection to be turned off. The default remains to check OSC 7 first and then fall back to procfs if there is not valid local path set with OSC 7. The reason for turning OSC 7 off entirely instead of inverting the order procfs and OSC 7 are checked in is that procfs based detection should never fail under normal usage on systems that support it. --- terminal.vala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'terminal.vala') diff --git a/terminal.vala b/terminal.vala index bb66715..da013a5 100644 --- a/terminal.vala +++ b/terminal.vala @@ -396,9 +396,12 @@ class Terminal : Gtk.Overlay { } string? get_cwd() { - string? osc7_path = get_osc7_path(); - if (osc7_path != null) - return osc7_path; + if (conf.prefer_osc7) { + string? osc7_path = get_osc7_path(); + if (osc7_path != null) + return osc7_path; + } + return Posix.realpath("/proc/%i/cwd".printf(child_pid)); } -- cgit v1.2.3-2-gb3c3