Well basically, "toggles" HDR and then changes screen resolution depending on power state
for example:
- On plugging into AC power the script asks user if he wants to switch display profiles if yes then:
"toggles" HDR and after a delay changes screen resolution to 2880 x 1800
otherwise:
exits console window - On switching to battery power the script asks user if he wants to switch display profiles if yes then:
"toggles" HDR and after a delay changes screen resolution to 1920 x 1200
Otherwise:
exit console window
Requires libraries listed below:
1. import psutil
2. import playsound
3. import pywintypes
4. import win32api
5. import win32con
6. import pyautogui
7. from time import sleep
Additional work required to get it to run the python script ASA charger gets plugged in.
To do that:
-
Launch Task Scheduler
-
Click on create a Task
-
Enter a custom name for your task
-
Go to Actions tab on the top,
-
Click on New on the bottom left
-
Under settings in the program/script section enter your python.exe path which would something like this:
C:\Users\UserName\AppData\Local\Programs\Python\Python310\python.exe
-
In the
"Add arguments"
field enter the name of the file in this case:
main.py
-
In the
"Start In"
field enter the PATH of the FOLDER where"main.py"
is present -
UNCHECK ALL CONDITIONS from
"conditions"
tab to prevent any errors.
THIS IS A LAGGY PART!
- Click on TRIGGERS tab
- Click on New
- In Begin a task:
Click on the drop down menu and select"ON AN EVENT"
In the log field:
scroll down to the end and select"System"
In the Source field:
scroll down to find"Kernel-Power"
In the event ID:
Enter"105"
- Mainly because I'm lazy and don't want to do this task again and again
- Also because this is my first project and it's unique cuz nobody on the internet seemed to have done this before so it is an opprtunity to upload as a first-ever project .
- Plus I'm bored
well, since I don't want to kill my brand new laptop and I don't know what some modules can do to my system I'm not implementing a feature to:
- Control Fan speed (I do know how tho but, psutil does not support fan sensors for windows yet, so. . . . . . . . bummer)
- Change refresh rate could not find a single question on stack about this + could not find a command line to change refresh rate, apparently windows does not log this and is unable to change this without installing some shady 3rd party software. . . so, not doing that either lol
NOTE :
this could all be solved by me learning and reading or getting WMI documentation but it is too long and couldn't find relevant information on reading/changing refresh rate and fan speed
Rings an alarm for 4 seconds when battery is fully charged