I've found how to hibernate on power button press with logind:
But can I make it somehow execute something like
# pm-hibernate || shutdown -h
No, you can't make that setup using
HandlePowerKey entry for
systemd. It is not a script hook, just a predefined options.
HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=, HandleLidSwitchDocked=
Controls whether logind shall handle the system power and sleep keys and the lid switch to trigger actions such as system power-off or suspend. Can be one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep", and "lock". If "ignore", logind will never handle these keys. If "lock", all running sessions will be screen-locked; otherwise, the specified action will be taken in the respective event. Only input devices with the "power-switch" udev tag will be watched for key/lid switch events. HandlePowerKey= defaults to "poweroff". HandleSuspendKey= and HandleLidSwitch= default to "suspend". HandleLidSwitchDocked= defaults to "ignore". HandleHibernateKey= defaults to "hibernate". If the system is inserted in a docking station, or if more than one display is connected, the action specified by HandleLidSwitchDocked= occurs; otherwise the HandleLidSwitch= action occurs.
One way that may work, set it to
ignore then setup a poweroff key hook through
/etc/acpi/events/ as explained in What code is executed when headphones are disconnected? ( It's your question, right :) )