Runs commands when system button/switch states trigger.
Run as root or user that has sufficient access to inputs and is suitable for running the intended commands:
switchd \ power_button poweroff \ lid_closed pm-suspend \ dock_attached "echo 'wait where did that come from'"
It exits whenever devices disappear, and expects to be restarted when it happens. Dynamic reconfiguration wasn't worth the hassle.
Go to #kennylevinsen @ irc.libera.chat to discuss, or use ~email@example.com.