added telegram lock/unlock script
This commit is contained in:
parent
7192a961e9
commit
1c9b6cd94a
31
scripts/tginput.sh
Executable file
31
scripts/tginput.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
get_tg_window_id(){
|
||||
tg_window_id=$(wmctrl -lx | grep telegram-desktop | awk '{print $1}')
|
||||
}
|
||||
|
||||
get_mouse_location(){
|
||||
mouse_xy=$(xdotool getmouselocation --shell)
|
||||
mouse_x=$(printf "%s\n" "$mouse_xy" | grep X= | cut -d= -f2)
|
||||
mouse_y=$(printf "%s\n" "$mouse_xy" | grep Y= | cut -d= -f2)
|
||||
}
|
||||
|
||||
return_mouse(){
|
||||
xdotool mousemove $mouse_x $mouse_y
|
||||
}
|
||||
|
||||
if [ "$1" == "lock" ]; then
|
||||
get_tg_window_id
|
||||
get_mouse_location
|
||||
xdotool windowactivate --sync $tg_window_id key ctrl+l
|
||||
return_mouse
|
||||
elif [ "$1" == "unlock" ]; then
|
||||
get_tg_window_id
|
||||
get_mouse_location
|
||||
tgpin=$(cat ~/.local/.tgpin.txt)
|
||||
xdotool windowactivate --sync $tg_window_id key $tgpin Return
|
||||
return_mouse
|
||||
else
|
||||
echo "Invalid argument. Please use 'lock' or 'unlock'."
|
||||
exit 1
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user