From d76b0dee7f25a39e656f389ac4ea473c926e3f6f Mon Sep 17 00:00:00 2001 From: Date: Thu, 29 Dec 2011 20:02:11 +0100 Subject: [PATCH] Added a parameter to the dbus method new_window, to allow the passing of the command to execute. --- terminator | 2 +- terminatorlib/ipc.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/terminator b/terminator index 1fd95ccd..7c4b978c 100755 --- a/terminator +++ b/terminator @@ -66,7 +66,7 @@ if __name__ == '__main__': dbus_service = ipc.DBusService() except ipc.DBusException: dbg('Unable to become master process, requesting a new window') - ipc.new_window(OPTIONS.layout) + ipc.new_window(OPTIONS.layout, OPTIONS.command or '') sys.exit() except ImportError: dbg('dbus not imported') diff --git a/terminatorlib/ipc.py b/terminatorlib/ipc.py index d413be84..dbcbaaef 100644 --- a/terminatorlib/ipc.py +++ b/terminatorlib/ipc.py @@ -59,11 +59,16 @@ class DBusService(Borg, dbus.service.Object): self.terminator = Terminator() @dbus.service.method(BUS_NAME) - def new_window(self, layout='default'): + def new_window(self, layout, command=''): """Create a new Window""" - dbg('dbus method called: new_window') + dbg('dbus method called: new_window with parameters %s, %s'%(layout, command)) + if command: + options = self.terminator.config.options_get() + options.command = command + self.terminator.config.options_set(options) self.terminator.create_layout(layout) self.terminator.layout_done() + @dbus.service.method(BUS_NAME) def terminal_hsplit(self, uuid=None): @@ -103,9 +108,9 @@ def with_proxy(func): return _exec @with_proxy -def new_window(session, layout='default'): +def new_window(session, layout='default', command=''): """Call the dbus method to open a new window""" - session.new_window(layout) + session.new_window(layout, command) @with_proxy def terminal_hsplit(session, uuid):