Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ Default timer is 3 minutes, but can be 1 or more.

# Dependencies
This software uses PyAutoGui https://github.com/asweigart/pyautogui as the driver behind the movement.
In addition, screeninfo is needed https://pypi.org/project/screeninfo/ to determine primary monitor resolution.
> Optional- Create Virtual Env Step: ``` python3 -m venv ./StayAwake ```
> ``` pip install -r requirements.txt ```
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pyautogui

screeninfo
49 changes: 37 additions & 12 deletions src/awake.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,45 @@
import time
import sys
from datetime import datetime
from screeninfo import get_monitors
pyautogui.FAILSAFE = False
numMin = None
if ((len(sys.argv)<2) or sys.argv[1].isalpha() or int(sys.argv[1])<1):
xDirection = 0
aspectRatio = 0

if ((len(sys.argv) <2) or sys.argv[1].isalpha() or int(sys.argv[1])<1):
numMin = 3
else:
numMin = int(sys.argv[1])
while(True):
x=0
while(x<numMin):
time.sleep(60)
x+=1
for i in range(0,200):
pyautogui.moveTo(0,i*4)
pyautogui.moveTo(1,1)
for i in range(0,3):
pyautogui.press("shift")
print("Movement made at {}".format(datetime.now().time()))

if ((len(sys.argv) < 3) or sys.argv[2].isalpha() or int(sys.argv[1] <0)):
xDirection = 0
else:
xDirection = abs(int(sys.argv[2]))


def determineAspectRatio():
monitors = get_monitors()
primaryMonitor = None
for monitor in monitors:
if (monitor.is_primary):
primaryMonitor = monitor
return primaryMonitor.width/primaryMonitor.height

def move():
while(True):
x=0
while(x<numMin):
x+=1
for i in range(0,200):
pyautogui.moveTo(((xDirection+i)*aspectRatio),240+(i*aspectRatio))
print(str(pyautogui.position()))
pyautogui.moveTo(1,1)
for i in range(0,3):
pyautogui.press("shift")
print("Movement made at {}".format(datetime.now().time()))
time.sleep(60)


aspectRatio = determineAspectRatio()
move()