0

I want to display a notification for user via notify-send when power button is pressed.

Power button has a special script attached which allows to shutdown only when specified amount of time has passed.

In that time when user cannot shutdown the device I want to display a notification which says something like "Please wait...".

Problem is that when I put a notify-send command into the script it spams entire screen with that notification because after pressing the button script is executed like 50 times. It is related to power button hardware (I think).

So my question is there a way to do it?

1 Answer 1

3

Inside your script write a file on hdd ("touch alreadyPressed"). Each other call should check the existence of this file and leave the script. When the script notified the user delete the script. If this is too early, then delete it on startup.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.