From 98522f50567cd4b562eca0fc7d9052b7e42c029c Mon Sep 17 00:00:00 2001 From: thek4n Date: Wed, 15 Apr 2026 13:46:07 +0300 Subject: [PATCH] refactor lock-telegram.sh script --- home/user/.config/sway/scripts/lock-telegram.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/home/user/.config/sway/scripts/lock-telegram.sh b/home/user/.config/sway/scripts/lock-telegram.sh index 4a987fb..1c49922 100755 --- a/home/user/.config/sway/scripts/lock-telegram.sh +++ b/home/user/.config/sway/scripts/lock-telegram.sh @@ -1,9 +1,16 @@ #!/bin/bash -TELEGRAM_WINDOW=$(swaymsg -t get_tree | jq -r '.. | select(.app_id? == "org.telegram.desktop") | .id' | head -n 1) +TELEGRAM_WINDOW="$( + swaymsg -t get_tree | \ + jq -r '.. | select(.app_id? == "org.telegram.desktop") | .id' | \ + head -n 1 +)" + +readonly TELEGRAM_WINDOW + if [ -z "${TELEGRAM_WINDOW}" ]; then - echo "Telegram_not_found!" + echo "Error: Telegram not found" exit 0 fi