diff --git a/ChangeLog b/ChangeLog index 615b20f1..c4afab2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,9 @@ terminator 0.96: context menu (#308025) * Don't forget tab order and custom labels when closing terminals in them (#711356) + * Each terminal is assigned a unique identifier and this is exposed + to the processes inside the terminal via the environment variable + TERMINATOR_UUID terminator 0.95: * Add a configuration option to enable a DBus server diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 17a64879..b41b4ba6 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -14,6 +14,7 @@ import gobject import pango import subprocess import urllib +import uuid from util import dbg, err, gerr import util @@ -85,6 +86,7 @@ class Terminal(gtk.VBox): command = None clipboard = None pid = None + uuid = None matches = None config = None @@ -120,6 +122,9 @@ class Terminal(gtk.VBox): self.pending_on_vte_size_allocate = False + self.uuid = uuid.uuid4() + dbg('assigning Terminal a TERMINATOR_UUID of: %s' % self.uuid.urn) + self.vte = vte.Terminal() self.vte.set_size(80, 24) self.vte._expose_data = None @@ -1199,9 +1204,12 @@ for %s (%s)' % (name, urlplugin.__class__.__name__)) pass dbg('Forking shell: "%s" with args: %s' % (shell, args)) - self.pid = self.vte.fork_command(command=shell, argv=args, envv=[], - loglastlog=login, logwtmp=update_records, - logutmp=update_records, directory=self.cwd) + self.pid = self.vte.fork_command(command=shell, argv=args, + envv=['TERMINATOR_UUID=%s' % self.uuid.urn], + loglastlog=login, + logwtmp=update_records, + logutmp=update_records, + directory=self.cwd) self.command = shell self.titlebar.update()