Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 16 Sep 2019, 20:32
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
YAD - Tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 37 of 48 [712 Posts]   Goto page: Previous 1, 2, 3, ..., 35, 36, 37, 38, 39, ..., 46, 47, 48 Next
Author Message
slavvo67

Joined: 12 Oct 2012
Posts: 1601
Location: The other Mr. 305

PostPosted: Tue 22 Jan 2019, 14:25    Post subject:  

Hi oldaolgeezer,

I ran without the list.txt file being there and as you could imagine, my output was a mess. So I added the following after your DIR= line but before your SOURCE= line. To be exact, my if statement started on line 29.

if [ -e list.txt ]; then
yad --text="list.txt exists!"
else
touch list.txt
echo "01 apples
01 apricot
01 asparagus
01 bananas
01 beets
01 brocoli
01 brussel sprouts
01 cantelope
01 carrots
01 green peppers
01 ketchup
01 kiwi
01 milk
01 mozrla chs block
01 mozrla chs slices
01 mushrooms
01 onion
01 orange juice pure
01 oranges
01 peas
01 spinach
01 strawberries
01 tomato
01 tzaziki
01 yams
01 yogurt
02 butter
02 cheddar
02 cheese slices
02 cheese sticks
02 chili beans
02 cottage cheese
02 eggsDairy
02 jam
02 mayonaise
02 pork& beans
02 salmon
02 soup
02 soya sauce
03 shampoo
03 tea bisk
03 zest
04 chickpeas
04 egg noodles
04 jello
04 oil
04 parmesan cheese
04 pasta
04 pineapple slices
04 potatoes canned
04 pudding
04 raisins
04 rice
04 salt
04 sphagetti sauce
04 wheat germ
05 crackers
05 mustard
05 peanut butter
05 tea bags
06 dog food
06 flour
06 ginger ale
06 gravy (canned)
06 pumpkin pie filling
06 sugar
07 bounce
07 dish soap
07 dishwasher soap
07 hand soap liquid
07 lasagne noodles
07 laundry detergent
07 tomato canned
03 toothpaste
07 water
08 kleenex
08 minty bones
08 napkins
08 paper towels
08 toilet paper
04 mandarin oranges
04 pineapple chunks
12 bacon
12 chicken breasts
12 ground beef
12 ham roast
12 ham slices
12 meatballs
12 pork cutlets
12 sausage
12 spare ribs
12 steak flank
12 steak round
12 steak sirloin
12 steak tenderloin
12 wieners
16 comet
16 garbage bags
03 cereal
19 Bread
19 bread crumbs
19 buns
19 hamburg buns
19 hotdog buns
19 pita slices
19 rice cakes
20 cabbage Rolls
20 cake
20 chicken Cordon Swiss
20 cool whip
20 corn frozen
20 frozen dinners
20 ice-cream
20 mravioli
20 perogies
20 raspberries frozen (425g)
20 waffles
20 whipped cream">>list.txt
fi
Back to top
View user's profile Send private message 
oldaolgeezer

Joined: 03 Dec 2006
Posts: 56

PostPosted: Tue 22 Jan 2019, 17:11    Post subject: YAD - Tips
Subject description: a YAD grocery shopping list script
 

slavvo67

I'm glad you were able to get Anthony Tekatch's
list.txt file extracted. (Others who are interested can copy
and paste it from your above post.)

