I have a hot corner set up that runs other commands to turn off my laptop's display and lock my screen. However, I often accidentally mouse into this hot corner. Is there any way of me setting up a popup box that gives the user a yes or no option before executing the commands to turn the display off? I'm looking for functionality almost like that of gksudo
.
Asked
Active
Viewed 63 times
1

Rohan
- 3,561
1 Answers
2
Try using zenity
or a similar dialog-like command:
zenity --yesno 'do you want to suspend?'
It asks the question in a dialog with 'yes' and 'no' buttons. Once you click one of those buttons, it prints the response on standard error (I believe). If you capture that, you can then have a script decide what to do based on the choice made by the user.
zenity
has many more options for the dialog box; they're documented in the man page.

Wouter Verhelst
- 9,331
zenity --yesno
is apparently an unavailable option. But I looked in man page and tried--question
, and it did the trick. Just quick question, how do I use the input zenity gives in an if statement in bash? – Rohan Apr 09 '16 at 19:39zenity --question && echo "ok, will continue" || echo "okay, won't continue then"
– Wouter Verhelst Apr 12 '16 at 07:18if zenity --question; then
. Thetest
command (aka[
) is, after all, also just a command whose exit state you pass to theif
command. Shell is weird ;-) – Wouter Verhelst Apr 12 '16 at 07:20