there's a way to change the system settings "energy saving" options from a script?

i want to change the option “When lid closed” from a script, there’s a why to do it?

ok, i’m going to write a script to change .config/powerdevilrc directly, not sure how safe is todo it, but if my system blow-up someday i’ll update this post lol