refactor lock-telegram.sh script

This commit is contained in:
thek4n 2026-04-15 13:46:07 +03:00
parent e3a9e470f5
commit 98522f5056

View File

@ -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