I just wrote a simple script that looks at what charger is connected and then applies a 100% usage ectool override. By “I wrote” I mean I asked chatgpt to do it, and then tested it.
#!/bin/bash
#Get the current charge state output
output=$(sudo ectool chargestate param 2)
#Extract the first number (before the space)
current_value=$(echo “$output” | awk ‘{print $1}’)
#Check the value and run corresponding command
if [ “$current_value” -eq 10256 ]; then
# 240W PSU detected
sudo ectool chargestate param 2 12000
elif [ “$current_value” -eq 7680 ]; then
# Lower watt PSU detected
sudo ectool chargestate param 2 9000
else
# Do nothing for other values
exit 0
fi
I now have this script configured to auto-run when the laptop is plugged in. I guess I don’t need it added to framework control anymore, lol.
Note: In order to get this to run automatically, I had to do some tweaking to my suders file and the script above in order for the sudo commands to work.