Skip to content

daksh-xyz/DisplayProfileSwitcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Display Profile Switcher

or DPS


WHAT IT DOES:

Well basically, "toggles" HDR and then changes screen resolution depending on power state
for example:

  1. 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
  2. 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

HOW TO GET IT TO WORK?

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:

  1. Launch Task Scheduler

  2. Click on create a Task

  3. Enter a custom name for your task

  4. Go to Actions tab on the top,

  5. Click on New on the bottom left

  6. 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

  7. In the  "Add arguments"  field enter the name of the file in this case:
    main.py

  8. In the  "Start In"  field enter the PATH of the FOLDER where  "main.py"  is present

  9. UNCHECK ALL CONDITIONS from  "conditions"  tab to prevent any errors.

  10. SETTING A TRIGGER TO EXECUTE A FILE

            THIS IS A LAGGY PART!

  1. Click on TRIGGERS tab
  2. Click on New
  3. 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" 

ET VOILA IT SHOULD NOW WORK WHEN YOU PLUG IN YOUR LAPTOP (OR PLUG IT OUT)



THOUGHT BEHIND PROJECT:

  1. Mainly because I'm lazy and don't want to do this task again and again
  2. 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 .
  3. Plus I'm bored


FUTURE ASPECTS:

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:

  1. Control Fan speed (I do know how tho but, psutil does not support fan sensors for windows yet, so. . . . . . . . bummer)
  2. 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



BONUS FEATURE:

Rings an alarm for 4 seconds when battery is fully charged

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published