ReimuNotMoe / ydotool

Generic command-line automation tool (no X!)
GNU Affero General Public License v3.0
1.52k stars 81 forks source link

need a button to stop ydotool #258

Open Vaisakhkm2625 opened 1 week ago

Vaisakhkm2625 commented 1 week ago

is it possible add a emergcy stop option to ydotool?

currently i am using a script, that pkills ydotool (but not ydotoold), if something goes wrong.. i bind it to win+ctrl+v, which can type from clipboard, then if something goes wrong, press same to stop..

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p wl-clipboard procps ydotool notify-send

TEMP_FILE="/tmp/cliptype"

if ! pgrep -x "ydotoold" >/dev/null; then
    notify-send "ydotoold not running" -t 500
    exit 1
fi

if [ -e "$TEMP_FILE" ]; then
    rm /tmp/cliptype
    notify-send "stopping" -t 500
    pkill -x ydotool
    exit
fi

sleep 5
wl-paste >/tmp/cliptype
ydotool type -f /tmp/cliptype -d 40
rm /tmp/cliptype

the issues is, by the time i press win+ctrl, script would have pressed some other buttons... and by the time i am able to stop it, it would have opened 10 terminals and would have sent cryptic message summoning ancient spirits to my manager on Microsoft teams...

it would be nice to have a option in that can stop ydotool while tying, something like esc... like

ydotool type -f file.txt -k 27 # for key code for esc

if it doesn't come under ydotool, is there any work around in script that i can use?

Vaisakhkm2625 commented 1 week ago

for now i just binded XF86Calculator key to pkill ydotool in hyprland... but it would be great if there was a inbuilt option

bind = SUPER, code:148, exec, pkill -x ydotool