Close yad dialog after pressing FBTN

1,967 views
Skip to first unread message

Paul

unread,
Mar 9, 2016, 11:17:45 AM3/9/16
to yad-common
Dear all, I have script:

yad \
--width 300 \
--height 300 \
--center \
--on-top \
--skip-taskbar \
--borders="30" \
--columns 1 \
--form \
--button="gtk-help":0 \
--button="gtk-close":1 \
--buttons-layout=end \
--field="<b><big>Cbutton1</big></b>!gtk-preferences":FBTN "bash main_choose.sh" && exit 0 \
--field " ":lbl "" \
--field="<b><big>button2</big></b>!gtk-preferences":FBTN "bash main_xhoose2.sh" && exit 0 \
--field " ":lbl "" \

It is possible to close this dialog option, when I click on FBTN? I need to open another yad dialog (main_choose.sh) and close the current one. this option
bash main_choose.sh" && exit 0 does not work.

Thnak you.
Enter code here...




Tim Carter

unread,
Mar 9, 2016, 12:40:36 PM3/9/16
to yad-c...@googlegroups.com
Hi Paul

Yes, if you have wmctrl installed and you give all your dialogs titles.For your example:

Give your yad a unique title:

yad \
--title "Dialog 01" \
...

In the bash script you are calling from a button enter the following close to the top (or wherever you want)

#!/bin/bash
#closes calling window
wmctrl -c "Dialog 01"
....

There may be other ways, but this works well for me.

Tim


--
You received this message because you are subscribed to the Google Groups "yad-common" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yad-common+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

serge gabellon

unread,
Mar 9, 2016, 7:52:19 PM3/9/16
to yad-common
I do not think can put 2 actions in a button.
you must create a function.
in the "gtk-images.yad" file, write by @juliobash, in this post
click here
watch the quit function (line 14)
and its launch (line 75)
bye
Message has been deleted

serge gabellon

unread,
Mar 9, 2016, 8:42:25 PM3/9/16
to yad-common
in your case, you do not need --form
you may do so
#!/bin/bash

yad
\
--width 300 \
--height 300 \
--center \
--on-top \
--skip-taskbar \
--borders="30" \
--columns 1 \
--form \
--button="gtk-close":0 \
--button="gtk-ok":1 \
--button="gtk-apply":2 \
--buttons-layout=end
           
case $? in
           
1)
            yad
--calendar --center;;
           
2)
            yad
--entry --center;;
           
esac
exit


Victor Ananjevsky

unread,
Mar 10, 2016, 4:07:11 AM3/10/16
to yad-c...@googlegroups.com

yad --form --field "run action:fbn" 'bash -c "/where/the/action.sh ; kill -USR1 $YAD_PID"'

$YAD_PID variable available for all of yad's children and contain pid of parent yad process

В Wed, 9 Mar 2016 08:17:44 -0800 (PST)
Paul <bbro...@gmail.com> писал:
> --
> You received this message because you are subscribed to the Google Groups "yad-common" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to yad-common+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


--
Victor Ananjevsky <anan...@gmail.com>

Paul

unread,
Mar 10, 2016, 5:04:43 AM3/10/16
to yad-common
Thank you Victor,

maybe stupid question, but how can I get $YAD_PID?

I tried to do:

--field="<b><big>Analysis</big></b>!gtk-preferences":FBTN 'bash -c "'$quality'/main_choose_qual.sh ; kill -USR1 $YAD_PID"' \

But it is open main_choose_qual.sh but not close current one.. Sorry maybe for stupid question..

Victor Ananjevsky

unread,
Mar 10, 2016, 5:19:57 AM3/10/16
to yad-c...@googlegroups.com
run $quality/main_choose_qual.sh in the background (with &)

В Thu, 10 Mar 2016 02:04:43 -0800 (PST)
Paul <bbro...@gmail.com> писал:

> Thank you Victor,
>
> maybe stupid question, but how can I get $YAD_PID?
>
> I tried to do:
>
> --field="<b><big>Analysis</big></b>!gtk-preferences":FBTN 'bash -c "'
> $quality'/main_choose_qual.sh ; kill -USR1 $YAD_PID"' \
>
> But it is open main_choose_qual.sh but not close current one.. Sorry maybe
> for stupid question..
>
>
>
>
> On Thursday, March 10, 2016 at 10:07:11 AM UTC+1, Victor Ananjevsky wrote:
> >
> >
> > yad --form --field "run action:fbn" 'bash -c "/where/the/action.sh ; kill
> > -USR1 $YAD_PID"'
> >
> > $YAD_PID variable available for all of yad's children and contain pid of
> > parent yad process
> >
> > В Wed, 9 Mar 2016 08:17:44 -0800 (PST)
> > Paul <bbro...@gmail.com <javascript:>> писал:
> > an email to yad-common+...@googlegroups.com <javascript:>.
> > > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > Victor Ananjevsky <anan...@gmail.com <javascript:>>
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

RTX

unread,
Feb 3, 2020, 8:17:52 AM2/3/20
to yad-common
This will run the script action on the button and close the dialog:

setsid yad \

--width 300 \
--height 300 \
--center \
--on-top \
--skip-taskbar \
--borders="30" \
--columns 1 \
--form \
--button="gtk-help":0 \
--button="gtk-close":1 \
--buttons-layout=end \
--field="<b><big>Cbutton1</big></b>!gtk-preferences:fbtn" 'bash -c "main_choose.sh & kill -USR1 $YAD_PID"' \
--field " ":lbl "" \
--field="<b><big>button2</big></b>!gtk-preferences:fbtn" 'bash -c "main_xhoose2.sh & kill -USR1 $YAD_PID"' \
--field " ":lbl ""

Reply all
Reply to author
Forward
0 new messages