On my system, the fans keep running nonstop unless it’s in power-saving mode. But using power-saving mode makes gaming and other tasks difficult, which means I have to go into the settings app, navigate around, grumble, and change it each time. It’s a lot of hassle for something I need to adjust frequently, so here’s…
A lightweight Python-based system tray application for managing power profiles on Windows. This tool allows users to quickly switch between power plans, such as "Power Saver," "Balanced," and "High Performance," directly from the system tray. It uses Windows' powercfg command to list and switch between power profiles.
pystray: For system tray icon functionality. Install via pip:
pip install pystrayPillow: For handling image icons. Install via pip:
pip install pillowClone this repository:
git clone https://github.com/neolyum/power-profile-switcher.git
cd power-profile-switcherRun the Script:
pythonw power_profile_switcher.pypowercfg commands may require elevated privileges. If you encounter issues, try running Python as an administrator.powercfg command, which may behave differently across Windows versions.Locate the Startup Folder:
Win + R to open the Run dialog.shell:startup and press Enter. This opens the Startup folder where you can place any shortcuts or applications to run on startup.Create a Shortcut to Your Python Script:
Right-click inside the Startup folder and select New > Shortcut.
For the shortcut target, enter the path to python.exe followed by the full path to your script, like so:
"C:PathToPythonpythonw.exe" "C:PathToScriptpower_profile_switcher.py"
Adjust the paths as needed based on the location of pythonw.exe and your script.
Also set this script to run in the folder of the python file.
Click Next, give the shortcut a name (e.g., "Power Profile Switcher"), and click Finish.
Test: Restart your computer or log out and log back in to ensure the application launches on startup.
.bat File in the Startup FolderIf you find that using a shortcut does not work as expected, you can create a .bat (batch) file to run your script.
Create a Batch File:
"C:PathToPythonpythonw.exe" "C:PathToScriptpower_profile_switcher.py"
.bat extension, for example, run_power_switcher.bat.Place the .bat File in the Startup Folder:
.bat file into the Startup folder (as explained in Method 1).The scale, which is the base of the icon, is from JoyPixels, Creative Commons Attribution 4.0 (CC BY 4.0)