From d53b03664235f0bcff1aae196b319d0f9adae6ca Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 13 Jul 2015 16:30:27 +0200 Subject: [PATCH] Dual solution for cwd based on comments 36 & 37 by Egmont Koblinger in LP#1030562 --- terminatorlib/terminal.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 9197ee15..f2cc2b2e 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -210,9 +210,13 @@ class Terminal(Gtk.VBox): def get_cwd(self): """Return our cwd""" - # Disabled and reverted to revert to old style cwd detection as only returns None. - # return(GLib.filename_from_uri(self.vte.get_current_directory_uri())[0]) - return(self.terminator.pid_cwd(self.pid)) + vte_cwd = self.vte.get_current_directory_uri() + if vte_cwd: + # OSC7 pwd gives an answer + return(GLib.filename_from_uri(vte_cwd)[0]) + else: + # Fall back to old gtk2 method + return(self.terminator.pid_cwd(self.pid)) def close(self): """Close ourselves"""