From 012526656eb3b7000a6621f9eb753b9895cfda54 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 27 Jun 2012 21:29:29 +0100 Subject: [PATCH 1/4] Remove send-keys `-l` support check as it is not needed After some experimentation it turns out that if input to send-keys is not a known key sequence like `C-m` or `C-l` for example, it it automatically treated as literal input. Negating the need to use it and hence check if it's supported. --- lib/layout-helpers.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/layout-helpers.sh b/lib/layout-helpers.sh index 3886733..b01bc0d 100644 --- a/lib/layout-helpers.sh +++ b/lib/layout-helpers.sh @@ -68,12 +68,7 @@ select_pane() { # - $2: (optional) Target pane ID to run command in. # run_cmd() { - literal_support=$(tmux send-keys -l 2&> /dev/null ; echo $?) - if [ $literal_support -eq 0 ]; then - tmux send-keys -t "$session:$window.$2" -l "$1" - else - tmux send-keys -t "$session:$window.$2" "$1" - fi + tmux send-keys -t "$session:$window.$2" "$1" tmux send-keys -t "$session:$window.$2" "C-m" } From 5989b1f516d83cb856db0eb476ad5eb72c99331d Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 27 Jun 2012 21:39:54 +0100 Subject: [PATCH 2/4] 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`. From 1f81e98e7342a63101c0c64b6170770f6b30c262 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 27 Jun 2012 21:40:59 +0100 Subject: [PATCH 3/4] Add send_keys examples to window layout template --- templates/window.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/window.sh b/templates/window.sh index c317fd1..08639bf 100644 --- a/templates/window.sh +++ b/templates/window.sh @@ -14,5 +14,9 @@ new_window "{{WINDOW_NAME}}" #run_cmd "top" # runs in active pane #run_cmd "date" 1 # runs in pane 1 +# Paste text +#send_keys "top" # paste into active pane +#send_keys "date" 1 # paste into active pane + # Set active pane. #select_pane 0 From 6a5bf329917354bfc2f2a6ed4656847b41ef0156 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 27 Jun 2012 21:47:12 +0100 Subject: [PATCH 4/4] Bump version to 0.3.0 --- libexec/tmuxifier-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/tmuxifier-version b/libexec/tmuxifier-version index ec194b6..bde620b 100755 --- a/libexec/tmuxifier-version +++ b/libexec/tmuxifier-version @@ -2,4 +2,4 @@ set -e [ -n "$TMUXIFIER_DEBUG" ] && set -x -echo "0.2.1" +echo "0.3.0"