commit 35491679b82b57c9212fe2bdcdf0e100ea02bdbd Author: Walker Waylon Scott Date: Tue Nov 22 23:33:54 2016 -0600 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b759c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/build +/dist +*.egg-info +*.idea \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..b778b0d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..11b401e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/stodle.iml b/.idea/stodle.iml new file mode 100644 index 0000000..6f63a63 --- /dev/null +++ b/.idea/stodle.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..4a5a58d --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,401 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1479877347758 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..be666da --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +**Stodle** + +Python module to keep windows running + +Installation from cmd line +``` +git clone https://github.com/WaylonWalker/stodle.git +cd ./stodle +python setup.py install +``` \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..397a050 --- /dev/null +++ b/setup.py @@ -0,0 +1,20 @@ +from setuptools import setup, find_packages + +with open('requirements.txt') as f: + required = f.read().splitlines() + +with open('README.md') as f: + long_description = f.read() + +setup( + name='stodle', + version='0.0.1', + long_description=long_description, + packages=find_packages(), + url='https://github.com/WaylonWalker/stodle', + license='MIT', + author='Waylon Walker', + author_email='quadmx08@gmail.com', + description='Stop Idle for windows', + install_requires=required, +) diff --git a/stodle.py b/stodle.py new file mode 100644 index 0000000..449dca9 --- /dev/null +++ b/stodle.py @@ -0,0 +1,28 @@ +""" +stodle + +small module to keep windows running +""" + +from win32api import GetTickCount, GetLastInputInfo +from ctypes import windll + + +def stop_idle(seconds=1, debug=False, debug_statement='user inactive'): + """ + Detects idle and creates a mouse event to keep windows running + + :param seconds: numeric - time in seconds before making an event + :param debug: bool - if true prints the print statement + :param print_statement: statement to print when user is idle + """ + + last_input = (GetTickCount() - GetLastInputInfo()) / 1000 + if last_input >= seconds: + if debug: + print(debug_statement) + windll.user32.mouse_event(1, 1, 1, 0, 0) + +if __name__ == '__main__': + while True: + stop_idle(debug=True) \ No newline at end of file