diff --git a/scripts/tginput.sh b/scripts/tginput.sh index ae8d730..432c939 100755 --- a/scripts/tginput.sh +++ b/scripts/tginput.sh @@ -23,16 +23,20 @@ lock_tg(){ xdotool windowactivate --sync $tg_window_id key ctrl+l } -readpin(){ - if [[ ! -f ~/.local/.tgpin.txt ]]; then +read_passcode(){ + if [[ ! -f $HOME/.local/.tgpasscode ]]; then echo "Error: PIN file not found!" - exit 1 + echo "Enter Telegram local passcode seperated characters by space" + echo "If passcode is 1234, then enter 1 2 3 4 " + read -p "Enter passcode: " PASSCODE + echo $PASSCODE > $HOME/.local/.tgpasscode + echo Telegram Passcode saved at: $HOME/.local/.tgpasscode fi - tgpin=$(cat ~/.local/.tgpin.txt) + tgpasscode=$(cat $HOME/.local/.tgpasscode) } unlock_tg(){ - xdotool windowactivate --sync $tg_window_id key $tgpin Return + xdotool windowactivate --sync $tg_window_id key $tgpasscode Return } if [ "$1" == "lock" ]; then @@ -41,7 +45,7 @@ if [ "$1" == "lock" ]; then lock_tg return_mouse elif [ "$1" == "unlock" ]; then - readpin + read_passcode get_tg_window_id get_mouse_location unlock_tg