Following this solution I have a zenity script to ask me what to do when clicking an executable script in Thunar or a desktop file in Pantheon Files:
#!/bin/bash
zenity --question --text="What to do?" \
--ok-label=Run \
--cancel-label=Edit
case $? in
0)thunar "$1"
;;
1)gedit $1
;;
esac
And it shows this:
But there is a small glitch: you cannot dismiss the dialog at this point: using close window button, Esc or Alt+F4 equates to the --cancel-label
option in the script and will open the file in text editor.
How could I edit the script so that when Esc is pressed the zenity windows would close without farther action?
Edit after comment:
I have got this in a comment:
either let the –question dialog –timeout to get a third return value (5)
Indeed, --timeout=4
will close the dialog after that number of secs.
or you can go for multiple choice dialog by –list –radiolist
What does that mean?
Best Answer
Simple example of a radiolist
There is a simple example of a radiolist in this link,
http://linux.byexamples.com/archives/265/a-complete-zenity-dialog-examples-2/
Example with --list
I think it is easier to use a simple list (with the option
--list
but without--radiolist
)