(SOLVED) How to map power buttom (mac) to FvwmScript-ConfirmQuit?

I’ve been running into some small problems with linux/fvwm running on a mac. Not anything to stop this venture, but it’s a pebble in my shoe, for sure.

But I just came into a major problem that would stop me from using a setup like this. On the Macbook air I’m using, the power button is location just above the delete key. Furiously typing caused me to accidentally tap the power button, and linux immediately started shutting down. This is unacceptable to have while coding.

Is there anyway to remap the power key to activate FvwmScript-ConfirmQuit instead of shutting down immediately?

The power key is listed as:

keycode 124 = XF86PowerOff NoSymbol XF86PowerOff

Ok, this was actually quite easy compared to other things in FVWM.

  1. Stop computer from shutting down on power button key press.
    Add HandlePowerKey=ignore to /etc/systemd/logind.conf

  2. Then add then new Key to your config file:

Key    XF86PowerOff    A    A    Func_Quit
  1. Finally, add the new function.
DestroyFunc Func_Quit
AddToFunc   Func_Quit
+ I Module FvwmScript $[SCRIPTS_PATH]/FvwmScript-ConfirmQuit
+ I WindowId root 1 WarpToWindow 670p 460p

And that’s all I needed. Interestingly, the power button still powers the computer down if you hold it (like usual).