2

I have set up a computer for my mother, who has Alzheimer and motor skills impairment. A custom web app displays a menu of options and she just presses the letter corresponding to what website she wants to see (A=Facebook, B=Email, etc.)

When she wakes the computer up in the morning, she presses a random key, very often starting that menu option, which is very confusing for her.

  • I cannot ask her to press a specific key to wake up, she won't remember
  • I have written the web app using Javascript, so if there's a way to detect that the last key pressed was used to wake up the computer, I could use that. I haven't found out how.

Any ideas will be greatly appreciated!

2
  • is this a bluetooth keyboard or wired? cuz bluetooth always misses the first event. my laptop's keyboard never drops the first event.
    – jrdnjhntsn
    Commented Feb 6, 2022 at 18:41
  • 1
    Thanks! It's Bluetooth but it doesn't seem to behave the same as yours.
    – Kerans
    Commented Feb 6, 2022 at 21:56

1 Answer 1

4

This is an X-Y problem. You have a problem, and came up with a solution, but the solution is not the best approach.

Whatever your menu is, make sure that IT will not accept keyboard input until it is ready to do so.

There are plenty ways to do so. You could add in a timer in the script that detects when keys haven't been pressed in a while, and if so, ignore the first key it received. Maybe you can even detect if the screen is turned on or something else that makes it so you can be ensured that once the computer comes out of hibernation you just ignore key presses for a bit. For example, keep track of the current system time, and if that jumps by more than 10 seconds, the computer probably have been sleeping in between.

3
  • Thanks! That's a good way to reframe the problem. I've looked around some more and it seems that a timer is generally the recommend approach. Cheers!
    – Kerans
    Commented Feb 6, 2022 at 21:57
  • @Kerans Are you sure the computer is sleeping and not just the monitor turned off. Commented Feb 6, 2022 at 23:57
  • @user1644677 You're right, I just noticed that! After more testing I found out that the Bluetooth keyboard was not able to wake the computer (bc old hardware). So I set the monitor and computer to Always On, and used a JS function to make the browser page black after a certain period of inactivity, setting a global status variable in the process. When the user presses a key, I check that status variable and ignore they key press if it was used to wake up the PC. A bit contrived but it'll have to do! Thanks :)
    – Kerans
    Commented Feb 7, 2022 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .