I want to run two different scripts whenever I plug in or out my laptop.
How can I know when the computer is plugged in or out?
Is there a program that already does that?
I think you can do this with acpi, but I don't know the details.
install acpid, and look at /etc/acpid. I think there's some example scripts there, or at least something you can work with.