The officially official Devuan Forum!

You are not logged in.

#1 2017-11-10 20:30:39

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

YAD Tutorial Site?

Is there a good YAD tutorial site that I can't find through internet searches?

I've found a couple that were helpful, but they didn't go very in-depth. I'm trying to make a panel-switcher GUI, and unfortunately the command that I use to kill one panel; such as...

killall xfce4-panel

...seems to conflict with a standard YAD command that starts off with "kill" in its command.

If that makes sense. tongue

Last edited by MiyoLinux (2017-11-10 20:31:16)


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#2 2017-11-10 21:32:27

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,486  

Re: YAD Tutorial Site?

xclock &
yad --button="Kill panel":0 --button="Say hello":1 ; ans="$?" ; if [[ $ans = 0 ]] ; then killall xclock ; elif [[ $ans = 1 ]] ; then echo "Hi" ; else echo "Bye" ; fi

Offline

#3 2017-11-11 03:39:06

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: YAD Tutorial Site?

Thanks fsr. When I run that from the terminal, it doesn't recognize xclock as a command (?).

I might can use some of that to figure out how to figure out some stuff I'd like to figure out though. smile

Thanks again.


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#4 2017-11-11 11:13:36

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,486  

Re: YAD Tutorial Site?

xclock is part of x11-apps, which has other cool stuff like xeyes and xcalc. That's just there to have something non-essential to kill. Break the line up into multiple lines, and it will make more sense. The numbers set the exit code for each button, the ans="$?" stores the exit code, then you test to see which action to perform based on the exit code.

Offline

#5 2017-11-11 12:34:07

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: YAD Tutorial Site?

Ah...okay. So that's what x11-apps is for. I've seen in but never installed it, and never searched for what it was/is.

I did try the second line of that command last night, and it gave me the GUI (still showed the "xclock" error in the terminal of course). I actually have the whole GUI built, but I don't have any of those type of commands. I can open any of the panels with the GUI, but closing them down is my problem...I'll see if I can incorporate any of that code into it. I sure wish I could find a good tutorial site, because I'd like to know what I'm doing when I do it. LOL! tongue

Thank you.


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#6 2017-11-11 13:56:58

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: YAD Tutorial Site?

AW GOOD GRIEF!!!

Stinkin' bunch'a &*#$*!!!

Sorry for my language. LOL! I just figured out why my "killall blah blah panel" command wasn't working. I was trying to follow one of the tutorials (that I had found online) and adapting it for my panel switcher. The tutorial wasn't putting the command in quotation marks...

I put it in quotation marks, and now everything works...


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#7 2017-11-11 17:32:06

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: YAD Tutorial Site?

Okay! I've finally got everything...AND I MEAN EVERYTHING...figured out!

Whenever I have something that I wonder about or need help with, and after I've depleted all of my searching, trying, and experimenting...I finally ask for help. One thing I've noticed...when I ask for help, and fsmithred offers advice, it causes me to dig deeper than I had before. Strange thing is, his help usually makes me realize how close I was to begin with. LOL! Now to fine-tune some things and work on the other "Miyo Accessories"...

Here's a quick look at the MiyoLinux Panel Switcher GUI as it stands now...

https://youtu.be/vT1dT2Aa690

...and while we're on the subject...hey fsr, any advice on how I can acquire a million dollars? LOLOLOLOL! tongue


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#8 2017-11-11 19:50:35

greenjeans
Member
Registered: 2017-04-07
Posts: 542  
Website

Re: YAD Tutorial Site?

Well i'm a little late to the party, but have some good links somewhere, here's one to the main discussion about yad on the Puppy linux forum:

http://murga-linux.com/puppy/viewtopic.php?t=97458

There's a blog called the Linux Rain that has several good tuts, this is a great one for just starting out:

http://www.thelinuxrain.com/articles/mu … y-with-yad

One thing to remember when experimenting with Yad on your machine, if you are trying commands in terminal, most terminals including LXterminal are bash terminals, while Devuan runs on dash, so things won't always work the same, bashisms will cause a /bin/sh script to fail or not work right, and there are some things that will work perfectly as a dash script but won't work right in terminal.


https://sourceforge.net/projects/vuu-do/
Vuu-do GNU/Linux, minimal Devuan-based openbox systems to build on, maximal versions if you prefer your linux fully-loaded.

Please donate to support Devuan and init freedom! https://devuan.org/os/donate

Offline

#9 2017-11-11 20:18:09

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: YAD Tutorial Site?

greenjeans wrote:

Well i'm a little late to the party, but have some good links somewhere, here's one to the main discussion about yad on the Puppy linux forum:

http://murga-linux.com/puppy/viewtopic.php?t=97458

There's a blog called the Linux Rain that has several good tuts, this is a great one for just starting out:

http://www.thelinuxrain.com/articles/mu … y-with-yad

One thing to remember when experimenting with Yad on your machine, if you are trying commands in terminal, most terminals including LXterminal are bash terminals, while Devuan runs on dash, so things won't always work the same, bashisms will cause a /bin/sh script to fail or not work right, and there are some things that will work perfectly as a dash script but won't work right in terminal.

Those two are the ones that were most helpful. The Linux Rain one was the one that didn't have the commands inside of quotation marks; however, those commands worked for what he was using them for. When I tried to adapt them to my panel switcher, it wouldn't work without the commands being inside of quotation marks... stinkin' coding!!! big_smile

Thanks greenjeans!


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#10 2017-11-12 13:04:11

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,486  

Re: YAD Tutorial Site?

Are you gonna show us your script? How do you get the window to stay up when you make a selection?

Offline

#11 2017-11-12 14:35:50

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: YAD Tutorial Site?

fsmithred wrote:

Are you gonna show us your script? How do you get the window to stay up when you make a selection?

I'm almost too embarrassed to show it, because of how simple it is. big_smile

I'll post it tomorrow...it's on my build computer, and I accidentally left it at work...forgot to copy the script to a USB too. tongue

If I get the time today, I'll write it again and post it. It stays open, because I didn't use any of the...

if this
then that
else the other

...stuff. I wanted it to stay open so a user could go try them all without having to open it again.


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#12 2017-11-13 21:19:16

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: YAD Tutorial Site?

Okay. I was quite busy yesterday...sorry for the delay.

Here is the code (as it made the GUI appear in the video) in all of its simplistic glory. big_smile  I'm still going to see if I want to change anything around, so this may not be the finished product.

yad --form --width=185 --text=" MiyoLinux Panel Switcher" \
--field="Tint2 - ON":fbtn "tint2" \
--field="Tint2 - OFF":fbtn "killall tint2" \
--field="LXPanel - ON":fbtn "lxpanel" \
--field="LXPanel - OFF":fbtn "killall lxpanel" \
--field="Xfce4 Panel - ON":fbtn "xfce4-panel" \
--field="Xfce4 Panel - OFF":fbtn "killall xfce4-panel" \
--field="Plank - ON":fbtn "plank" \
--field="Plank - OFF":fbtn "killall plank" \
--button=gtk-close:1

I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#13 2017-11-13 21:24:11

greenjeans
Member
Registered: 2017-04-07
Posts: 542  
Website

Re: YAD Tutorial Site?

fsmithred wrote:

How do you get the window to stay up when you make a selection?

When the last portion of a button is a command instead of a result, the yad window stays open until you close it manually.

If however you want it to close after making the selection, the quick-n-dirty way is to add --close-on-unfocus, most window managers focus new windows automatically or as the default setting, so after the selection opens the yad window will close automatically.

Here's an example, this is my solitaire chooser:

#!/bin/sh

# Simple version chooser for the solitaire program (ace of penguins), avoids having to have separate menu entries.

yad --close-on-unfocus --fixed --center --form --title=Solitaire --borders=10 --text-align=center --text "- Choose which version to play -" --button=Klondike!/usr/share/icons/Oxy2-ZEN/24x24/apps/gnome-aisleriot.png!"Click to play Klondike (classic solitaire)":/usr/games/ace-solitaire --button=Freecell!/usr/share/icons/Oxy2-ZEN/24x24/apps/gnome-aisleriot.png!"Click to play Freecell":/usr/games/ace-freecell --button=Canfield!/usr/share/icons/Oxy2-ZEN/24x24/apps/gnome-aisleriot.png!"Click to play Canfield":/usr/games/ace-canfield

https://sourceforge.net/projects/vuu-do/
Vuu-do GNU/Linux, minimal Devuan-based openbox systems to build on, maximal versions if you prefer your linux fully-loaded.

Please donate to support Devuan and init freedom! https://devuan.org/os/donate

Offline

#14 2017-11-14 00:33:42

greenjeans
Member
Registered: 2017-04-07
Posts: 542  
Website

Re: YAD Tutorial Site?

Maybe we should make this a dedicated yad thread for tutorials and script examples? Yad is crazy, I think that guy is out to take over the world, it does just about anything you could imagine now...


https://sourceforge.net/projects/vuu-do/
Vuu-do GNU/Linux, minimal Devuan-based openbox systems to build on, maximal versions if you prefer your linux fully-loaded.

Please donate to support Devuan and init freedom! https://devuan.org/os/donate

Offline

#15 2017-11-14 00:40:50

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: YAD Tutorial Site?

greenjeans wrote:

Maybe we should make this a dedicated yad thread for tutorials and script examples? Yad is crazy, I think that guy is out to take over the world, it does just about anything you could imagine now...

I think that's a great idea! I've already modified my Panel Switcher, and now I'm working on my Touchpad Controls. I saw an Online Radio that someone had made with Yad. yikes

I'm not much into coding, but Yad makes me want to stinkin' code. LOLOLOL! tongue

Last edited by MiyoLinux (2017-11-14 00:41:21)


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#16 2017-11-14 22:46:57

greenjeans
Member
Registered: 2017-04-07
Posts: 542  
Website

Re: YAD Tutorial Site?

MiyoLinux wrote:

I'm not much into coding, but Yad makes me want to stinkin' code. LOLOLOL! tongue

I know right? Me too, working on a simple image cropper to use for a pcmanfm extension. I actually made one that works in two lines of code but only works right on an image that's the size of your screen or smaller because it uses scrot's select function, it will crop any size image but since scrot only works on the visible image as opposed to the actual image, the crop on larger images is too small.

Gonna have to figure out how to do it with imagemagick or maybe the python pil library....but the quickie scrot method was just too fun not to try.

If you have gpicview, yad, and scrot, try this (replace the image file name with one of yours), the gpicview portion is to view the cropped image and also to close yad window:

yad --title="Select area using the mouse" --picture --close-on-unfocus --no-buttons --size=fit --filename=IMG_8678.JPG --center --width=800 --height=600 &
scrot -q 100 -s -e 'gpicview $f'

Last edited by greenjeans (2017-11-14 22:47:27)


https://sourceforge.net/projects/vuu-do/
Vuu-do GNU/Linux, minimal Devuan-based openbox systems to build on, maximal versions if you prefer your linux fully-loaded.

Please donate to support Devuan and init freedom! https://devuan.org/os/donate

Offline

#17 2017-11-15 01:23:56

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: YAD Tutorial Site?

I have all of my "Miyo Tools" converted over to GUIs now. They work great. smile


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

Board footer