Update: I seem to have solved the problem tweaking the udev commands as follows:
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/usr/sbin/pm-powersave true" SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/usr/sbin/pm-powersave true"
this way pm-powersave is executed every time a power source change happens, allowing the if/else statement i put in the custom script to take care of the rest.
I don't know whether this is a long-term solution, but it seems to be working so far.
Update: I seem to have solved the problem tweaking the udev commands as follows:
SUBSYSTEM= ="power_ supply" , ATTR{online}=="0", RUN+="/ usr/sbin/ pm-powersave true" ="power_ supply" , ATTR{online}=="1", RUN+="/ usr/sbin/ pm-powersave true"
SUBSYSTEM=
this way pm-powersave is executed every time a power source change happens, allowing the if/else statement i put in the custom script to take care of the rest.
I don't know whether this is a long-term solution, but it seems to be working so far.