From b732d846b0e0876a69897b51fd53f05ed5badd9b Mon Sep 17 00:00:00 2001 From: inigoortega Date: Thu, 10 Oct 2019 23:08:19 +0200 Subject: [PATCH] 200 loops just in case --- scripts/telegram-reply.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/telegram-reply.sh b/scripts/telegram-reply.sh index d4d58cb..c6eabd0 100644 --- a/scripts/telegram-reply.sh +++ b/scripts/telegram-reply.sh @@ -15,18 +15,19 @@ get_window_id () { } telegram-desktop -xdotool key alt+7 telegram_id="$(pgrep Telegram)" window_id="$(get_window_id "$telegram_id")" - -while true +i=0 +while [ "$i" -lt 200 ] do correct="$(xprop -id "$window_id" | grep "window state: Normal")" - [ -n "$correct" ] && break + [ -n "$correct" ] && break || i="$(( $i + 1))" done -xdotool key Return +if [ "$i" -lt 200 ]; then + xdotool key alt+7 && xdotool key Return +fi