LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-12-2018, 07:27 AM   #1
biosboy4
Member
 
Registered: Aug 2015
Distribution: Debian, SUSE, NXOS
Posts: 242

Rep: Reputation: 38
How to keep YAD buttons around after click


I got this working the way I want it except that I haven't yet figured out how to make the buttons stay onscreen after the clicks.

Please advise

Thanks,

Code:
#!/bin/bash
#Create Gui Buttons and assign vals for var
val=$(yad --center --width=300 --height=100 --title "GNUsual" --image "/mnt/foo.png" --text="Choose a Multicast to view:" \
--button="Multicast1":1 \
--button="Multicast2":2 \
--button="Multicast3":3 \
--button="Multicast4":4 ) \
ret=$?

#responses to above button presses are below
if [[ $ret -eq 1 ]]; then
vlc rtp://MulticastIP
#Insert troubleshooting gui-utility commands here
fi

if [[ $ret -eq 2 ]]; then
vlc rtp://multicastIP
#Insert troubleshooting gui-utility commands here
fi

if [[ $ret -eq 3 ]]; then
vlc rtp://multicastIP
#Insert troubleshooting gui-utility commands here
fi

if [[ $ret -eq 4]]; then
vlc rtp://multicastIP
#Insert troubleshooting gui-utility commands here
fi
 
Old 02-12-2018, 11:29 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by biosboy4 View Post
I got this working the way I want it except that I haven't yet figured out how to make the buttons stay onscreen after the clicks.

Please advise

Thanks,

Code:
#!/bin/bash
#Create Gui Buttons and assign vals for var
val=$(yad --center --width=300 --height=100 --title "GNUsual" --image "/mnt/foo.png" --text="Choose a Multicast to view:" \
--button="Multicast1":1 \
--button="Multicast2":2 \
--button="Multicast3":3 \
--button="Multicast4":4 ) \
ret=$?
Think you may need to "re-draw" them and guess #2 is
right after ret=$?
 
Old 02-12-2018, 12:49 PM   #3
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,622
Blog Entries: 40

Rep: Reputation: Disabled
Quote:
Originally Posted by biosboy4 View Post
I haven't yet figured out how to make the buttons stay onscreen after the clicks.
Use a loop of some kind. An exit-button will be nice to bail out from the loop, as the escape-key would not do it out of the box... I guess... but have not tested anything like this... Wait! Yes. I had a loop around the call to yad, but also an exit button...
 
Old 02-12-2018, 01:04 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
I've never played with yad but it appears to be a fork of zenity. yad is a way to have a grapical input or pop up messages in a shell script but it isn't a graphical application. When the command is run the box is displayed and waiting on input. Once the button is selected the command completes which closes the box i.e. it goes away.

As stated the only way to make the buttons stay on screen is to have a loop in your script.
 
Old 02-12-2018, 07:53 PM   #5
biosboy4
Member
 
Registered: Aug 2015
Distribution: Debian, SUSE, NXOS
Posts: 242

Original Poster
Rep: Reputation: 38
Thanks guys,

I tried
Quote:
for ( ;; )
do
$EVERYTHING
done
but have so far been unsuccessful; do you guys happen to know of a way to just loop the entire script?
I thought about bouncing it between identical versions of itself that point to and execute one another but that seems kinda hacky.
 
Old 02-12-2018, 08:08 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Why was it unsuccessful?

A while infinite loop
Code:
#!/bin/bash
while true
do
  #everything goes here
done
A for infinite loop
Code:
#!/bin/bash
 
for (( ; ; ))
do
  #everything goes here
done
 
1 members found this post helpful.
Old 04-03-2018, 03:06 PM   #7
walker
Member
 
Registered: Nov 2003
Distribution: antiX-17.4.1_x64 base Custom
Posts: 193

Rep: Reputation: 38
How to keep YAD buttons around after click

Supposing that a vertical layout doesn't hurt you and multicastIP adresses are fixed as seems reading your code...

You can try with the --form layout with button to which is directly associated the command

"#!/bin/bash

#Create Gui Buttons and assign vals for var

#Create vertical form with command associated directly to button
yad --form --width=250 --title="GNUsual" --image="/mnt/foo.png" --center --text="Choose a Multicast to view:" \
--field="Multicast1":fbtn "vlc rtp://MulticastIP" \
--field="Multicast2":fbtn "vlc rtp://MulticastIP" \
--field="Multicast3":fbtn "vlc rtp://MulticastIP" \
--field="Multicast4":fbtn "vlc rtp://MulticastIP" \
--button=gtk-quit:0"

The dialogue box disappers only if you click quit button at bottom right of the dialogue box.

Hope this helps

Walker

Last edited by walker; 04-03-2018 at 03:07 PM.
 
2 members found this post helpful.
Old 04-04-2018, 09:02 AM   #8
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Here's a nugget I wrote 7 years ago:
Code:
touch /tmp/$$
( ( echo 1 ; while [ -f /tmp/$$ ] ; do sleep 1 ; done ; echo 100 ) | yad --progress --pulsate --auto-close --text="Counting Snapshots..." --width=150 --title="" --undecorated --no-buttons) & get_snapshots
rm /tmp/$$
Enjoy!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The buttons of YAD LXer Syndicated Linux News 0 04-02-2017 12:12 PM
xfce with xmonad Window Buttons right-click menu Arrakis Linux - Newbie 2 08-14-2014 07:57 AM
Gnome 3 extension to swap mouse buttons with a click kaiserkarl13 Linux - Desktop 0 12-14-2012 06:44 PM
Irritating Re-Sizing of Buttons in XFCE Task List on Click -- Am I Alone Here? foodown Linux - Desktop 1 07-28-2010 12:09 AM
middle click paste only works sometime and how to config other buttons? zeltak Linux - Software 3 02-16-2006 09:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration