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?
--question
dialog--timeout
to get a third return value (5) or you can go for multiple choice dialog by--list --radiolist
. Have fun. – frostschutz Mar 02 '17 at 13:47zenity
:) - what I know now about it is pretty much the script above.let the --question dialog --timeout to get a third return value (5)
it's something that needs an interpretation for me. – Mar 02 '17 at 14:20