Skip to content

Commit

Permalink
add parameters to remotinator split commands
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrose committed Jul 25, 2021
1 parent 045e8f5 commit 97c582c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
6 changes: 6 additions & 0 deletions remotinator
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,15 @@ if __name__ == '__main__':
parser.add_argument('-p', '--profile', dest='profile', type=str, default=argparse.SUPPRESS,
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!",
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))

options = vars(parser.parse_args()) # Straight to dict
Expand Down
22 changes: 16 additions & 6 deletions terminatorlib/ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,24 @@ def new_tab(self, uuid=None):
return self.new_terminal(uuid, 'tab')

@dbus.service.method(BUS_NAME)
def hsplit(self, uuid=None):
def hsplit(self, uuid=None,options=None):
"""Split a terminal horizontally, by UUID"""
return self.new_terminal(uuid, 'hsplit')
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')

@dbus.service.method(BUS_NAME)
def vsplit(self, uuid=None):
def vsplit(self, uuid=None,options=None):
"""Split a terminal vertically, by UUID"""
return self.new_terminal(uuid, 'vsplit')
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')

def get_terminal_container(self, terminal, container=None):
terminator = Terminator()
Expand Down Expand Up @@ -341,12 +351,12 @@ def new_tab(session, uuid, options):
@with_proxy
def hsplit(session, uuid, options):
"""Call the dbus method to horizontally split a terminal"""
print(session.hsplit(uuid))
print(session.hsplit(uuid,options))

@with_proxy
def vsplit(session, uuid, options):
"""Call the dbus method to vertically split a terminal"""
print(session.vsplit(uuid))
print(session.vsplit(uuid,options))

@with_proxy
def vsplit_cmd(session, uuid, title, cmd, options):
Expand Down

2 comments on commit 97c582c

@TheBigS
Copy link

@TheBigS TheBigS commented on 97c582c Aug 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooo, very nice, I like this much better than having separate vsplit_cmd and hsplit_cmd, we should probably just remove those as separate dbus commands since this implements the same functionality directly into vsplit and hsplit as an option. Much simpler! Since you haven't cut a release with vsplit_cmd and hsplit_cmd in it yet, those functions are safe to remove now before you release the next version.

@mattrose
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I was going to ask you if I could repurpose yours, but I decided to just add parameters to vsplit and hsplit instead. I'll remove vsplit_cmd and hsplit_cmd.

Please sign in to comment.