Add a command line option to spawn new tabs via DBus
This commit is contained in:
parent
43f69112e4
commit
5d35c196c7
@ -18,6 +18,7 @@ terminator 1.0:
|
||||
John Feuerstein
|
||||
* Support reading configuration from alternate files, via a patch
|
||||
from Pavel Khlebovich
|
||||
* Allow creation of new tabs in existing Terminators, via DBus
|
||||
* Bug fixes
|
||||
|
||||
terminator 0.96:
|
||||
|
@ -86,6 +86,10 @@ only be printed from the specified functions. If this is specified in
|
||||
addition to \-\-debug-classes, only the intersection of the two lists
|
||||
will be displayed
|
||||
.TP
|
||||
.B \-\-new-tab
|
||||
If this is specified and Terminator is already running, DBus will be
|
||||
used to spawn a new tab in the first Terminator window.
|
||||
.TP
|
||||
.SH "KEYBINDINGS"
|
||||
The following keybindings can be used to control Terminator:
|
||||
.TP
|
||||
|
@ -66,7 +66,7 @@ if __name__ == '__main__':
|
||||
try:
|
||||
dbus_service = ipc.DBusService()
|
||||
except ipc.DBusException:
|
||||
dbg('Unable to become master process, requesting a new window')
|
||||
dbg('Unable to become master process, operating via DBus')
|
||||
# get rid of the None and True types so dbus can handle them (empty
|
||||
# and 'True' strings are used instead), also arrays are joined
|
||||
# (the -x argument for example)
|
||||
@ -78,7 +78,12 @@ if __name__ == '__main__':
|
||||
val = 'True'
|
||||
optionslist[opt] = val and '%s'%val or ''
|
||||
optionslist = dbus.Dictionary(optionslist, signature='ss')
|
||||
ipc.new_window(optionslist)
|
||||
if OPTIONS.new_tab:
|
||||
dbg('Requesting a new tab')
|
||||
ipc.new_tab(optionslist)
|
||||
else:
|
||||
dbg('Requesting a new window')
|
||||
ipc.new_window(optionslist)
|
||||
sys.exit()
|
||||
except ImportError:
|
||||
dbg('dbus not imported')
|
||||
|
@ -69,6 +69,15 @@ class DBusService(Borg, dbus.service.Object):
|
||||
self.terminator.create_layout(oldopts.layout)
|
||||
self.terminator.layout_done()
|
||||
|
||||
@dbus.service.method(BUS_NAME, in_signature='a{ss}')
|
||||
def new_tab(self, options=dbus.Dictionary()):
|
||||
"""Create a new tab"""
|
||||
dbg('dbus method called: new_tab with parameters %s'%(options))
|
||||
oldopts = self.terminator.config.options_get()
|
||||
oldopts.__dict__ = options
|
||||
self.terminator.config.options_set(oldopts)
|
||||
window = self.terminator.get_windows()[0]
|
||||
window.tab_new()
|
||||
|
||||
@dbus.service.method(BUS_NAME)
|
||||
def terminal_hsplit(self, uuid=None):
|
||||
@ -132,6 +141,11 @@ def new_window(session, options):
|
||||
"""Call the dbus method to open a new window"""
|
||||
session.new_window(options)
|
||||
|
||||
@with_proxy
|
||||
def new_tab(session, options):
|
||||
"""Call the dbus method to open a new tab in the first window"""
|
||||
session.new_tab(options)
|
||||
|
||||
@with_proxy
|
||||
def terminal_hsplit(session, uuid):
|
||||
"""Call the dbus method to horizontally split a terminal"""
|
||||
|
@ -87,6 +87,8 @@ icon for the window (by file or name)'))
|
||||
help=_('Comma separated list of classes to limit debugging to'))
|
||||
parser.add_option('--debug-methods', action='store', dest='debug_methods',
|
||||
help=_('Comma separated list of methods to limit debugging to'))
|
||||
parser.add_option('--new-tab', action='store_true', dest='new_tab',
|
||||
help=_('If Terminator is already running, just open a new tab'))
|
||||
for item in ['--sm-client-id', '--sm-config-prefix', '--screen', '-n',
|
||||
'--no-gconf' ]:
|
||||
parser.add_option(item, dest='dummy', action='store',
|
||||
|
@ -104,6 +104,10 @@ class Terminator(Borg):
|
||||
dbg('session manager asked us to die')
|
||||
# FIXME: Implement this
|
||||
|
||||
def get_windows(self):
|
||||
"""Return a list of windows"""
|
||||
return self.windows
|
||||
|
||||
def register_window(self, window):
|
||||
"""Register a new window widget"""
|
||||
if window not in self.windows:
|
||||
|
@ -262,7 +262,7 @@ class Window(Container, gtk.Window):
|
||||
if not self.is_child_notebook():
|
||||
dbg('Making a new Notebook')
|
||||
notebook = maker.make('Notebook', window=self)
|
||||
self.get_child().newtab(debugtab, cwd=cwd, profile=profile)
|
||||
return self.get_child().newtab(debugtab, cwd=cwd, profile=profile)
|
||||
|
||||
def on_delete_event(self, window, event, data=None):
|
||||
"""Handle a window close request"""
|
||||
|
Loading…
Reference in New Issue
Block a user