Zenity Menu


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Zenity Menu
# 1  
Old 04-10-2009
Zenity Menu

I have some troubles with zenity and menu.

I seach for:

MAIN MENU
CHOICE 1
"do something"
CHOICE 2
"do something 2"
CHOICE 3
"do something 3"

But then in "do someghing [1-3]" when i click [OK BUTTON] i want to return to the MAIN MENU

So something like:

Code:
while true; do
  choice="$(zenity --width=200 --height=150 --list --column "" --title="choice" \
  "CHOICE 1" \
  "CHOICE 2" \
  "CHOICE 3")"

  case "${choice}" in

(And then, how to continue from here to

Code:
   esac
done

?)

I want to insert a "break function" in any CHOICE

for example:

Code:
zenity --info --title "$title" --text "OK BUTTON - RETURN TO THE MAIN MENU"
break
;;
(RETURN TO MAIN MENU)

# 2  
Old 04-10-2009
if your do something is some script then use exec to call that program
and break;; will return to main menu as you wanted if its under infinite while loop
# 3  
Old 04-11-2009
Solved, thank you! Smilie
# 4  
Old 04-15-2009
After some tests I think zenity have some limitations..

So for example:
Code:
while true; do
blablabla...
"browser")
exec iceweasel
zenity --info --title "title" --text "text"
;;

open browser then exit from script and ignore zenity call.

but with &
Code:
while true; do
blablabla...
"browser")
exec iceweasel &
zenity --info --title "title" --text "text"
#break
;;

works fine: open browser, open window then return to the main menu (with or without break).

Problem:

For example i have this command:
Code:
exec curl www.google.com  | sed... | grep ... | others commands > file.txt
if [[ -s file.txt ]] ; then
cat file.txt  | zenity  --text-info

So works fine but then (with OK button) script exit...
I want script return to the main menu when i click OK button after "zenity --text info" ...Any idea?
# 5  
Old 07-08-2009
just to resolve my doubts, can i have more than 3 choices, cos im thinking that we have only three numbers (0,1,-1) to represent the choices. so can i have more choices.

and i used parts of your code to do some testing :

while true; do
choice="$(zenity --width=500 --height=150 --list --column "" --title="choice" \
"Enable " \
"Disable " \
"Quit")"

case $? in
0)
exec script.sh;;
1)
echo "No file selected.";;
-1)
exec exit;;
esac


Note: this will give me execution of script.sh regardless of any choices i made. so i guess im going wrong in some parts.
dplate07
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Gnome 3.28.3 menu item dissapears under the system menu

I installed CentOS 8 with Gnome 3.28.2 and I noticed that the "switch user" menu item disappeared from under the system menu of Gnome classic (Both X11 & Wayland). I checked google and this problem seems to have a history going back several releases of Gnome. Unfortunately, I never found a... (1 Reply)
Discussion started by: bodisha
1 Replies

2. Shell Programming and Scripting

Bash Menu using zenity

Hi, I'm new to bash, and have an example menu script using Zenity. It works fine if the user enters A B or C, but if the user enters nothing, I can only figure out how to exit the script. How do I get the menu to reappear if no input is selected? The script is: title="Select example"... (2 Replies)
Discussion started by: allen11
2 Replies

3. Shell Programming and Scripting

Need help in create menu with 3 sub menu using the case command

hi all i am a newbie to this is there any examples on creating a main menu with 3 sub menu main menu -> option a , b and c a menu -> option 1 ,2 and 3 b menu -> option 1 ,2 c menu -> option 1 ,2 i am getting headache as my code kept getting unexpected EOF ---------- Post... (0 Replies)
Discussion started by: chercm
0 Replies

4. Shell Programming and Scripting

Zenity, While, and Conditions

All, I'm having fighting a losing battle with what I though would be simple. My goal is this: Show a zenity progress or info dialog until the system obtains an ip address, then close the dialog and continue through the rest of the script. Right now I've got the following: ip=`ifconfig |... (2 Replies)
Discussion started by: timbrammer91091
2 Replies

5. Shell Programming and Scripting

Zenity help

I have a large system housekeeping script, that I want to use with zenity. One of the processes will be to conduct a virus scan, which I can easily do with something like: clamscan -rv / | zenity --text-info --width 640 --height 640 The problem is that it needs user intervention by... (2 Replies)
Discussion started by: stumpyuk
2 Replies

6. Shell Programming and Scripting

Menu in Menu script issue

Problem: I am trying to create a menu in a menu script and I am running into an issue with the calculator portion of the script. I am first presented with the ==Options Menu== which all 5 options working correctly. Now comes the fun part. I select option 1 which takes me to my ==Calculator... (1 Reply)
Discussion started by: iDdraig
1 Replies

7. Shell Programming and Scripting

file zenity

Hello, I have a script with zenity file, but I want to know the file name and path, but this way I just take the name of the file. fl1=`zenity --file-selection --title="Seleccionar fichero"` basename $fl1 .txt > temp nom=`cat temp` Thank you very much (1 Reply)
Discussion started by: uri_crack
1 Replies

8. UNIX for Dummies Questions & Answers

zenity --question help

Hello I've a script where I've a zenity --question because I want to ask the user if he is sure that he wants to delete the file. The problem is, if the user says "OK" it deletes nad if the user says cancel it deletes :) How can I close the script if the user says cancel?? thanks (3 Replies)
Discussion started by: ruben.rodrigues
3 Replies

9. Shell Programming and Scripting

Zenity

Hi! does someone know how can I setup a zenity entry "box" such that comes with the data as default. like it appears an entry box already with the data but it can be modify. thanks (2 Replies)
Discussion started by: ruben.rodrigues
2 Replies
Login or Register to Ask a Question