From c777d490913d14666c958f7015996170e6d32c49 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Wed, 5 Dec 2018 23:54:37 -0700 Subject: [PATCH] Added tmux_resize_pane() --- .bin/Scripts/functions/tmux.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.bin/Scripts/functions/tmux.py b/.bin/Scripts/functions/tmux.py index 10412a8c..6726e3ff 100644 --- a/.bin/Scripts/functions/tmux.py +++ b/.bin/Scripts/functions/tmux.py @@ -16,6 +16,19 @@ def tmux_poll_pane(pane_id): panes = result.stdout.decode().splitlines() return pane_id in panes +def tmux_resize_pane(pane_id, x=None, y=None): + """Resize pane to specific hieght or width.""" + if not x and not y: + raise Exception('Neither height nor width specified.') + + cmd = ['tmux', 'resize-pane', '-t', pane_id] + if x: + cmd.extend(['-x', str(x)]) + elif y: + cmd.extend(['-y', str(y)]) + + run_program(cmd, check=False) + def tmux_split_window( lines=None, percent=None, behind=False, vertical=False,