Skip to main content

Keeps the screen awake by moving the mouse randomly

Project description

Stimulant

Keeps the screen awake by moving the mouse randomly.

Description

Stimulant is intended to be used as a cli tool or imported to another python project.

If used as a cli tool or with importing stimulant(), Stimulant will move the mouse for the specified runtime. While under the runtime the mouse will move to a random location on the screen. This process will repeat at random intervals. The movement of the mouse is achieved using the pyautogui library. Pyautogui's duration and tweening parameters allow for more natural mouse movement patterns across the screen. To terminate Stimulant, simply press any key on the keyboard.

For more granular control over the logic, the Stimulant class can be imported. The class, along with its public methods, allows for customized use cases to be implemented. An example may be to have the mouse move for an unknown duration of time that would be determined by another process.

Installation

  1. Have Python 3.12+ installed (may work with older versions of python)

  2. Execute the following command in your console

pip install stimulant

# or install from git repo
pip install git+https://github.com/sidganti/stimulant.git

Documentation

CLI

Run indefinitely

stim

Run for a specified time in seconds

Limited to one day aka 86,400 seconds.

If 0 is given as an argument then Stimulant will run indefinitely.

stim <0-86400>

or

stim -t <0-86400>

or

stim --time <0-86400>

Hotcorner protection

Pass the flag to prevent triggering hotcorners enabled on your device.

stim -c

or

stim --corners

End Stimulant manually

Press any key on the keyboard.

In case something pressing any single key went wrong, you have two options. Use you operating systems preferred termination signal: ctrl+c on Mac/Linux or ctrl+z on Windows. Since pyautogui's failsafe option is enabled you can also drag your mouse to the top left corner of the screen to terminate.

Help

Provides detail on CLI's usage.

stim -h

or

stim --help

Version

Prints the version of Stimulant

stim -V

or

stim --version

stimulant() function

Functions nearly identical to the CLI. The CLI is essentially a wrapper for the stimulant() function.

# recommended individual import
from stimulant import stimulant

# recommended module import
import stimulant as stim
# stimulant function definition
def stimulant(runtime: int = 0, hotcorners: bool = False) -> None:
  • runtime
    • duration the instance should run
    • if 0 is passed in to the function then stimulant will run indefinitely
  • hotcorners
    • prevents mouse from reaching the edges of the screen
# example function call
stimulant(600, True)

Stimulant class

Encapsulates all of the data and logic required to move the mouse for a specified duration of time.

# recommended individual import
from stimulant import Stimulant

# recommended module import
import stimulant as stim
# Stimulant class constructor definition
def __init__(self, runtime: int = 0, hotcorners: bool = False, animate: bool = True) -> None:
  • runtime
    • duration the instance should run
  • hotcorners
    • prevents mouse from touching the edges of the screen
  • animate
    • flag to determine write to console
# example instantiation
stim = Stimulant(600, True)

start() method

Starts logic to run Stimulant for a specified duration.

# start method definition
def start(self):
# example call
stim.start()

run() method

Alias for the start() method

# run method definition
def run(self):
# example call
stim.run()

move_mouse() method

Moves the mouse to a random position on the screen for a random duration. Also takes advantage of pyautogui's tweening functions to make mouse movement more natural.

# move_mouse method definition
def move_mouse(self) -> None:
# example call
stim.move_mouse()

stop() method

Safely terminates Stimulant instance

# stop method definition
def stop(self) -> None:
# example call
stim.stop()

Future

  • Improve threading to allow exception handling and safer thread termination
  • Allow access to more variables to cli and class/function calls
  • Ability to kill stimulant via callback function

License

LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stimulant-1.0.0.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

stimulant-1.0.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file stimulant-1.0.0.tar.gz.

File metadata

  • Download URL: stimulant-1.0.0.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for stimulant-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cdd7a1602e31599c943595c0b6b5bde4e64eac85f1853b51f91a3a4a7a2390e0
MD5 8e898e77fc4b77d39dd8abaab35f8a75
BLAKE2b-256 737bef529a94accd80181de90795e3351bec5604787a606c3892bdf968c89244

See more details on using hashes here.

Provenance

File details

Details for the file stimulant-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: stimulant-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for stimulant-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d389ef1626e59e132fcfc359586b854d7b160dfc1c0239f5c352040b3eb77805
MD5 1ec3020dcb6058414990572dfa524842
BLAKE2b-256 06f4ec918317524e8b707a551ca3e761db273f493f906a3aa3415f1079649d94

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page