Skip to content

Instantly share code, notes, and snippets.

@nawanirakshit
Last active March 26, 2024 07:42
Show Gist options
  • Save nawanirakshit/f23580df6e3f50a7b7adbc2c9306be33 to your computer and use it in GitHub Desktop.
Save nawanirakshit/f23580df6e3f50a7b7adbc2c9306be33 to your computer and use it in GitHub Desktop.
Are you Lazy or Idler? Use this Python Gist to move your cursor every minute to never get logged out from your office laptop and always stay online.
import sched
import time
from pynput.mouse import Button, Controller
def do_something(scheduler):
# schedule the next call first
scheduler.enter(60, 1, do_something, (scheduler,))
# Do work here
mouse = Controller()
# Set pointer position
mouse.position = (1040, 540)
# Press and release
mouse.press(Button.left)
mouse.release(Button.left)
my_scheduler = sched.scheduler(time.time, time.sleep)
my_scheduler.enter(60, 1, do_something, (my_scheduler,))
my_scheduler.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment