commit 35e30552fdc1c6a4666a270791f1a1e77257615a Author: Kameron Kenny Date: Thu Jan 9 10:01:52 2025 -0500 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/README.md b/README.md new file mode 100644 index 0000000..6ecded6 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Wiggly diff --git a/main.py b/main.py new file mode 100755 index 0000000..8063869 --- /dev/null +++ b/main.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +import pyautogui +import threading +import datetime +from random import randint +import subprocess + +time_between_moves = 5.0 # How long between each move (in seconds) +move_duration = 1 # How long a move to the next coordinate should take (in seconds) + +screenSize = pyautogui.size() + +def get_idle_time(): + """Gets the idle time of the current user in seconds.""" + + output = subprocess.check_output( + "ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print int($NF/1000000000)}'", + shell=True, + text=True + ) + return int(output) + +def rand_x(): + return randint(1, screenSize[0]) + +def rand_y(): + return randint(1, screenSize[1]) + +def moveMouse(): + x = rand_x() + y = rand_y() + pyautogui.moveTo(x, y, duration = move_duration) + main() + +#def clickMouse(): +# pyautogui.click() +# main() + +def doNothing(): + main() + +def main(): + hour = datetime.datetime.now().hour + idle_time_seconds = get_idle_time() + print(f"Idle time: {idle_time_seconds} seconds") + + if hour == 18: + print("end of day reached") + quit() + elif idle_time_seconds >= 15: + threading.Timer(time_between_moves, moveMouse).start() +# threading.Timer(10.0, clickMouse).start() + else: + threading.Timer(time_between_moves, doNothing).start() + +main() + + + + +