Merge pull request #472 from mattrose/issue-446

add parameters to remotinator split commands
This commit is contained in:
Matt Rose 2021-07-24 22:29:26 -04:00 committed by GitHub
commit dba4734c97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 6 deletions

View File

@ -77,9 +77,15 @@ if __name__ == '__main__':
parser.add_argument('-p', '--profile', dest='profile', type=str, default=argparse.SUPPRESS, parser.add_argument('-p', '--profile', dest='profile', type=str, default=argparse.SUPPRESS,
help=_('Terminal UUID for when not in env var TERMINATOR_UUID')) help=_('Terminal UUID for when not in env var TERMINATOR_UUID'))
parser.add_argument('-x', '--execute', dest='execute', type=str, default=argparse.SUPPRESS,
help=_('Terminal UUID for when not in env var TERMINATOR_UUID'))
parser.add_argument('-t', '--tab-title', dest='tab-title', type=str, default="Missing Tab Title! Use -t argument!", parser.add_argument('-t', '--tab-title', dest='tab-title', type=str, default="Missing Tab Title! Use -t argument!",
help=_('Tab name to set. Only used with "set_tab_title" command.')) help=_('Tab name to set. Only used with "set_tab_title" command.'))
parser.add_argument('-T', '--title', dest='title', type=str, default=argparse.SUPPRESS,
help=_('Tab name to set.'))
parser.add_argument('-v', '--version', action='version', version='%%(prog)s %s' %(APP_VERSION)) parser.add_argument('-v', '--version', action='version', version='%%(prog)s %s' %(APP_VERSION))
options = vars(parser.parse_args()) # Straight to dict options = vars(parser.parse_args()) # Straight to dict

View File

@ -115,13 +115,23 @@ class DBusService(Borg, dbus.service.Object):
return self.new_terminal(uuid, 'tab') return self.new_terminal(uuid, 'tab')
@dbus.service.method(BUS_NAME) @dbus.service.method(BUS_NAME)
def hsplit(self, uuid=None): def hsplit(self, uuid=None,options=None):
"""Split a terminal horizontally, by UUID""" """Split a terminal horizontally, by UUID"""
if options:
cmd = options.get('execute')
title = options.get('title')
return self.new_terminal_cmd(uuid=uuid, title=title, cmd=cmd, split_vert=True)
else:
return self.new_terminal(uuid, 'hsplit') return self.new_terminal(uuid, 'hsplit')
@dbus.service.method(BUS_NAME) @dbus.service.method(BUS_NAME)
def vsplit(self, uuid=None): def vsplit(self, uuid=None,options=None):
"""Split a terminal vertically, by UUID""" """Split a terminal vertically, by UUID"""
if options:
cmd = options.get('execute')
title = options.get('title')
return self.new_terminal_cmd(uuid=uuid, title=title, cmd=cmd, split_vert=False)
else:
return self.new_terminal(uuid, 'vsplit') return self.new_terminal(uuid, 'vsplit')
def get_terminal_container(self, terminal, container=None): def get_terminal_container(self, terminal, container=None):
@ -341,12 +351,12 @@ def new_tab(session, uuid, options):
@with_proxy @with_proxy
def hsplit(session, uuid, options): def hsplit(session, uuid, options):
"""Call the dbus method to horizontally split a terminal""" """Call the dbus method to horizontally split a terminal"""
print(session.hsplit(uuid)) print(session.hsplit(uuid,options))
@with_proxy @with_proxy
def vsplit(session, uuid, options): def vsplit(session, uuid, options):
"""Call the dbus method to vertically split a terminal""" """Call the dbus method to vertically split a terminal"""
print(session.vsplit(uuid)) print(session.vsplit(uuid,options))
@with_proxy @with_proxy
def vsplit_cmd(session, uuid, title, cmd, options): def vsplit_cmd(session, uuid, title, cmd, options):