Intercept power/sleep key events to prevent the host going offline
Problem to solve
I found that when I have the remote session open in fullscreen and I hit the physical power button on the client laptop, the "go to sleep" signal executes on the remote host. Is there any way to intercept this kind of signal to prevent the host accidentally going offline? Most other ways to power down/go to sleep the host requires a sequence of actions, this is just one accidental click away from taking the host offline.
Further details
- My client laptop is a Dell XPS with a power button separate from the keyboard keys, as seen on this picture. Both my host and client runs Ubuntu Linux.
- I think the relevant event for this case is
EV_KEY KEY_POWER
.
Proposal
Some kind of filter for keycodes coming through that can drop this and other "dangerous" signals coming through?