Replies: 2 comments 2 replies
-
you cannot do this in shell script. Write a proper program and read the
response from the terminal device.
|
Beta Was this translation helpful? Give feedback.
2 replies
-
zsh can read output character by character, which is probably not that efficient but good enough. Here is an example: read_kitty_response() {
# Read the string like:
# <ESC>_Gi=31;error message or OK<ESC>\
escapes=0
response=""
while [ $escapes -lt 2 ]
do
read -r -s -k nextchar
if [ "$nextchar" = $'\e' ]
then
escapes=$((escapes + 1))
else
response="$response$nextchar"
fi
done
read -r -s -k nextchar # final backslash
echo "$response"
}
# Replace with the desired Kitty command
echo -n "${TERM_ESC}_Gi=123,f=100,t=f,a=T;$path_encoded$TERM_ESC\\"
echo "Kitty response is: $(read_kitty_response)" This works for me in zsh (it has -k for read); for bash try |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For now it looks like everything is going into stdin from kitty's output, but when I do something like
This doesn't work.
Beta Was this translation helpful? Give feedback.
All reactions