Cannot send keycodes like <Space> or <Semicolon>
Szymon-Wrzos opened this issue · 1 comments
Using zsh, I'm trying to create mp_attach alias, that will launch zsh in proc and send provided command
Example of usage:
"mp_attach uvicorn main:app"
It need to be launched in zsh as I have set up automatic launching of venv
zsh -c doesn't do the trick
When it comes to space and semicolon, it throws an error: Error: Wrong key code: "Space"
and Error: Wrong key code: "Semicolon"
respectively
Usual < > and <:> causes similar error as well
Code:
function mp_attach() {
command="$@"
parts=(${(s[])command})
mprocs --ctl "{c: add-proc, cmd: zsh" --server localhost:4050
for char in $parts; do
echo $char
if [[ $char == ' ' ]]; then
mprocs --ctl "{c: send-key, key: <Space>}" --server localhost:4050
elif [[ $char == ':' ]]; then
mprocs --ctl "{c: send-key, key: <Semicolon>}" --server localhost:4050
else
mprocs --ctl "{c: send-key, key: <$char>}" --server localhost:4050
fi
done
mprocs --ctl "{c: send-key, key: <Enter>}" --server localhost:4050
}
For 'add-proc' I launch zsh and the rest of commands are ignored
Thank you for a very detailed explanation. Unfortunately, currently it's impossible to send these keys. I just added most basic keys and never describes the rest of the keys.
I will add more keys in the next version, or feel free to send a PR.