x11-autoclicker/toggler.sh

26 lines
686 B
Bash
Raw Normal View History

2024-01-18 06:52:05 +01:00
#!/bin/bash
cmd="$(which xdotool)"
# TODO: improve error handling
# cmd="/usr/local/bin/xdotool"
2024-01-18 13:17:14 +01:00
# Test comment
2024-01-18 06:52:05 +01:00
if test -e "$cmd"; then
echo "[+] xdotool exists, continuing the script!"
else
echo "[-] xdotool doesn't exist, this script won't run on your computer!"
notify-send "xdotool doesn't exist, this script won't run on your computer!" &
2024-01-18 06:52:05 +01:00
exit 2
fi
if pidof -x clicks.sh > /dev/null; then
echo "Autoclicker is active, deactivating"
notify-send "Autoclicker is active, deactivating" &
2024-01-18 06:52:05 +01:00
kill $(pidof -x clicks.sh)
else
echo "Autoclicker isn't active, activating"
notify-send "Autoclicker isn't active, activating" &
$(find ~ -name 'clicks.sh' | head -n1) &
2024-01-18 06:52:05 +01:00
fi