1

I am running latest retropie on a rpi3b+. I am also using retrogame to map GPIO pins the keyboard keys to arcade buttons.

What I would like to do is run the sudo shutdown command if a designated key (or designated combo of keys) was held down for 5 seconds.

I’m not super versed in bash so am having trouble getting started. I’ve tried searching under the assumption that maybe this has been done before but couldn’t find anything. I know python but think it may be too much run simultaneously with retropie.

I appreciate any help or links in the right direction.

MatsK
  • 2,791
  • 3
  • 16
  • 20
user76595
  • 181
  • 1
  • 5
  • "I know python but think it may be too much run simultaneously with retropie." -> A background process that is just waiting for an event like this should use pretty much zero CPU resources no matter how it's done. Shouldn't use more than a smidge of RAM either, although I think the variation-based-on-method will be a bit broader. – goldilocks Oct 05 '23 at 13:44
  • I used to run a Shutdown Daemon (started with crontab) to shutdown on button press (although this is no longer necessary) https://raspberrypi.stackexchange.com/a/42945/8697 You may be able to adopt this technique using different activation criteria. – Milliways Oct 05 '23 at 23:13

1 Answers1

1

There is a keyboard macro tool, AutoKey that can do what you want.

AutoKey is a Linux Utility for Text Substitution , Hotkeys and Desktop Automation.

https://autokey.github.io/intro.html

MatsK
  • 2,791
  • 3
  • 16
  • 20