From 5989b1f516d83cb856db0eb476ad5eb72c99331d Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 27 Jun 2012 21:39:54 +0100 Subject: [PATCH] Add send_keys layout helper --- lib/layout-helpers.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/layout-helpers.sh b/lib/layout-helpers.sh index b01bc0d..54fbc44 100644 --- a/lib/layout-helpers.sh +++ b/lib/layout-helpers.sh @@ -61,6 +61,16 @@ select_pane() { tmux select-pane -t "$session:$window.$1" } +# Send/paste keys to the currently active pane/window. +# +# Arguments: +# - $1: String to paste. +# - $2: (optional) Target pane ID to send input to. +# +send_keys() { + tmux send-keys -t "$session:$window.$2" "$1" +} + # Runs a shell command in the currently active pane/window. # # Arguments: @@ -68,8 +78,8 @@ select_pane() { # - $2: (optional) Target pane ID to run command in. # run_cmd() { - tmux send-keys -t "$session:$window.$2" "$1" - tmux send-keys -t "$session:$window.$2" "C-m" + send_keys "$1" "$2" + send_keys "C-m" "$2" } # Cusomize session root path. Default is `$HOME`.