Automatic switch of power modes

Is there any way hot to automatic switch from high power and to power saving(or from 165hz to 60) when plugging and unplugging from the charger on fedora?

It’s probably better to use VRR for the panel than explicitly changing the refresh rate.

PPD 0.21 already responds to unplugging the charger and effectively makes changes both to EPP and coefficients used for cTDP.