Page 17 of 42
Posted: Thu 10 Aug 2017, 16:06
by drxspace
Hi,
@smokey01 Yes, I'll agree with you it's probably a matter of GTK+ 3
Anyway, if I do not tire you, please have a look at the code below:
Code: Select all
isitTheBlank=$(sed 's/[[:blank:]]*/·/g' <<<$"These are packages from all enabled repositories, except for base and base-devel ones. Also, you\'ll find packages that are locally installed, such as AUR packages.")
yad --form --width="350" --height="130" --borders=5 --center --window-icon="system-software-install" --title="About ArchLinux Packages Viewer" --image="system-software-install" --image-on-top --text="<span font_size='medium' font_weight='bold'>View Lists of Installed Packages</span>\n${isitTheBlank}" --buttons-layout="center" --button='Κλείσιμο!window-close!Κλείνει το πα
Posted: Fri 12 Jan 2018, 14:24
by stemsee
How to make yad update instead of accumulate when piping data!
Code: Select all
PATTERN='s/^.*Address: ([0-9A-Z:]*)/\n\1/p
s/^.*Quality=([^ ]*).*Signal level=(.*)/\1 \2/p
s/^.*key:([onf]*)/~\1~/p
s/^.*ESSID://p'
mkfifo /tmp/pipe
exec 4<>/tmp/pipe
while true; do echo "`iwlist wlan0 scan | sed -rn "$PATTERN" | tac`" >&4; sleep 5; done &
yad --list --item-separator=';' --columns=5 --column=wlan0 --column=security --column=signal --column=mac --column=save:CHK <&4 &
Posted: Fri 12 Jan 2018, 21:54
by slavvo67
Still love YAD.
Guys, maybe you can provide guidance on something....
Take a look at Misko's post, specifically at the bottom buttons. How can I create a list of buttons going vertical and horizontal. Currently, I just get a long line of them going across AND it stretches past my screen width; not pretty. So like the generic OK and Cancel buttons but enhanced to list maybe 5 across and 10 vertical lines.
Thanks for any insight.
Slavvo67
Posted: Sat 13 Jan 2018, 09:43
by stemsee
specify columns then if you have 16 buttons they will divide into 4x4 etc
Posted: Fri 26 Jan 2018, 21:22
by slavvo67
Stemsee:
Thanks but that didn't work. I guess I should attach my code:
#!/bin/bash
#Slavvo67 MMPlay Version 5.0
#This is a GUI on top of M-Player
#You can create up to 3 Playlists or choose a folder to play.
#Good idea to know the keyboard commands...
# < > go back and forward in playlist (use shift)
# Arrow keys are rewind and fast forward type buttons
# f key is for full screen or default view. You can hit it twice to see the difference.
# 9 to decrease volume and 0 to increase volume.
# Enter or Return Key goes to next video in playlist.
# Esc or Q will either quit completely or go to the next video, depending.
# If you hold down the Esc button, it will eventually end the program...
# Spacebar is pause and start.
#
if [ -f "/root/.title1.play" ]; then
tab1=$(</root/.title1.play)
else
tab1="No Playlist-1"
fi
if [ -f "/root/.title2.play" ]; then
tab2=$(</root/.title2.play)
else
tab2="No Playlist-2"
fi
if [ -f "/root/.title3.play" ]; then
tab3=$(</root/.title3.play)
else
tab3="No Playlist-3"
fi
if [ -f "/root/.title4.play" ]; then
tab4=$(</root/.title4.play)
else
tab4="No Playlist-4"
fi
if [ -f "/root/.title9.play" ]; then
tab5=$(</root/.title9.play)
else
tab5="No Dir by Mod Date"
fi
cd /
subs555=$(yad --columns=4 --center --title="Choose if you want subtitles" --button="Subtitles:0" --button="No Subtitles:1" --button="Exit:2" )
subs1=$?
if [[ $subs1 -eq 2 ]]; then
exit 0
fi
if [[ -a /root/.Playlist.play || -a /root/.Playlist2.play || -a /root/.Playlist3.play || -a /root/.Playlist4.play ]]; then
usepl1=$(yad --center --title "Use current playlist or new?" --button="$tab1:0" --button="$tab2:4" --button="$tab3:8" --button="$tab4:9" --button="$tab5:3" --button="Other Options:2")
usepl2=$?
if [[ $usepl2 -eq 0 ]]; then
if [[ $subs1 -eq 1 ]]; then
urxvt -e mplayer -nosub -fs -vo xv -playlist /root/.Playlist.play
elif [[ $subs1 -eq 0 ]]; then
urxvt -e mplayer -fs -vo xv -playlist /root/.Playlist.play
fi
exit
elif [[ $usepl2 -eq 1 ]]; then
rm /root/.Playlist.play
elif [[ $usepl2 -eq 4 ]]; then
if [[ $subs1 -eq 1 ]]; then
urxvt -e mplayer -nosub -fs -vo xv -playlist /root/.Playlist2.play
elif [[ $subs1 -eq 0 ]]; then
urxvt -e mplayer -fs -vo xv -playlist /root/.Playlist2.play
fi
exit
elif [[ $usepl2 -eq 8 ]]; then
if [[ $subs1 -eq 1 ]]; then
urxvt -e mplayer -nosub -fs -vo xv -playlist /root/.Playlist3.play
elif [[ $subs1 -eq 0 ]]; then
urxvt -e mplayer -fs -vo xv -playlist /root/.Playlist3.play
fi
exit
elif [[ $usepl2 -eq 9 ]]; then
if [[ $subs1 -eq 1 ]]; then
urxvt -e mplayer -nosub -fs -vo xv -playlist /root/.Playlist4.play
elif [[ $subs1 -eq 0 ]]; then
urxvt -e mplayer -fs -vo xv -playlist /root/.Playlist4.play
fi
exit
elif [[ $usepl2 -eq 3 ]]; then
if [[ $subs1 -eq 1 ]]; then
urxvt -e mplayer -nosub -fs -vo xv -playlist /root/.Playlist9.play
elif [[ $subs1 -eq 0 ]]; then
urxvt -e mplayer -fs -vo xv -playlist /root/.Playlist9.play
fi
exit
fi
fi
#yad --columns=4
### next line modifies the previously saved directories. So if changing...
file222=$(yad --width=120 --center --form --separator=" " --title="CREATE NEW PLAYLISTS" --button="Create Playlist 1:5" --button="Create Playlist 2:1" --button="Create Playlist 3:8" --button="Create Playlist 4:9" --button="Folder by Mod Date:0" --button="Folder of Vids:7" --button="Exit:2" )
ret=$?
if [[ $ret -eq 2 ]]; then
exit 0
fi
## CHOOSE FOLDER TO PLAY ###
if [[ $ret -eq 7 ]]; then
folder1=$(yad --columns=4 --center --title="Choose folder to play..." --file --directory --width=600 --height=400 --button="Exit:1" --button="OK:0")
ret8=$?
if [[ $ret8 -eq 1 ]]; then
exit 0
fi
cd "$folder1"
#mplayer -af volnorm=2:0.75 FooVideo.flv NOTE: This normalizes the volume across all played
if [[ *.[Mm][Pp][4]* ]]; then
for i in *.[Mm][Pp][4]*; do urxvt -e mplayer -af volnorm=2:0.75 -nosub -fs "$i" ; done
fi
if [[ *.[Mm][Pp][3] ]]; then
for i2 in *.[Mm][Pp][3]; do urxvt -e mplayer -af volnorm=2:0.75 -nosub -fs "$i2" ; done
fi
if [[ *.[Ww][Aa][Vv] ]]; then
for i2 in *.[Ww][Aa][Vv]; do urxvt -e mplayer -af volnorm=2:0.75 -nosub -fs "$i2" ; done
fi
if [[ *.[Mm][4][Aa] ]]; then
for i4 in *.[Mm][4][Aa]; do urxvt -e mplayer -af volnorm=2:0.75 -nosub -fs "$i4"; done
fi
if [[ *.wmv ]]; then
for i3 in *.wmv; do ffplay -fs -b:v 1000k "$i3" -volume 90; done
fi
exit
fi
##### PLAYLIST 1 ###
if [[ $ret -eq 3 ]]; then
#echo "Choose number of files in playlist:"
#read amount22
file112=$(yad --center --title='Choose Video File' --width=600 --height=400 --file-filter="Vid & Audio|*.mp4 *.mp4 *.wmv *.m4v *.m3v *.mpg *mpeg *.wav" --file --multiple --filename="/mnt/" --button="OK:0" --button="Exit and Play:1" )
ret22=$?
if [[ $ret22 -eq 1 ]];
then
exit
fi
echo "$file112">>/root/.Playlist.play
file113=$(yad --center --title='Choose Video File' --width=600 --height=400 --file-filter="Vid & Audio|*.mp4 *.mp4 *.wmv *.m4v *.m3v *.mpg *mpeg *.wav" --file --multiple --filename="/mnt/" --button="OK:0" --button="Exit and Play:1" )
ret22=$?
if [[ $ret22 -eq 1 ]];
then
exit
fi
echo "$file113">>/root/.Playlist.play
file114=$(yad --center --title='Choose Video File' --width=600 --height=400 --file-filter="Vid & Audio|*.mp4 *.mp4 *.wmv *.m4v *.m3v *.mpg *mpeg *.wav" --file --multiple --filename="/mnt/" --button="OK:0" --button="Exit and Play:1" )
ret22=$?
if [[ $ret22 -eq 1 ]];
then
exit
fi
echo "$file114">>/root/.Playlist.play
file115=$(yad --center --title='Choose Video File' --width=600 --height=400 --file-filter="Vid & Audio|*.mp4 *.mp4 *.wmv *.m4v *.m3v *.mpg *mpeg *.wav" --file --multiple --filename="/mnt/" --button="OK:0" --button="Exit and Play:1" )
ret22=$?
if [[ $ret22 -eq 1 ]];
then
exit
fi
echo "$file115">>/root/.Playlist.play
if [[ $subs1 -eq 1 ]]; then
urxvt -e mplayer -nosub -fs -vo xv -playlist /root/.Playlist.play
elif [[ $subs1 -eq 0 ]]; then
urxvt -e mplayer -fs -vo xv -playlist /root/.Playlist.play
fi
fi
############################################
if [[ $ret -eq 0 ]]; then
rm /root/.Playlist9.play # remove prior playlist
folder1=$(yad --center --title="Choose folder to play..." --file --directory --width=600 --height=400 --button="Exit:1" --button="OK:0")
ret8=$?
if [[ $ret8 -eq 1 ]]; then
exit 0
fi
cd "$folder1"
for f in *\ *; do mv "$f" "${f// /_}"; done
title9a=$(yad --center --title="Title For Playlist Folder" --form --field 'Playlist 9 Title' 'Folder by Mod Date')
title9=$(echo $title9a | awk 'BEGIN {FS="|" }{print $1}')
echo "$title9-folder" >/root/.title9.play
#while true; do
#file112=$(yad --center --title='Choose Video File' --width=600 --height=400 --file-filter="Vid & Audio|*.[Mm][Pp][4]* *.[Mm][Pp][3]* *.[Ww][Mm][Vv]* *.[Mm\[4][Vv]* *.[Mm][4][Aa]* .m3v *.mpg *mpeg" --file --filename="/mnt/" --button="OK:0" --button="Exit and Play:1" )
#ret22=$?
#if [[ $ret22 -eq 1 ]];
#then
#ls -d -1 -t $PWD/*.* >/root/.Playlist4.play
#find . -type f -print0 | xargs -0 ls -ltr | head -n 1 >/root/.Playlist4a.play
##
ls -d -l -t $PWD/*.* >/root/.Playlist9a.play
tac /root/.Playlist9a.play|awk 'BEGIN {FS=" " }{print $9}'>/root/.Playlist9.play #TAC is reverse cat very nice
#tail /root/.Playlist4.play
#awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }' /root/.Playlist4.play
#rm /root/.Playlist4a.play
if [[ $subs1 -eq 1 ]]; then
urxvt -e mplayer -nosub -fs -vo xv -playlist /root/.Playlist9.play
elif [[ $subs1 -eq 0 ]]; then
urxvt -e mplayer -fs -vo xv -playlist /root/.Playlist9.play
fi
exit
#fi
#echo "$file112">>/root/.Playlist4.play
#done
fi
################################################
# CREATE PLAYLIST 2 ### note: playlist 1 is two sections above
if [[ $ret -eq 1 ]]; then
#echo "Choose number of files in playlist:"
#read amount22
rm /root/.Playlist2.play # remove prior playlist
title2a=$(yad --center --title="Title For Playlist 2" --form --field 'Playlist 2 Title' 'Playlist2')
title2=$(echo $title2a | awk 'BEGIN {FS="|" }{print $1}')
while true; do
file112=$(yad --center --title='Choose Video File' --width=600 --height=400 --file-filter="Vid & Audio|*.[Mm][Pp][4]* *.[Mm][Pp][3]* *.[Ww][Aa][Vv]* *.wmv *.[Mm][4][Vv]* *.[Mm][4][Aa]* *.m3v *.mpg *mpeg" --file --multiple --filename="/mnt/" --button="OK:0" --button="Exit and Play:1" --button="Clear All:2" )
ret22=$?
if [[ $ret22 -eq 2 ]];
then
tab2="No Playlist-2"
echo "$tab2" >/root/.title2.play
exit
fi
if [[ $ret22 -eq 1 ]];
then
if [[ $subs1 -eq 1 ]]; then
urxvt -e mplayer -nosub -fs -vo xv -playlist /root/.Playlist2.play
elif [[ $subs1 -eq 0 ]]; then
urxvt -e mplayer -fs -vo xv -playlist /root/.Playlist2.play
fi
exit
fi
file112a=$(echo $file112 | awk 'BEGIN {FS="|" }{print $1}')
file112b=$(echo $file112 | awk 'BEGIN {FS="|" }{print $2}')
file112c=$(echo $file112 | awk 'BEGIN {FS="|" }{print $3}')
file112d=$(echo $file112 | awk 'BEGIN {FS="|" }{print $4}')
file112e=$(echo $file112 | awk 'BEGIN {FS="|" }{print $5}')
file112f=$(echo $file112 | awk 'BEGIN {FS="|" }{print $6}')
file112g=$(echo $file112 | awk 'BEGIN {FS="|" }{print $7}')
file112h=$(echo $file112 | awk 'BEGIN {FS="|" }{print $8}')
file112i=$(echo $file112 | awk 'BEGIN {FS="|" }{print $9}')
file112j=$(echo $file112 | awk 'BEGIN {FS="|" }{print $10}')
file112k=$(echo $file112 | awk 'BEGIN {FS="|" }{print $11}')
file112l=$(echo $file112 | awk 'BEGIN {FS="|" }{print $12}')
file112m=$(echo $file112 | awk 'BEGIN {FS="|" }{print $13}')
file112n=$(echo $file112 | awk 'BEGIN {FS="|" }{print $14}')
file112o=$(echo $file112 | awk 'BEGIN {FS="|" }{print $15}')
echo "$file112a">>/root/.Playlist2.play
echo "$file112b">>/root/.Playlist2.play
echo "$file112c">>/root/.Playlist2.play
echo "$file112d">>/root/.Playlist2.play
echo "$file112e">>/root/.Playlist2.play
echo "$file112f">>/root/.Playlist2.play
echo "$file112g">>/root/.Playlist2.play
echo "$file112h">>/root/.Playlist2.play
echo "$file112i">>/root/.Playlist2.play
echo "$file112j">>/root/.Playlist2.play
echo "$file112k">>/root/.Playlist2.play
echo "$file112l">>/root/.Playlist2.play
echo "$file112m">>/root/.Playlist2.play
echo "$file112n">>/root/.Playlist2.play
echo "$file112o">>/root/.Playlist2.play
echo $title2 >/root/.title2.play # Note the .title2.play is a hidden file
done
fi
## CREATE PLAYLIST 3 ##
if [[ $ret -eq 8 ]]; then
#echo "Choose number of files in playlist:"
#read amount22
rm /root/.Playlist3.play # remove prior playlist
title3a=$(yad --center --title="Title For Playlist 3" --form --field 'Playlist 3 Title' 'Playlist3')
title3=$(echo $title3a | awk 'BEGIN {FS="|" }{print $1}')
while true; do
file112=$(yad --center --title='Choose Video File' --width=600 --height=400 --file-filter="Vid & Audio|*.[Mm][Pp][4]* *.[Ww][Aa][Vv]* *.[Mm][Pp][3]* *.wmv *.[Mm][4][Vv]* *.m3v *.mpg *mpeg" --file --multiple --filename="/mnt/" --button="OK:0" --button="Exit and Play:1" --button="Clear:2" )
ret22=$?
if [[ $ret22 -eq 2 ]];
then
tab3="No Playlist-3"
echo "$tab3" >/root/.title3.play
exit
fi
if [[ $ret22 -eq 1 ]];
then
if [[ $subs1 -eq 1 ]]; then
urxvt -e mplayer -nosub -fs -vo xv -playlist /root/.Playlist3.play
elif [[ $subs1 -eq 0 ]]; then
urxvt -e mplayer -fs -vo xv -playlist /root/.Playlist3.play
fi
exit
fi
file112a=$(echo $file112 | awk 'BEGIN {FS="|" }{print $1}')
file112b=$(echo $file112 | awk 'BEGIN {FS="|" }{print $2}')
file112c=$(echo $file112 | awk 'BEGIN {FS="|" }{print $3}')
file112d=$(echo $file112 | awk 'BEGIN {FS="|" }{print $4}')
file112e=$(echo $file112 | awk 'BEGIN {FS="|" }{print $5}')
file112f=$(echo $file112 | awk 'BEGIN {FS="|" }{print $6}')
file112g=$(echo $file112 | awk 'BEGIN {FS="|" }{print $7}')
file112h=$(echo $file112 | awk 'BEGIN {FS="|" }{print $8}')
file112i=$(echo $file112 | awk 'BEGIN {FS="|" }{print $9}')
file112j=$(echo $file112 | awk 'BEGIN {FS="|" }{print $10}')
file112k=$(echo $file112 | awk 'BEGIN {FS="|" }{print $11}')
file112l=$(echo $file112 | awk 'BEGIN {FS="|" }{print $12}')
file112m=$(echo $file112 | awk 'BEGIN {FS="|" }{print $13}')
file112n=$(echo $file112 | awk 'BEGIN {FS="|" }{print $14}')
file112o=$(echo $file112 | awk 'BEGIN {FS="|" }{print $15}')
echo "$file112a">>/root/.Playlist3.play
echo "$file112b">>/root/.Playlist3.play
echo "$file112c">>/root/.Playlist3.play
echo "$file112d">>/root/.Playlist3.play
echo "$file112e">>/root/.Playlist3.play
echo "$file112f">>/root/.Playlist3.play
echo "$file112g">>/root/.Playlist3.play
echo "$file112h">>/root/.Playlist3.play
echo "$file112i">>/root/.Playlist3.play
echo "$file112j">>/root/.Playlist3.play
echo "$file112k">>/root/.Playlist3.play
echo "$file112l">>/root/.Playlist3.play
echo "$file112m">>/root/.Playlist3.play
echo "$file112n">>/root/.Playlist3.play
echo "$file112o">>/root/.Playlist3.play
echo $title3 >/root/.title3.play
done
fi
### CREATE PLAYLIST 1 ### PLAYLIST 1
if [[ $ret -eq 5 ]]; then
rm /root/.Playlist.play # remove prior playlist
title1a=$(yad --center --title="Title For Playlist 1" --form --field 'Playlist 1 Title' 'Playlist1')
title1=$(echo $title1a | awk 'BEGIN {FS="|" }{print $1}')
while true; do
file112=$(yad --center --title='Choose Video File' --width=600 --height=400 --file-filter="Vid & Audio|*.[Mm][Pp][4]* *.[Ww][Aa][Vv]* *.[Mm][Pp][3] *.wmv *.m4v *.m3v *.mpg *mpeg" --file --multiple --filename="/mnt/" --button="OK:0" --button="Exit and Play:1" --button="Clear:2" )
ret22=$?
if [[ $ret22 -eq 2 ]];
then
tab1="No Playlist-1"
echo "$tab1" >/root/.title1.play
exit
fi
if [[ $ret22 -eq 1 ]];
then
if [[ $subs1 -eq 1 ]]; then
urxvt -e mplayer -nosub -fs -vo xv -playlist /root/.Playlist.play
elif [[ $subs1 -eq 0 ]]; then
urxvt -e mplayer -fs -vo xv -playlist /root/.Playlist.play
fi
exit
fi
file112a=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $1}')
file112b=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $2}')
file112c=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $3}')
file112d=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $4}')
file112e=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $5}')
file112f=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $6}')
file112g=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $7}')
file112h=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $8}')
file112i=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $9}')
file112j=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $10}')
file112k=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $11}')
file112l=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $12}')
file112m=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $13}')
file112n=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $14}')
file112o=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $15}')
file112p=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $16}')
file112q=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $17}')
file112r=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $18}')
file112s=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $19}')
file112t=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $20}')
file112u=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $21}')
file112v=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $22}')
file112w=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $23}')
file112x=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $24}')
file112y=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $25}')
file112z=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $26}')
file112A=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $27}')
file112B=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $28}')
file112C=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $29}')
file112D=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $30}')
file112E=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $31}')
file112F=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $32}')
file112G=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $33}')
file112H=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $34}')
file112I=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $35}')
file112J=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $36}')
file112K=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $37}')
file112L=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $38}')
file112M=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $39}')
file112N=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $40}')
file112O=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $41}')
file112P=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $42}')
file112Q=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $43}')
file112R=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $44}')
file112S=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $45}')
file112T=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $46}')
file112U=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $47}')
file112V=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $48}')
file112W=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $49}')
file112X=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $50}')
file112Y=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $51}')
file112Z=$(echo "$file112" | awk 'BEGIN {FS="|" }{print $52}')
echo "$file112a">>/root/.Playlist.play
echo "$file112b">>/root/.Playlist.play
echo "$file112c">>/root/.Playlist.play
echo "$file112d">>/root/.Playlist.play
echo "$file112e">>/root/.Playlist.play
echo "$file112f">>/root/.Playlist.play
echo "$file112g">>/root/.Playlist.play
echo "$file112h">>/root/.Playlist.play
echo "$file112i">>/root/.Playlist.play
echo "$file112j">>/root/.Playlist.play
echo "$file112k">>/root/.Playlist.play
echo "$file112l">>/root/.Playlist.play
echo "$file112m">>/root/.Playlist.play
echo "$file112n">>/root/.Playlist.play
echo "$file112o">>/root/.Playlist.play
echo "$file112p">>/root/.Playlist.play
echo "$file112q">>/root/.Playlist.play
echo "$file112r">>/root/.Playlist.play
echo "$file112s">>/root/.Playlist.play
echo "$file112t">>/root/.Playlist.play
echo "$file112u">>/root/.Playlist.play
echo "$file112v">>/root/.Playlist.play
echo "$file112w">>/root/.Playlist.play
echo "$file112x">>/root/.Playlist.play
echo "$file112y">>/root/.Playlist.play
echo "$file112z">>/root/.Playlist.play
echo "$file112A">>/root/.Playlist.play
echo "$file112B">>/root/.Playlist.play
echo "$file112C">>/root/.Playlist.play
echo "$file112D">>/root/.Playlist.play
echo "$file112E">>/root/.Playlist.play
echo "$file112F">>/root/.Playlist.play
echo "$file112G">>/root/.Playlist.play
echo "$file112H">>/root/.Playlist.play
echo "$file112I">>/root/.Playlist.play
echo "$file112J">>/root/.Playlist.play
echo "$file112K">>/root/.Playlist.play
echo "$file112L">>/root/.Playlist.play
echo "$file112M">>/root/.Playlist.play
echo "$file112N">>/root/.Playlist.play
echo "$file112O">>/root/.Playlist.play
echo "$file112P">>/root/.Playlist.play
echo "$file112Q">>/root/.Playlist.play
echo "$file112R">>/root/.Playlist.play
echo "$file112S">>/root/.Playlist.play
echo "$file112T">>/root/.Playlist.play
echo "$file112U">>/root/.Playlist.play
echo "$file112V">>/root/.Playlist.play
echo "$file112W">>/root/.Playlist.play
echo "$file112X">>/root/.Playlist.play
echo "$file112Y">>/root/.Playlist.play
echo "$file112Z">>/root/.Playlist.play
echo $title1 >/root/.title1.play
done
fi
# Playlist 4
if [[ $ret -eq 9 ]]; then
rm /root/.Playlist4.play # remove prior playlist
title4a=$(yad --center --title="Title For Playlist 4" --form --field 'Playlist 4 Title' 'Playlist4')
title4=$(echo $title4a | awk 'BEGIN {FS="|" }{print $1}')
while true; do
file112=$(yad --center --title='Choose Video File' --width=600 --height=400 --file-filter="Vid & Audio|*.[Mm][Pp][4]* *.[Mm][Pp][3]* *.[Ww][Mm][Vv]* *.[Mm\[4][Vv]* *.[Mm][4][Aa]* .m3v *.mpg *mpeg" --file --multiple --filename="/mnt/" --button="OK:0" --button="Exit and Play:1" --button="Clear:2" )
ret22=$?
if [[ $ret22 -eq 2 ]];
then
tab4="No Playlist-4"
echo "$tab4" >/root/.title4.play
exit
fi
if [[ $ret22 -eq 1 ]];
then
if [[ $subs1 -eq 1 ]]; then
urxvt -e mplayer -nosub -fs -vo xv -playlist /root/.Playlist4.play
elif [[ $subs1 -eq 0 ]]; then
urxvt -e mplayer -fs -vo xv -playlist /root/.Playlist4.play
fi
exit
fi
file112a=$(echo $file112 | awk 'BEGIN {FS="|" }{print $1}')
file112b=$(echo $file112 | awk 'BEGIN {FS="|" }{print $2}')
file112c=$(echo $file112 | awk 'BEGIN {FS="|" }{print $3}')
file112d=$(echo $file112 | awk 'BEGIN {FS="|" }{print $4}')
file112e=$(echo $file112 | awk 'BEGIN {FS="|" }{print $5}')
file112f=$(echo $file112 | awk 'BEGIN {FS="|" }{print $6}')
file112g=$(echo $file112 | awk 'BEGIN {FS="|" }{print $7}')
file112h=$(echo $file112 | awk 'BEGIN {FS="|" }{print $8}')
file112i=$(echo $file112 | awk 'BEGIN {FS="|" }{print $9}')
file112j=$(echo $file112 | awk 'BEGIN {FS="|" }{print $10}')
file112k=$(echo $file112 | awk 'BEGIN {FS="|" }{print $11}')
file112l=$(echo $file112 | awk 'BEGIN {FS="|" }{print $12}')
file112m=$(echo $file112 | awk 'BEGIN {FS="|" }{print $13}')
file112n=$(echo $file112 | awk 'BEGIN {FS="|" }{print $14}')
file112o=$(echo $file112 | awk 'BEGIN {FS="|" }{print $15}')
echo "$file112a">>/root/.Playlist4.play
echo "$file112b">>/root/.Playlist4.play
echo "$file112c">>/root/.Playlist4.play
echo "$file112d">>/root/.Playlist4.play
echo "$file112e">>/root/.Playlist4.play
echo "$file112f">>/root/.Playlist4.play
echo "$file112g">>/root/.Playlist4.play
echo "$file112h">>/root/.Playlist4.play
echo "$file112i">>/root/.Playlist4.play
echo "$file112j">>/root/.Playlist4.play
echo "$file112k">>/root/.Playlist4.play
echo "$file112l">>/root/.Playlist4.play
echo "$file112m">>/root/.Playlist4.play
echo "$file112n">>/root/.Playlist4.play
echo "$file112o">>/root/.Playlist4.play
#echo "$file112">>/root/.Playlist4.play
echo $title4 >/root/.title4.play
done
fi
Posted: Sat 27 Jan 2018, 03:42
by some1
....meanwhile..slightly off-topic
slavvo67:
Consider this:
Code: Select all
#extract leftmost 15-items
awk -v RS="[|\n]" 'NR<=15' <<<"$file112" >Playlist2.play
Posted: Sat 27 Jan 2018, 15:14
by stemsee
Here is an idea I would like to get working.
Code: Select all
mkfifo -m 755 /tmp/PIPE9 2>/dev/null
exec 9<> /tmp/PIPE9
function scan (){
PATTERN='
s/^.*ESSID://p'
MENU=`iwlist wlan2 scan | sed -rn "$PATTERN" | tac | tr '\n' '|'`
list=`echo $MENU >/tmp/scan`
echo "menu:$MENU" >&9 &
}
export -f scan
yad --notification --icon=/usr/share/pixmaps/wireless.png --listen --text="Scanner" --command="geany /tmp/scan" <&9 &
while true
do
bash -c scan
sleep 4
done
This uses yad --notification --listen to change menu items. In this usage the menu items are the APs found from iwlist scan. The APs are one per line, "AP1"|"AP2"|"AP3" how to interpolate
Code: Select all
!bash -c connect1!/usr/share/pixmaps/wireless.png|
"AP1"|bash -c connect1|/usr/share/pixmaps/wireless.png|"AP2"!bash -c connect2!/usr/share/pixmaps/wireless.png|
The problems I need to help to solve are 1) only scan on click.
2) click on menu item to select AP to connect with
3) show an icon next to each AP entry
Posted: Sat 27 Jan 2018, 15:55
by slavvo67
Hi Some1:
Keeping in mind that each of the below are separate user inputs (which can be grabbed in bulk with the shift or ctrl buttons in the YAD window), I'm not sure your script would work. I could and should consolidate the script with a for / do loop but it's been working as is so I haven't really attacked my code; yet...
file112a=$(echo $file112 | awk 'BEGIN {FS="|" }{print $1}')
file112b=$(echo $file112 | awk 'BEGIN {FS="|" }{print $2}')
file112c=$(echo $file112 | awk 'BEGIN {FS="|" }{print $3}')
file112d=$(echo $file112 | awk 'BEGIN {FS="|" }{print $4}')
I find your script interesting, however. Thanks for that!
Posted: Sat 27 Jan 2018, 21:42
by step
@slavvo67 --columns applies to --form buttons only. AFAIK there is no way to layout --button's in a grid. I will gladly stand corrected. Yad lays out all --buttons in a single horizontal row (default) or a single vertical column (by means of a style file). Tested with yad 0.36.3.
1x4 because --columns=2 is rightly ignored
Code: Select all
# yad --columns=2 --button=gtk-ok --button=gtk-cancel --button=gtk-yes --button=gtk-no &
2x2 because --columns=2 applies to --form
Code: Select all
# yad --columns=2 --no-buttons --form --field=gtk-ok:FBTN '' --field=gtk-cancel:FBTN '' --field=gtk-yes:FBTN '' --field=gtk-no:FBTN '' &
Posted: Sun 28 Jan 2018, 00:10
by slavvo67
Thanks, Step. So I gather passing the button values in your example would require an awk command? We're not numbering the buttons like in my YAD example.
Posted: Sun 28 Jan 2018, 02:47
by misko_2083
stemsee wrote:Here is an idea I would like to get working.
Code: Select all
mkfifo -m 755 /tmp/PIPE9 2>/dev/null
exec 9<> /tmp/PIPE9
function scan (){
PATTERN='
s/^.*ESSID://p'
MENU=`iwlist wlan2 scan | sed -rn "$PATTERN" | tac | tr '\n' '|'`
list=`echo $MENU >/tmp/scan`
echo "menu:$MENU" >&9 &
}
export -f scan
yad --notification --icon=/usr/share/pixmaps/wireless.png --listen --text="Scanner" --command="geany /tmp/scan" <&9 &
while true
do
bash -c scan
sleep 4
done
This uses yad --notification --listen to change menu items. In this usage the menu items are the APs found from iwlist scan. The APs are one per line, "AP1"|"AP2"|"AP3" how to interpolate
Code: Select all
!bash -c connect1!/usr/share/pixmaps/wireless.png|
"AP1"|bash -c connect1|/usr/share/pixmaps/wireless.png|"AP2"!bash -c connect2!/usr/share/pixmaps/wireless.png|
The problems I need to help to solve are 1) only scan on click.
2) click on menu item to select AP to connect with
3) show an icon next to each AP entry
This is an example that opens a text-info dialog when you click the item in the notification dialog's popup menu.
Code: Select all
#!/bin/bash
mkfifo -m 755 /tmp/PIPE9 2>/dev/null
trap "rm -f /tmp/PIPE9" EXIT
exec 9<> /tmp/PIPE9
function scan (){
PATTERN='
s/^.*ESSID://p'
iwlist wlan2 scan | sed -rn "$PATTERN" | tac >/tmp/scan
MENU="$(while read -r line ;do
printf "%s" "Connect $line!bash -c "yad --text-info --width=400 --height=300 <<<$(echo $line)"!/usr/share/pixmaps/wireless.png|"
done < /tmp/scan)"
echo "icon:/usr/share/pixmaps/wireless.png" >/tmp/PIPE9
echo "tooltip:Tooltip" >/tmp/PIPE9
echo "menu:Refresh!bash -c scan!gtk-refresh|About!bash -c 'yad --about'!gtk-about||$MENU|Quit!quit!gtk-quit" >/tmp/PIPE9
}
export -f scan
yad --notification --listen --text="Scanner" --command="geany /tmp/scan" <&9 & NOTIF_ICON=$!
sleep 1
bash -c scan
wait $NOTIF_ICON
Posted: Sun 28 Jan 2018, 17:43
by step
Posted: Mon 29 Jan 2018, 01:10
by stemsee
misko_2083 wrote:
This is an example that opens a text-info dialog when you click the item in the notification dialog's popup menu.
This is fantastic magic!
I have adapted your code a bit. removed the bashism '<<<' so more portable > '/bin/sh'
Seems to be working well.
I call the script netmenu
netmenu-0.1-alpha
Code: Select all
#!/bin/sh
#
depsfn () { # check dependencies
dhclu=`busybox which udhcpc`
dhcld=`busybox which dhcpcd`
if [[ ! -z "${dhclu}" ]]; then
dhl1="udhcpc -A 8 -p /var/run/udhcpc.pid -s /usr/share/udhcpc/default.script -i"
dhl2="/usr/share/udhcpc/default.script deconfig"
dhl3="udhcpc"
elif [[ -z "${dhclu}" ]]; then
dhl1="dhcpcd -z"
dhl2="dhcpcd -k"
dhl3="dhcpcd"
elif [[ -z "${dhclu}" && -z "${dhcld}" ]]; then
zenity --info --text "$dhclu and $dhcld not found"
echo "$dhclu and $dhcld not found"
fi
export dhl1
export dhl2
export dhl3
}
depsfn
interfacefn () {
for wit in `ls /sys/class/net`
do
case $wit in
wl*) int=${wit};;
eth0|eth2|eth4|eth6|enp2s0f2) eth=${wit};;
eth1|eth3|eth5|eth7) eths=${wit};;
enp0s20u3|usb0|usb1) usb0=${wit};;
esac
done
}
interfacefn
if [[ "$1" = eth0-u ]]; then
ifconfig ${eth} up
${dhl1} ${eth}
exit
fi
if [[ "$1" = eth0-d ]]; then
ifconfig ${eth} down
${dhl2} ${eth}
exit
fi
if [[ "$1" = usb0-u ]]; then
ifconfig ${usb0} up
${dhl1} ${usb0}
exit
fi
if [[ "$1" = usb0-d ]]; then
ifconfig ${usb0} down
${dhl2} ${usb0}
exit
fi
mkfifo -m 755 /tmp/PIPE9 2>/dev/null
exec 9<> /tmp/PIPE9
if [[ -z "$int" ]]; then
int=`ls /sys/class/net/ | grep -v lo | grep -v eth | grep -v usb | head -1`
fi
export int
ifconfig $int up
touch /tmp/ap
function cleanfinish (){
rm -f /tmp/PIPE9
rm -f /tmp/netsel
rm -f /tmp/scan
rm -f /tmp/scan2
rm -f /tmp/n
ifconfig $int down
"$dhl2" $int
}
trap cleanfinish EXIT
function connectfn (){
details=$(yad --form --columns=2 --field="Password:H" -entry "" --field="ID" -entry "")
password=`echo $details | cut -f1 -d'|'`
id=`echo $details | cut -f2 -d'|'`
while read line
do
ssid="$line"
done < /tmp/ap
if [[ ! -z "$id" && ! -z "$password" ]]; then
echo "ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
update_config=1
network={
ssid='$ssid'
identity='$id'
password='$password'
key_mgmt=WPA-EAP
eap=PEAP
#ca_cert='$HOME/.wifi-connect/ca.pem'
#phase1='peaplabel=0'
phase2='auth=MSCHAPV2'
}
" | tr "'" '"' > /tmp/netsel
elif [[ ! -z "$password" && -z "$id" ]]; then
wpa_passphrase "$ssid" "$password" > /tmp/netsel
elif [[ -z "$password" && -z "$id" ]]; then
echo "ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
update_config=1
network={
ssid='$ssid'
#bssid=$address
key_mgmt=NONE
}
" | tr "'" '"' > /tmp/netsel
fi
CURRENTIPS=$(ip addr show | grep $int | grep inet | awk '{print $2}')
ifconfig $int down
for I in ${CURRENTIPS}; do ip addr del $I dev ${int}; done 2> /dev/null
ip route flush dev $int 2> /dev/null
killall -9 $dhl3 2> /dev/null
killall -9 wpa_supplicant 2> /dev/null
rm -f /var/db/$dhl3-${int}.lease 2> /dev/null
rm -f /var/lib/$dhl3/$dhl3-${int}.lease 2> /dev/null
rm -f /var/run/wpa_supplicant/$int 2> /dev/null
ifconfig $int up 2> /dev/null
wpa_supplicant -Dwext -i$int -c/tmp/netsel -B
$dhl1 $int
}
export -f connectfn
function inotify (){
while inotifywait -e close_write /tmp/ap
do
bash -c connectfn
sleep 10
done
}
export -f inotify
bash -c inotify &
function scan (){
PATTERN='s/^.*key:([onf]*)/~\1~/p
s/^.*ESSID://p'
iwlist $int scan | sed -rn "$PATTERN" >/tmp/scan2
cat /tmp/scan2 | grep -v [onf] > /tmp/scan
cat /tmp/scan2 | grep -e'~on~' -e '~off~' > /tmp/encryption
MENU="$(while read -r line ;do
printf "%s" "$int ${line}!bash -c "echo "$line" > /tmp/ap"!/usr/share/pixmaps/wireless.png|"
done < /tmp/scan)"
sixth="Ethernet connect!netmenu eth0-u!/usr/share/icons/oxygen/22x22/devices/network-wired.png|"
seventh="Ethernet disconnect!netmenu eth0-d!/usr/share/icons/oxygen/22x22/devices/network-wiredx.png|"
tenth="Connect mobile!netmenu usb0-u!/usr/share/icons/oxygen/22x22/devices/phone.png|"
eleventh="Disconnect mobile!netmenu usb0-d!/usr/share/icons/oxygen/22x22/devices/phonex.png|"
echo "icon:/usr/share/pixmaps/wireless.png" >/tmp/PIPE9
echo "tooltip:$int" >/tmp/PIPE9
echo "menu:Refresh!bash -c scan!gtk-refresh|About!bash -c 'yad --about'!gtk-about||$MENU|$sixth$seventh$tenth$eleventh||Quit!quit!gtk-quit" >/tmp/PIPE9
}
export -f scan
yad --notification --listen --text="Scanner" --command="geany /tmp/encryption" <&9 & NOTIF_ICON=$!
sleep 1
bash -c scan
wait $NOTIF_ICON
Posted: Tue 30 Jan 2018, 09:47
by stemsee
The MENU portion of this code preserves spaces for the yad menu, but when printed to the /tmp/ap file the space within quoted AP name disappears! i have tried variations of echo, printf, tee, redirections, bracketing, quoting ... but nothing I have tried works. There is one way that prints the desired format "My Way Cafe" but it does not print the selected item, just the first one slips through. Here is the suspect code that loses the space
Code: Select all
MENU="$(while read -r line ;do
printf %s "${line}!bash -c \"echo "$line" > /tmp/ap\"!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"
this is the variation that prints a line, not the selected line, in correct format
Code: Select all
MENU="$(while read -r line ;do
printf %s "${line}!bash -c \"$(echo "$line" > /tmp/ap)\"!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"
/tmp/ap is being watched by inotifywait -e close_write which triggers 'bash -c connectfn'. It connects after first scan without selecting AP, because one slips through! I know this is more of a coding issue than a yad issue, although it is in a yad menu, but any further help appreciated.
Posted: Tue 30 Jan 2018, 19:52
by misko_2083
stemsee wrote:The MENU portion of this code preserves spaces for the yad menu, but when printed to the /tmp/ap file the space within quoted AP name disappears! i have tried variations of echo, printf, tee, redirections, bracketing, quoting ... but nothing I have tried works. There is one way that prints the desired format "My Way Cafe" but it does not print the selected item, just the first one slips through. Here is the suspect code that loses the space
Code: Select all
MENU="$(while read -r line ;do
printf %s "${line}!bash -c "echo "$line" > /tmp/ap"!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"
this is the variation that prints a line, not the selected line, in correct format
Code: Select all
MENU="$(while read -r line ;do
printf %s "${line}!bash -c "$(echo "$line" > /tmp/ap)"!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"
/tmp/ap is being watched by inotifywait -e close_write which triggers 'bash -c connectfn'. It connects after first scan without selecting AP, because one slips through! I know this is more of a coding issue than a yad issue, although it is in a yad menu, but any further help appreciated.
The problems are with escaping quotes and spaces.
As a workaround you can use print %q
printf %q "$line" escapes quotes and spaces
"MC\ cm"\ ~on~
later when you use echo -e
it will return
"MC cm" ~on~
Code: Select all
MENU="$(while read -r line ;do
WIFI="$(printf %q "$line")"
printf "%s" "${line}!bash -c 'echo -e ${WIFI} > /tmp/ap'!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"
Works for echo too.
Code: Select all
MENU="$(while read -r line ;do
WIFI="$(printf %q "$line")"
echo -ne "${line}!bash -c 'echo -e ${WIFI} > /tmp/ap'!/usr/share/pixmaps/wireless.png|"
done < /tmp/text)"
Note that special characters in the hotspot name like "!" and "|" will make a mess in the righ-click popup because they are used as the splitters in yad --notification dialog.
One more thing I spoted in the script. No need for opening pipe and extra cat command.
Code: Select all
cat file | grep "something" > file2
grep has built in that can read files
Posted: Wed 31 Jan 2018, 10:35
by stemsee
Thanks @ misko_2083
'cat grep' novice error. I now know 'grep -v -e' for multiple inversions, after some research. grep --help yields only '-v, --invert-match select non-matching lines'
Your code now works perfectly. A great lesson in itself!
I had already implemented a workaround, in the pop up gui for password/id input, I simply listed scan results selector.
Thanks again
stem
Posted: Sun 04 Feb 2018, 11:46
by fredx181
Hello,
I'm having a similar problem as stemsee had above (space not showing), but for me it's the underscore not showing in the yad notification menu.
For example, I have filenames in /root/test contaning underscores
Code: Select all
root@live:~/test# ls
my_file_1 my_file_2 my_file_3
My goal is to list these files in the yad menu and process them further, however the processing works fine (open the files with leafpad, for example), the filenames are missing underscores in the menu (see screenshot)
Anyone understands what's happening here? When I uncomment "set -x" in the create_menu function, I see all names displayed correctly, here's simplified script:
Code: Select all
#!/bin/bash
on_click() {
# Help text
echo -en " Helptext \n\n text" | yad --title="Help" --text-info --wrap --fore=white --back="gray26" --fontname=Bold --height=350 --width=500 --button="gtk-close"
}
export -f on_click
quit_tray () {
pidnoti="`ps -eo pid,cmd | grep -v grep | grep "yad --notification --text=$POPUP_TEXT" | awk '{ print $1 }'`"
kill $pidnoti 2> /dev/null
rm -f $PIPE
}
export -f quit_tray
exec_file () {
leafpad "$DIR/$file"
# and/or more stuff to do with $file
}
export -f exec_file
create_menu () {
# set -x
export DIR="/root/test"
LISTFILES="$(ls "$DIR" 2> /dev/null)"
MENU=$(
while read -r file; do
[ -n "$LISTFILES" ] && echo -n "${file}! bash -c 'export file=$file; exec_file'!gtk-ok|"
done <<< "$LISTFILES")
}
export -f create_menu
TRAY_ICON="gtk-directory"
POPUP_TEXT="Menu"
export PIPE=$(mktemp -u --tmpdir ${0##*/}.XXXXXXXX)
mkfifo $PIPE
# attach a file descriptor to the file
exec 3<> $PIPE
create_menu
GET_MENU="${MENU}|Exit! bash -c quit_tray!gtk-quit"
echo menu:"${GET_MENU}" 2> /dev/null >&3
GUI=$(yad --notification --text="$POPUP_TEXT" --listen \
--image="$TRAY_ICON" \
--text="$POPUP_TEXT" \
--command="bash -c on_click" <&3 ) & NOTIF_ICON=$!
wait $NOTIF_ICON #misko_2083
Posted: Sun 04 Feb 2018, 17:00
by some1
fredx181
Yad/the gui probably interpretes a single underscore - as an indication of an accellerator-key/shortcut.
Replace:
Code: Select all
[ -n "$LISTFILES" ] && echo -n "${file}....
with
Code: Select all
[ -n "$LISTFILES" ] && echo -n "${file//_/__}....
and you will see the filenames with underscore(s) in the tray-menu.
Please observe that
file is also a command-name.
You may want to use a different varname.
Posted: Sun 04 Feb 2018, 18:03
by fredx181
some1 wrote:Replace:
Code:
[ -n "$LISTFILES" ] && echo -n "${file}....
with
Code:
[ -n "$LISTFILES" ] && echo -n "${file//_/__}....
and you will see the filenames with underscore(s) in the tray-menu.
Great !! Works perfectly, didn't expect the solution would be that simple, many thanks, some1 !
Please observe that file is also a command-name.
Yeah, good advice, better be safe.
EDIT: Here's the program I made with the concept of a file list in the menu and processing them further (in this case by loading or unloading a .squashfs or .sfs module)
http://murga-linux.com/puppy/viewtopic. ... 262#982262
I'm pretty excited about what y'all can do with the yad tray icon menu
Thanks stemsee and misko_2083 !!
Fred
Posted: Thu 08 Feb 2018, 15:04
by matchpoint
Hey Puppers,
Since I'm not yet too familiar with YAD, I'm hoping someone here can show me what this might look like piped into YAD. TIA.
Code: Select all
#!/bin/bash
echo "*** Temperature scale conversion ***"
echo "1. Convert Celsius to Fahrenheit"
echo "2. Convert Fahrenheit to Celsius"
echo -n "Select 1 or 2, then Enter:"
read choice
if [ $choice -eq 1 ]
then
echo -n "Enter temperature (C) : "
read tc
# formula Tf=(9/5)*Tc+32
tf=$(echo "scale=2;((9/5) * $tc) + 32" |bc)
echo "$tc C = $tf F"
elif [ $choice -eq 2 ]
then
echo -n "Enter temperature (F) : "
read tf
# formula Tc=(5/9)*(Tf-32)
tc=$(echo "scale=2;(5/9)*($tf-32)"|bc)
echo "$tf F = $tc C"
else
echo "Please select 1 or 2 only"
exit 1
fi
echo -n "
--> Press any key to exit "
read echoice
exit 0