x11-autoclicker/toggler.sh

24 lines
652 B
Bash
Executable File

#!/bin/bash
cmd="$(which xdotool)"
# TODO: improve error handling
# cmd="/usr/local/bin/xdotool"
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!" &
exit 2
fi
if pidof -x clicks.sh > /dev/null; then
#echo "clicks is active, deactivating"
notify-send "Clicks is active, deactivating" &
kill $(pidof -x clicks.sh)
else
notify-send "Clicks isn't active, activating" &
#echo "clicks isn't active, activating"
$(find ~ -name 'clicks.sh') | head -n1 &
fi