How to disable the power button when using elogind
My son, who’s currently two years old, loves to press the big shiny button on my computer case. The button, which happens to be the power button, is surrounded with a glowing blue ring, which probably makes it even more irresistible for a kid in his age.
I first tried to cover it with a piece of paper and some tape, but that didn’t work. It probably just made it more annoying for both of us. My second idea was a success though. I was able to disable it in the operating system itself. It took me a few tries (read: reboots), before I figured it out though.
I was trying to solve it via acpid, but I never got it to work. It turns out that if you use elogind, it will steal the power button input and shutdown the computer no matter what. Thank you Zucca on Gentoo forums for that piece of valuable knowledge.
HandlePowerKey=ignore to the
[Login]-section in the file
/etc/elogind/logind.conf. I then restarted elogind using the command
# rc-config restart elogind. Zucca wrote that it would restart your session, but it didn’t for me. I don’t know if I had to or not, but I manually logged out and back in again, just in case.
And that’s all. When my son is now pressing the power button on my computer case, it does absolutely nothing! I’m happy, and my son is happy!