Fix up the startup cwd tracking so self-spawning works in non-absolute paths, and handle the key_new_window => key_new_terminator switch
This commit is contained in:
parent
a5ac05bcc9
commit
e3438b3bdf
|
@ -19,6 +19,8 @@
|
||||||
"""Terminator by Chris Jones <cmsj@tenshu.net>"""
|
"""Terminator by Chris Jones <cmsj@tenshu.net>"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
ORIGCWD = os.getcwd()
|
||||||
|
|
||||||
# Check we have simple basics like Gtk+ and a valid $DISPLAY
|
# Check we have simple basics like Gtk+ and a valid $DISPLAY
|
||||||
try:
|
try:
|
||||||
|
@ -50,6 +52,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
MAKER = Factory()
|
MAKER = Factory()
|
||||||
TERMINATOR = Terminator()
|
TERMINATOR = Terminator()
|
||||||
|
TERMINATOR.origcwd = ORIGCWD
|
||||||
TERMINATOR.reconfigure()
|
TERMINATOR.reconfigure()
|
||||||
TERMINATOR.new_window()
|
TERMINATOR.new_window()
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ class Terminal(gtk.VBox):
|
||||||
|
|
||||||
group = None
|
group = None
|
||||||
cwd = None
|
cwd = None
|
||||||
|
origcwd = None
|
||||||
command = None
|
command = None
|
||||||
clipboard = None
|
clipboard = None
|
||||||
pid = None
|
pid = None
|
||||||
|
@ -109,6 +110,7 @@ class Terminal(gtk.VBox):
|
||||||
self.config = Config()
|
self.config = Config()
|
||||||
|
|
||||||
self.cwd = get_default_cwd()
|
self.cwd = get_default_cwd()
|
||||||
|
self.origcwd = self.terminator.origcwd
|
||||||
self.clipboard = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD)
|
self.clipboard = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD)
|
||||||
|
|
||||||
self.vte = vte.Terminal()
|
self.vte = vte.Terminal()
|
||||||
|
@ -1301,11 +1303,14 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
||||||
self.emit('ungroup-tab')
|
self.emit('ungroup-tab')
|
||||||
|
|
||||||
def key_new_window(self):
|
def key_new_window(self):
|
||||||
|
self.terminator.new_window()
|
||||||
|
|
||||||
|
def key_new_terminator(self):
|
||||||
cmd = sys.argv[0]
|
cmd = sys.argv[0]
|
||||||
|
|
||||||
if not os.path.isabs(cmd):
|
if not os.path.isabs(cmd):
|
||||||
# Command is not an absolute path. Figure out where we are
|
# Command is not an absolute path. Figure out where we are
|
||||||
cmd = os.path.join (self.cwd, sys.argv[0])
|
cmd = os.path.join (self.origcwd, sys.argv[0])
|
||||||
if not os.path.isfile(cmd):
|
if not os.path.isfile(cmd):
|
||||||
# we weren't started as ./terminator in a path. Give up
|
# we weren't started as ./terminator in a path. Give up
|
||||||
err('Terminal::key_new_window: Unable to locate Terminator')
|
err('Terminal::key_new_window: Unable to locate Terminator')
|
||||||
|
|
|
@ -21,6 +21,8 @@ class Terminator(Borg):
|
||||||
config = None
|
config = None
|
||||||
keybindings = None
|
keybindings = None
|
||||||
|
|
||||||
|
origcwd = None
|
||||||
|
|
||||||
groupsend = None
|
groupsend = None
|
||||||
groupsend_type = {'all':0, 'group':1, 'off':2}
|
groupsend_type = {'all':0, 'group':1, 'off':2}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue