diff --git a/lib/layout-helpers.sh b/lib/layout-helpers.sh index 3886733..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,13 +78,8 @@ 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" "C-m" + send_keys "$1" "$2" + send_keys "C-m" "$2" } # Cusomize session root path. Default is `$HOME`. 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" 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