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
|
John Feuerstein
|
||||||
* Support reading configuration from alternate files, via a patch
|
* Support reading configuration from alternate files, via a patch
|
||||||
from Pavel Khlebovich
|
from Pavel Khlebovich
|
||||||
|
* Allow creation of new tabs in existing Terminators, via DBus
|
||||||
* Bug fixes
|
* Bug fixes
|
||||||
|
|
||||||
terminator 0.96:
|
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
|
addition to \-\-debug-classes, only the intersection of the two lists
|
||||||
will be displayed
|
will be displayed
|
||||||
.TP
|
.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"
|
.SH "KEYBINDINGS"
|
||||||
The following keybindings can be used to control Terminator:
|
The following keybindings can be used to control Terminator:
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -66,7 +66,7 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
dbus_service = ipc.DBusService()
|
dbus_service = ipc.DBusService()
|
||||||
except ipc.DBusException:
|
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
|
# get rid of the None and True types so dbus can handle them (empty
|
||||||
# and 'True' strings are used instead), also arrays are joined
|
# and 'True' strings are used instead), also arrays are joined
|
||||||
# (the -x argument for example)
|
# (the -x argument for example)
|
||||||
|
@ -78,6 +78,11 @@ if __name__ == '__main__':
|
||||||
val = 'True'
|
val = 'True'
|
||||||
optionslist[opt] = val and '%s'%val or ''
|
optionslist[opt] = val and '%s'%val or ''
|
||||||
optionslist = dbus.Dictionary(optionslist, signature='ss')
|
optionslist = dbus.Dictionary(optionslist, signature='ss')
|
||||||
|
if OPTIONS.new_tab:
|
||||||
|
dbg('Requesting a new tab')
|
||||||
|
ipc.new_tab(optionslist)
|
||||||
|
else:
|
||||||
|
dbg('Requesting a new window')
|
||||||
ipc.new_window(optionslist)
|
ipc.new_window(optionslist)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -69,6 +69,15 @@ class DBusService(Borg, dbus.service.Object):
|
||||||
self.terminator.create_layout(oldopts.layout)
|
self.terminator.create_layout(oldopts.layout)
|
||||||
self.terminator.layout_done()
|
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)
|
@dbus.service.method(BUS_NAME)
|
||||||
def terminal_hsplit(self, uuid=None):
|
def terminal_hsplit(self, uuid=None):
|
||||||
|
@ -132,6 +141,11 @@ def new_window(session, options):
|
||||||
"""Call the dbus method to open a new window"""
|
"""Call the dbus method to open a new window"""
|
||||||
session.new_window(options)
|
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
|
@with_proxy
|
||||||
def terminal_hsplit(session, uuid):
|
def terminal_hsplit(session, uuid):
|
||||||
"""Call the dbus method to horizontally split a terminal"""
|
"""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'))
|
help=_('Comma separated list of classes to limit debugging to'))
|
||||||
parser.add_option('--debug-methods', action='store', dest='debug_methods',
|
parser.add_option('--debug-methods', action='store', dest='debug_methods',
|
||||||
help=_('Comma separated list of methods to limit debugging to'))
|
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',
|
for item in ['--sm-client-id', '--sm-config-prefix', '--screen', '-n',
|
||||||
'--no-gconf' ]:
|
'--no-gconf' ]:
|
||||||
parser.add_option(item, dest='dummy', action='store',
|
parser.add_option(item, dest='dummy', action='store',
|
||||||
|
|
|
@ -104,6 +104,10 @@ class Terminator(Borg):
|
||||||
dbg('session manager asked us to die')
|
dbg('session manager asked us to die')
|
||||||
# FIXME: Implement this
|
# FIXME: Implement this
|
||||||
|
|
||||||
|
def get_windows(self):
|
||||||
|
"""Return a list of windows"""
|
||||||
|
return self.windows
|
||||||
|
|
||||||
def register_window(self, window):
|
def register_window(self, window):
|
||||||
"""Register a new window widget"""
|
"""Register a new window widget"""
|
||||||
if window not in self.windows:
|
if window not in self.windows:
|
||||||
|
|
|
@ -262,7 +262,7 @@ class Window(Container, gtk.Window):
|
||||||
if not self.is_child_notebook():
|
if not self.is_child_notebook():
|
||||||
dbg('Making a new Notebook')
|
dbg('Making a new Notebook')
|
||||||
notebook = maker.make('Notebook', window=self)
|
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):
|
def on_delete_event(self, window, event, data=None):
|
||||||
"""Handle a window close request"""
|
"""Handle a window close request"""
|
||||||
|
|
Loading…
Reference in New Issue