Added a parameter to the dbus method new_window, to allow the passing of the

command to execute.
This commit is contained in:
2011-12-29 20:02:11 +01:00
parent ce9e8d8453
commit d76b0dee7f
2 changed files with 10 additions and 5 deletions

View File

@ -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')

View File

@ -59,12 +59,17 @@ 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):
"""Split a terminal horizontally, by UUID"""
@ -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):