diff --git a/.gitignore b/.gitignore index 4c156ad..7f16989 100644 --- a/.gitignore +++ b/.gitignore @@ -1,106 +1,106 @@ -__pycache__ -*.py[cod] -*$py.class - -# Distribution / packaging -.Python build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg -*.manifest -*.spec - -# Log files -pip-log.txt -pip-delete-this-directory.txt -*.log - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -.pytest_cache/ -nosetests.xml -coverage.xml -*.cover -.hypothesis/ - -# Translations -*.mo -*.pot - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pyflow -__pypackages__/ - -# Environment -.env -.venv -env/ -venv/ -ENV/ - -# If you are using PyCharm # -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/dictionaries -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.xml -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/gradle.xml -.idea/**/libraries -*.iws /out/ - -# Sublime Text -*.tmlanguage.cache -*.tmPreferences.cache -*.stTheme.cache -*.sublime-workspace -*.sublime-project - -# sftp configuration file -sftp-config.json - -# Package control specific files Package -Control.last-run -Control.ca-list -Control.ca-bundle -Control.system-ca-bundle -GitHub.sublime-settings - -# Visual Studio Code # -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json +__pycache__ +*.py[cod] +*$py.class + +# Distribution / packaging +.Python build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +*.manifest +*.spec + +# Log files +pip-log.txt +pip-delete-this-directory.txt +*.log + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +.pytest_cache/ +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pyflow +__pypackages__/ + +# Environment +.env +.venv +env/ +venv/ +ENV/ + +# If you are using PyCharm # +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/gradle.xml +.idea/**/libraries +*.iws /out/ + +# Sublime Text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project + +# sftp configuration file +sftp-config.json + +# Package control specific files Package +Control.last-run +Control.ca-list +Control.ca-bundle +Control.system-ca-bundle +GitHub.sublime-settings + +# Visual Studio Code # +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json .history \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 4bdb75d..f2aee78 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,16 +1,16 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Python: Current File", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "integratedTerminal", - "args": ["vmmem"] - } - ] +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "args": ["vmmem"] + } + ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 2a536ff..ea8d04d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ -{ - "python.testing.promptToConfigure": false, - "python.testing.pytestEnabled": false, - "python.testing.unittestEnabled": false, - "python.testing.nosetestsEnabled": false, - "python.pythonPath": ".venv\\Scripts\\python.exe" +{ + "python.testing.promptToConfigure": false, + "python.testing.pytestEnabled": false, + "python.testing.unittestEnabled": false, + "python.testing.nosetestsEnabled": false, + "python.pythonPath": ".venv\\Scripts\\python.exe" } \ No newline at end of file diff --git a/README.md b/README.md index 984d2a2..afe46a4 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,25 @@ -# Task Killer # - -## Introduction ## -This project was inspired as a workaround for terminating the `vmmem` process at a regular interval in order to prevent it from interrupting unrelated workflows. The gist is that when working under WSL, the Linux side of the house attempts to take dominion of instance memory it doesn't necessarily need. This presents a problem when doing things that are memory intensive. When this happens, the memory is no longer available to Windows, but it's exposed via the `vmmem` task in Task Manager. Unfortunately, this task cannot be shutdown from Windows as its technically not owned by Windows, but it CAN be shutdown via the `wsl --shutdown` command in the terminal. Enter **Task Killer**, the solution that allows for automating this shutdown task, along with any standard task you just want killed when other programs are running. Simply put, when Task Killer finds a defined, no longer needed program running against a list of other programs, it kills it. In addition, this can be automated with the Windows Task Scheduler and the included batch file. - - -## Prerequisites ## -- Python 3 -- Windows -## Getting Started ## - -- Define what programs you want evaluated by editing the `PROGRAMS_LIST` in the `constants.py` file. A sample list is left there for reference. -- In the root of the project create a Python virtual environment in a directory named `.venv` by pasting the command in the terminal: - ``` python -m venv .venv ``` -- Install dependencies by running: - ``` pip install -r requirements.txt``` - -- Run the file in the terminal and pass the process you want terminated as an argument: -``` python task_killer.py ``` - - - - - - +# Task Killer # + +## Introduction ## +This project was inspired as a workaround for terminating the `vmmem` process at a regular interval in order to prevent it from interrupting unrelated workflows. The gist is that when working under WSL, the Linux side of the house attempts to take dominion of instance memory it doesn't necessarily need. This presents a problem when doing things that are memory intensive. When this happens, the memory is no longer available to Windows, but it's exposed via the `vmmem` task in Task Manager. Unfortunately, this task cannot be shutdown from Windows as its technically not owned by Windows, but it CAN be shutdown via the `wsl --shutdown` command in the terminal. Enter **Task Killer**, the solution that allows for automating this shutdown task, along with any standard task you just want killed when other programs are running. Simply put, when Task Killer finds a defined, no longer needed program running against a list of other programs, it kills it. In addition, this can be automated with the Windows Task Scheduler and the included batch file. + + +## Prerequisites ## +- Python 3 +- Windows +## Getting Started ## + +- Define what programs you want evaluated by editing the `PROGRAMS_LIST` in the `constants.py` file. A sample list is left there for reference. +- In the root of the project create a Python virtual environment in a directory named `.venv` by pasting the command in the terminal: + ``` python -m venv .venv ``` +- Install dependencies by running: + ``` pip install -r requirements.txt``` + +- Run the file in the terminal and pass the process you want terminated as an argument: +``` python task_killer.py ``` + + + + + + diff --git a/constants.py b/constants.py index b798c76..92e01bf 100644 --- a/constants.py +++ b/constants.py @@ -1,3 +1,3 @@ -#!/usr/bin/env python - -PROGRAMS_LIST = ["Overwatch.exe", "r5apex.exe", "GameOverlayUI.exe", "starwarsbattlefrontii.exe"] \ No newline at end of file +#!/usr/bin/env python + +PROGRAMS_LIST = ["Hades.exe","Overwatch.exe", "r5apex.exe", "GameOverlayUI.exe", "starwarsbattlefrontii.exe"] \ No newline at end of file