When using  raspberry headless, it’s convenient enough to control our raspberry over ssh,
But I’m too lazy to establish an ssh session then run command if it’s only to shutdown or other usual command,
So here we’ll utilize our keyboard as controller for our raspberry using https://github.com/wertarbyte/triggerhappy
Pasted from triggerhappy readme :
<blockquote class="tr_bq">“triggerhappy is a hotkey daemon developed with small and embedded systems in mind, e.g. linux based routers. it attaches to the input device files and interprets the event data received and executes scripts configured in its configuration.”</blockquote>[=] so let’s install triggerhappy
If you are using arch linux there’s triggerhappy-git in AUR,

[=] dump keyboard event to check event name

<div class="separator" style="clear: both; text-align: center;"></div>

Luckily my keyboard has extra button :D
Let’s use this button to trigger command by configuring /etc/triggerhappy.conf file,
<div class="separator" style="clear: both; text-align: center;"></div>

[=] enable/start triggerhappy service

[=] test it..
<div class="separator" style="clear: both; text-align: center;"></div>

That’s all, have fun :D