I, myself, was very impressed with the "professional look" of
MochiMoppel's Xdialog command's window.
(I've attached a screen shot to show this.)

I downloaded grocget-0.6.tar.gz file and clicked on it and scanned its
contents and then selected his "grocget-0.6/list.txt" only and extracted just that
to a small directory I made called "grocery_shopping_for_Linux_stuff" on my
Windows NTFS drive. I put just the "list.txt" and my "yad_groceryshoppinglist.sh"
files in that directory.

I brought that directory up in a ROXfiler window and with a right click, choose
"window" then "terminal here". In my roxterm terminal window which opened, I entered
my script name with ". ./":
. ./yad_groceryshoppinglist.sh
after many cycles of trying, Geany editing and retrying "window" then "terminal here",
I wanted to share the versatility of MochiMoppel code.

Perhaps MochiMoppel's Xdialog script showing how to select file names and this
yad_groceryshoppinglist script showing selecting lines from within one file
will inspire others to code even more useful little script programs.
Screenshot_of_yad_groceryshoppinglist_script.jpg
 Description   
 Filesize   59.38 KB
 Viewed   553 Time(s)

Screenshot_of_yad_groceryshoppinglist_script.jpg

Back to top
View user's profile Send private message 
lamplinux


Joined: 21 Jan 2019
Posts: 31

PostPosted: Tue 22 Jan 2019, 23:10    Post subject: RE: Failing - That's me ! All your code worked,  

Hi all, your code worked fine. I was trying to use awk to copy files with spaces and had problems. I will work with your code this weekend and learn more about what it does.

@step, your code with printf did the trick with copying files with spaces. Thanks !

Thanks Everyone for your help. I just need to test more to see what all the code does. I'm learning and still a newbie.

Will come back next week after testing, tweaking, learning. Thanks Again !!!! You all are very much appreciated.
Back to top
View user's profile Send private message Visit poster's website 
lamplinux


Joined: 21 Jan 2019
Posts: 31

PostPosted: Thu 24 Jan 2019, 03:24    Post subject: Yad as a mp3 player using mpv  

Experimenting with both mpg123 and mpv I need to send a keystroke to advance to next song.

mpg123 requires the "f" key to go to next song. mpg123 -C *.mp3

mpv requires the "Return" key to go to next sone. mpv *.mp3

Can not understand why when I click on Next Track Music button, another instance of mpv is executed.

Code:

#!/bin/bash

play_mpv(){
cd /home/bobby/yadbash/sparky-launcher/music/
mpv *.mp3
}
export -f play_mpv


yad --form \
 --field="Play Random Music:BTN" "bash -c play_mpv" \
 --field="Next Track Music:BTN" "xdotool key Return" \
 --field="STOP MUSIC:BTN" "killall mpv"
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1897
Location: Japan

PostPosted: Thu 24 Jan 2019, 04:11    Post subject: Re: Yad as a mp3 player using mpv  

lamplinux wrote:
Can not understand why when I click on Next Track Music button, another instance of mpv is executed.
Because when you click the button, yad becomes the active window and the xdotool sends a Return keystroke - without further instructions of course to the active window. Yad receives the keystroke and applies it to the first button and starts another instance of mpv. You should be happy that the Return key does not go to the button you just pushed as this would result in an infinite loop.

What you need to do is let your command activate the mpv window and then send Return.
Back to top
View user's profile Send private message 
misko_2083


Joined: 08 Nov 2016
Posts: 81

PostPosted: Thu 24 Jan 2019, 21:18    Post subject:  

lamplinux aka Bobby I'm glad you are still around.

You can try with the mpv's built in command interface.
https://mpv.io/manual/master/#list-of-input-commands

Code:

#!/bin/bash

export COMMAND_PIPE=$(mktemp -u --tmpdir ${0##*/}.XXXXXXXX)
mkfifo $COMMAND_PIPE

exec 3<> $COMMAND_PIPE

function exit() {
    echo "quit" >&3
    rm -f $COMMAND_PIPE
}
trap exit EXIT

mpv --input-file=$COMMAND_PIPE --cache 2048 --no-config --idle=yes 2>&1 &

cd "/home/bobby/yadbash/sparky-launcher/music/"
printf "%s\n" *.mp3 | sort -R > playlist.m3u

yad --form \
 --field="Load Playlist Music:BTN" \
   'bash -c "echo loadlist \"/home/bobby/yadbash/sparky-launcher/music/playlist.m3u\" >> $COMMAND_PIPE"' \
 --field="Next Track:BTN" 'bash -c "echo playlist_next >> $COMMAND_PIPE"' \
 --field="Previous Track:BTN" 'bash -c "echo playlist_prev >> $COMMAND_PIPE"' \
 --field="STOP MUSIC:BTN" 'bash -c "echo stop >> $COMMAND_PIPE"'

exit 0
Back to top
View user's profile Send private message 
lamplinux


Joined: 21 Jan 2019
Posts: 31

PostPosted: Thu 24 Jan 2019, 23:04    Post subject:  mpv - yad - mp3 playing  

@misko So glad you knew it was me !! and that you are helping. Still trying to learn both Yad and Bash. Thank You So Much !!
Back to top
View user's profile Send private message Visit poster's website 
puppy_apprentice


Joined: 07 Feb 2012
Posts: 300

PostPosted: Sat 26 Jan 2019, 08:07    Post subject:  

Suppose i use YAD script that resides in tray. Can i change icon of this YAD script from other script. I'm thinking to make something similar to Windows notification area. For example when bash script will finish work will change icon of YAD script in the tray eg. for exclamation sign so user will know that there is some message to read. Next when user will click on YAD script icon a message from bash script will be displayed.
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 4086
Location: holland

PostPosted: Sat 26 Jan 2019, 08:41    Post subject:  

Yes, you can change the icon, for example, to test I did this in one terminal:
Code:
mkfifo /tmp/noti
exec 3<> /tmp/noti
yad --notification --no-markup                  \
    --listen                        \
    --image="/usr/share/pixmaps/flame.png"              \
    --text="My Text"   \
    --command="bash -c on_click" 2> /dev/null <&3 &


Then in another terminal:
Code:
echo icon:/usr/share/pixmaps/disc.png >/tmp/noti
echo action:'yad --text="My message"' >/tmp/noti

And the icon changed from flame to disc.
EDIT: And message when clicking on icon

EDIT: For the rest I'm not sure what you mean, clicking on the icon should give message ?
EDIT2: Changed above for in another terminal, added action:.... (thanks for info below, step)

Fred

Last edited by fredx181 on Sat 26 Jan 2019, 09:17; edited 2 times in total
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1197

PostPosted: Sat 26 Jan 2019, 08:47    Post subject:  

puppy_apprentice wrote:
Suppose i use YAD script that resides in tray. Can i change icon of this YAD script from other script. I'm thinking to make something similar to Windows notification area. For example when bash script will finish work will change icon of YAD script in the tray eg. for exclamation sign so user will know that there is some message to read. Next when user will click on YAD script icon a message from bash script will be displayed.

Yes. Run
my_script | yad --notification --listen OPTIONS &
where my_script outputs data that drives the tray icon. Details (my message continues after the block below):
Code:

OPTIONS
   Notification options
       --command=CMD
              Set the command running when clicked on the icon. Default action is quit if --listen not specified.

       --listen
              Listen for commands on stdin. See NOTIFICATION section.

       --separator=STRING
              Set separator character for menu values. Default is |.

       --item-separator=STRING
              Set separator character for menu items. Default is !.

       --menu=STRING
              Set initial menu for right-click.

       --no-middle
              Disable exit on middle click.

       --hidden
              Doesn't show icon at startup.

       --icon-size=SIZE
              Set notification icon size to SIZE. This option doesn't works for themed icons.

       See NOTIFICATION section for more about separators.

NOTIFICATION
       Allows commands to be sent to yad in the form command:args.  Possible commands are icon, tooltip, visible, action,  menu  and
       quit.

       icon:ICONNAME
              Set notification icon to ICONNAME.

       tooltip:STRING
              Set notification tooltip.

       visible:[true|false|blink]
              Set notification icon to visible, invisible or blinking states.

       action:COMMAND
              Specify the command running when click on the icon.  Special string "quit" exit the program.

       menu:STRING
              Set  popup  menu  for  notification  icon.  STRING must be in form name1[!action1[!icon1]]|name2[!action2[!icon2]]....
              Empty name add separator to menu.  Separator character for values (e.g. `|') sets with --separator argument.   Separa‐
              tor character for menu items (e.g. `!') sets with --item-separator argument.

       quit   Exit the program. Middle click on icon also send quit command.

You can try from a terminal window:
Code:

# cat | yad --notification --listen
tooltip:Hello World!

Cut the block above and paste it into the terminal. You should get the default yad icon as a tray icon. Hover the mouse pointer over the tray icon and "Hello World!" should appear. Shell input is still directed to yad, so you can try more commands from the NOTIFICATION section.
Note that yad will exit as soon as my_script (or cat, in this example) will end.

_________________
Fatdog64-802|+Packages|Kodi|Findnrun|+forum|gtkmenuplus
Back to top
View user's profile Send private message 
lamplinux


Joined: 21 Jan 2019
Posts: 31

PostPosted: Fri 01 Feb 2019, 22:32    Post subject: Is it possible to save Yad window size & position
Subject description: Saving Yad window size and position.
 

Is it possible to save to a file a Yad window size and position once it has been moved around and resized the way one wants it ?
Back to top
View user's profile Send private message Visit poster's website 
6502coder


Joined: 23 Mar 2009
Posts: 641
Location: Western United States

PostPosted: Fri 01 Feb 2019, 22:41    Post subject:  

@lamplinux

This may be relevant:
http://www.murga-linux.com/puppy/viewtopic.php?p=989242#989242
Back to top
View user's profile Send private message 
lamplinux


Joined: 21 Jan 2019
Posts: 31

PostPosted: Fri 01 Feb 2019, 22:50    Post subject:    

@6502coder Thank You !! I'll try that code.
Back to top
View user's profile Send private message Visit poster's website 
lamplinux


Joined: 21 Jan 2019
Posts: 31

PostPosted: Sun 03 Feb 2019, 13:36    Post subject: Saving Yad Window size & position  

More Info: Saving Yad Window size & position to be redisplayed by user.

A different kind of ad stopper - wolrdwide web.

So we all see the ads on Facebook, Youtube, Yahoo, Downlaod.com, sourceforge, etc.

I want to "hide" (not block) the ads on all these popular websites using Yad Windows that stay on top and contained in the yad windows is piped information about Linux, Joomla, Yad, and other info from others who help makes this happen.

Its really above my head and I'd appreciate feedback on the pipe methods.

    chat between 2 specific users PC <--> Webserver <--> PC
    Pictures and animated gif images can be displayed.
    rss text feed & notifications to a specific user.
    html page display.


What else can yad do (display in these Yad Cover Windows) ?
Back to top
View user's profile Send private message Visit poster's website 
lamplinux


Joined: 21 Jan 2019
Posts: 31

PostPosted: Sun 03 Feb 2019, 13:45    Post subject:  

This is a demo of what I am suggesting "COVERING ADS" Feedback to Users. Users passing messages and data to each other off of spy platforms like Facebook.

https://www.youtube.com/watch?v=AIgLWNoo1Vg
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 37 of 48 [712 Posts]   Goto page: Previous 1, 2, 3, ..., 35, 36, 37, 38, 39, ..., 46, 47, 48 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2189s ][ Queries: 13 (0.1344s) ][ GZIP on ]