#!/bin/bash

if [ "$1" -eq "1" ]; then
	sed -i ':a;N;$!ba;s/\n#CPU_MIN_PERF_ON_AC=10/\nCPU_MIN_PERF_ON_AC=10/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\n#CPU_MAX_PERF_ON_AC=100/\nCPU_MAX_PERF_ON_AC=100/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\n#CPU_MIN_PERF_ON_BAT=13/\nCPU_MIN_PERF_ON_BAT=13/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\n#CPU_MAX_PERF_ON_BAT=33/\nCPU_MAX_PERF_ON_BAT=33/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\n#CPU_BOOST_ON_AC=1/\nCPU_BOOST_ON_AC=1/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\n#CPU_BOOST_ON_BAT=0/\nCPU_BOOST_ON_BAT=0/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\n#CPU_HWP_ON_AC=balance_performance/\nCPU_HWP_ON_AC=balance_performance/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\n#CPU_HWP_ON_BAT=power/\nCPU_HWP_ON_BAT=power/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\n#ENERGY_PERF_POLICY_ON_AC=balance-performance/\nENERGY_PERF_POLICY_ON_AC=balance-performance/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\n#ENERGY_PERF_POLICY_ON_BAT=power/\nENERGY_PERF_POLICY_ON_BAT=power/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\n#SCHED_POWERSAVE_ON_AC=0/\nSCHED_POWERSAVE_ON_AC=0/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\n#SCHED_POWERSAVE_ON_BAT=1/\nSCHED_POWERSAVE_ON_BAT=1/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
elif [ "$1" -eq "0" ]; then
	sed -i ':a;N;$!ba;s/\nCPU_MIN_PERF_ON_AC=1/\n#CPU_MIN_PERF_ON_AC=1/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\nCPU_MAX_PERF_ON_AC=100/\n#CPU_MAX_PERF_ON_AC=100/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\nCPU_MIN_PERF_ON_BAT=13/\n#CPU_MIN_PERF_ON_BAT=13/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\nCPU_MAX_PERF_ON_BAT=33/\n#CPU_MAX_PERF_ON_BAT=33/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\nCPU_BOOST_ON_AC=1/\n#CPU_BOOST_ON_AC=1/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\nCPU_BOOST_ON_BAT=0/\n#CPU_BOOST_ON_BAT=0/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\nCPU_HWP_ON_AC=balance_performance/\n#CPU_HWP_ON_AC=balance_performance/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\nCPU_HWP_ON_BAT=power/\n#CPU_HWP_ON_BAT=power/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\nENERGY_PERF_POLICY_ON_AC=balance-performance/\n#ENERGY_PERF_POLICY_ON_AC=balance-performance/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\nENERGY_PERF_POLICY_ON_BAT=power/\n#ENERGY_PERF_POLICY_ON_BAT=power/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\nSCHED_POWERSAVE_ON_AC=0/\n#SCHED_POWERSAVE_ON_AC=0/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
	sed -i ':a;N;$!ba;s/\nSCHED_POWERSAVE_ON_BAT=1/\n#SCHED_POWERSAVE_ON_BAT=1/g' ~/.config/slimbookbattery/custom/ahorrodeenergia
fi
