O tmux tem send-keys
um comando muito útil. Uma propriedade desse comando é que ele "faz o que você quer" e permite, por exemplo, enviar ENTER
usando tmux send-keys
. Talvez seja um bom truque, mas me deixa nervoso para uso programático.
Existe uma maneira de especificar que as teclas estão sendo enviadas em modo "bruto", para que 'ENTER' não seja traduzido em uma nova linha?
Dei uma olhada no manual e não consegui ver nenhuma opção:
send-keys [-FHKlMRX] [-c target-client] [-N repeat-count] [-t target-pane] key ...
(alias: send)
Send a key or keys to a window or client. Each argument key is the name of the key
(such as ‘C-a’ or ‘NPage’) to send; if the string is not recognised as a key, it is sent
as a series of characters. If -K is given, keys are sent to target-client, so they are
looked up in the client's key table, rather than to target-pane. All arguments are sent
sequentially from first to last. If no keys are given and the command is bound to a
key, then that key is used.
The -l flag disables key name lookup and processes the keys as literal UTF-8 characters.
The -H flag expects each key to be a hexadecimal number for an ASCII character.
The -R flag causes the terminal state to be reset.
-M passes through a mouse event (only valid if bound to a mouse key binding, see “MOUSE
SUPPORT”).
-X is used to send a command into copy mode - see the “WINDOWS AND PANES” section. -N
specifies a repeat count and -F expands formats in arguments where appropriate.
Uma solução alternativa seria enviar cada caractere como um argumento separado para uso programático. Usei a biblioteca python tmuxp, que provavelmente resolve esse problema e fornece uma API completável. Mas gostaria de fazer isso a partir do shell.