First:
sudo nano /etc/systemd/logind.conf
Find;
#HandlePowerKey=poweroff
And Replace Like This;
HandlePowerKey=ignore
After open your i3 config and append they;
bindsym XF86PowerOff exec --no-startup-id "i3-nagbar -t warning -m 'pressed PowerButton'"
bindsym XF86PowerDown exec --no-startup-id "i3-nagbar -t warning -m 'pressed PowerButton'"
Finally;
reboot