andreikop / enki

A text editor for programmers
http://enki-editor.org
GNU General Public License v2.0
161 stars 39 forks source link

Open terminal in the current working folder on Linux #371

Closed dglent closed 8 years ago

dglent commented 8 years ago

With ctrl+T the xterm terminal opens on the current working directory but other terminals no (konsole, qterminal). I changed as following for me because i use one of these terminals, we could do something better if this will be finally corrected:

--- enki-15.11.0.orig/enki/plugins/openterm.py  2015-11-30 21:36:18.000000000 +0100
+++ /usr/lib/python2.7/site-packages/enki/plugins/openterm.py   2015-12-24 09:00:43.023931460 +0100
@@ -90,6 +90,17 @@
         """Handler for main menu action
         """
         term = core.config()["OpenTerm"]["Term"]
+
+        try:
+            cwd_mainwindow = os.path.dirname(
+                            core.workspace().currentDocument().filePath())
+        except:
+            cwd_mainwindow = os.getcwd()
+        terminals = ['konsole', 'qterminal']
+        if term in terminals:
+            term1 = [c for c in term, '--workdir', cwd_mainwindow]
+            term = term1
+
         if not term:
             term = self._chooseDefaultTerminal()
andreikop commented 8 years ago

Pushed a fix to master. (A simpler variant since now Enki cwd follows current file)