2424# #############################################################
2525# #############################################################
2626#
27- LIB_VERSION=" 15.0.1 "
27+ LIB_VERSION=" 15.0.2 "
2828LIB_NAME=" easybashgui.lib"
2929LIB_URL=" https://github.com/BashGui/easybashgui"
3030LIB_AUTHOR=" Vittorio Cagnetta"
@@ -151,7 +151,7 @@ string_to_clean=':1: error: unexpected .*, expected .* - e.g. .*'
151151#
152152# ####################################
153153#
154- # ... yad, gtkdialog, kdialog, zenity, Xdialog, gum or dialog ??? ( since its experimental support, "qarma" has to be forced through "supermode")
154+ # ... yad, gtkdialog, kdialog, zenity, Xdialog, gum or dialog ? (NOTE: since its experimental support, "qarma" has to be forced through "supermode")
155155#
156156# ###############
157157#
@@ -500,7 +500,7 @@ if [ "${yad}" = "SI" ]
500500 if [ " ${mode} " != " dialog" -a " ${mode} " != " kdialog" ] # ...whatever dialog but "dialog" and "kdialog", moreover...
501501 then
502502 # ...only if DISPLAY var is set...
503- if [ ${# DISPLAY} -gt 0 ]
503+ if [ ${# WAYLAND_DISPLAY} -gt 0 -o ${ # DISPLAY} -gt 0 ]
504504 then
505505 # ;)
506506 mode=" yad"
@@ -903,16 +903,28 @@ elif [ "${mode}" = "gtkdialog" ]
903903 #
904904elif [ " ${mode} " = " kdialog" ]
905905 then
906- x_root=$( xwininfo -root | gsed -n s\# ' ^.*-geometry[[:blank:]]\([[:digit:]]\+\)[[:alpha:]]\([[:digit:]]\+\).*$' # '\1'#p )
907- y_root=$( xwininfo -root | gsed -n s\# ' ^.*-geometry[[:blank:]]\([[:digit:]]\+\)[[:alpha:]]\([[:digit:]]\+\).*$' # '\2'#p )
908- if [ ${# x_root} -gt 0 -a ${# y_root} -gt 0 ]
906+ esistenza_xwininfo=" $( type " xwininfo" 2> /dev/null ) "
907+ if [ ${# esistenza_xwininfo} -gt 0 ]
909908 then
910- x=" +$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
911- y=" +$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
909+ #
910+ x_root=$( xwininfo -root | gsed -n s\# ' ^.*-geometry[[:blank:]]\([[:digit:]]\+\)[[:alpha:]]\([[:digit:]]\+\).*$' # '\1'#p )
911+ y_root=$( xwininfo -root | gsed -n s\# ' ^.*-geometry[[:blank:]]\([[:digit:]]\+\)[[:alpha:]]\([[:digit:]]\+\).*$' # '\2'#p )
912+ if [ ${# x_root} -gt 0 -a ${# y_root} -gt 0 ]
913+ then
914+ x=" +$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
915+ y=" +$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
916+ fi
917+ #
918+ # => then:
919+ dimensione_finestra=" --geometry=${width} x${height}${x}${y} "
920+ dimensione_finestra_1=" --geometry=${width} x${height}${x}${y} "
921+ #
922+ else
923+ #
924+ dimensione_finestra=" "
925+ dimensione_finestra_1=" "
926+ #
912927 fi
913- #
914- dimensione_finestra=" --geometry=${width} x${height}${x}${y} "
915- dimensione_finestra_1=" --geometry=${width} x${height}${x}${y} "
916928 dimensione_finestra_2=" "
917929 no_tags=" "
918930 no_buttons=" "
@@ -8284,22 +8296,81 @@ elif [ "${mode}" = "kdialog" ]
82848296 #
82858297 fi # if [ ${#} -ge 2 ]
82868298 #
8287- qdbus_or_dcop=" $( if [ $( echo -n " $( type qdbus 2> /dev/null) " | wc -c ) -gt 0 ]
8299+ qdbus_or_dcop=" qdbus"
8300+ export qdbus_bin=" $( for dir in $( echo $PATH | tr ' :' ' \n' ) ; do find " $dir " -name " qdbus" ; done | head -n 1 ) "
8301+ if [ ${# qdbus_bin} -gt 0 ]
8302+ then
8303+ #
8304+ : qdbus_or_dcop
8305+ : qdbus_bin
8306+ qdbus_or_dcop_bin=" ${qdbus_bin} "
8307+ #
8308+ else
8309+ #
8310+ export qdbus_bin=" $( for dir in $( echo $PATH | tr ' :' ' \n' ) ; do find " $dir " -name " qdbus?" ; done | head -n 1 ) "
8311+ if [ ${# qdbus_bin} -gt 0 ]
8312+ then
8313+ #
8314+ : qdbus_or_dcop
8315+ : qdbus_bin
8316+ qdbus_or_dcop_bin=" ${qdbus_bin} "
8317+ #
8318+ else
8319+ #
8320+ export qdbus_bin=" $( for dir in $( echo $PATH | tr ' :' ' \n' ) ; do find " $dir " -name " qdbus*qt?" ; done | head -n 1 ) "
8321+ if [ ${# qdbus_bin} -gt 0 ]
82888322 then
8289- echo " qdbus"
8323+ #
8324+ : qdbus_or_dcop
8325+ : qdbus_bin
8326+ qdbus_or_dcop_bin=" ${qdbus_bin} "
8327+ #
82908328 else
8291- echo " dcop"
8292- fi ) "
8329+ #
8330+ qdbus_or_dcop=" dcop"
8331+ qdbus_or_dcop_bin=" dcop"
8332+ #
8333+ fi
8334+ #
8335+ fi
8336+ #
8337+ fi
82938338 #
8294- # Creazione della finestra...
8295- progress_var=" $( ${dialogo} --title " ${supertitle:- EasyBashGUI} " ${progress} " $( echo -e " ${testo} " ) " ${steps} ) " ; ${qdbus_or_dcop} ${progress_var} showCancelButton " true"
8339+ if [ " ${qdbus_or_dcop} " = " dcop" ]
8340+ then
8341+ #
8342+ if [ $( echo -n " $( type " dcop" 2> /dev/null) " | wc -c ) -gt 0 ]
8343+ then
8344+ #
8345+ : qdbus_or_dcop
8346+ #
8347+ else
8348+ #
8349+ qdbus_or_dcop=" notify_progress"
8350+ #
8351+ fi
8352+ #
8353+ fi
8354+ #
8355+ # ##
8356+ #
8357+ # qdbus_or_dcop is: qdbus|dcop|notify_progress ...
8358+ # =>
8359+ if [ " ${qdbus_or_dcop} " != " notify_progress" ]
8360+ then
8361+ # Creazione della finestra...
8362+ progress_var=" $( ${dialogo} --title " ${supertitle:- EasyBashGUI} " ${progress} " $( echo -e " ${testo} " ) " ${steps} ) "
8363+ ${qdbus_or_dcop_bin} ${progress_var} showCancelButton " true"
8364+ #
8365+ fi
82968366 #
82978367 # Loop dei valori...
82988368 conteggio=0
8299- until [ " $( ${qdbus_or_dcop } ${progress_var} wasCancelled ) " = " true" ]
8369+ until [ " $( ${qdbus_or_dcop_bin } ${progress_var} wasCancelled 2> /dev/null ) " = " true" ]
83008370 do
83018371 # Leggi lo StdIn...
83028372 read standard_input
8373+ [ ${# standard_input} -eq 0 ] && break
83038374 if [ " ${standard_input} " = " PROGRESS" ]
83048375 then
83058376 #
@@ -8314,20 +8385,24 @@ elif [ "${mode}" = "kdialog" ]
83148385 # Setta la barra...
83158386 if [ " ${qdbus_or_dcop} " = " qdbus" ]
83168387 then
8317- ${qdbus_or_dcop } ${progress_var} Set " " " value" ${conteggio} 1> /dev/null
8388+ ${qdbus_or_dcop_bin } ${progress_var} Set " " " value" ${conteggio} 1> /dev/null
83188389 #
83198390 elif [ " ${qdbus_or_dcop} " = " dcop" ]
83208391 then
8321- ${qdbus_or_dcop} ${progress_var} setProgress ${conteggio}
8392+ ${qdbus_or_dcop_bin} ${progress_var} setProgress ${conteggio}
8393+ #
8394+ elif [ " ${qdbus_or_dcop} " = " notify_progress" ]
8395+ then
8396+ #
8397+ notify_message " ${supertitle:- EasyBashGUI} : $( echo -e " ${testo} " ) ${conteggio} "
83228398 #
83238399 fi
83248400 #
83258401 # Alla fine esci dal loop...
8326- risultato=$( echo " scale=10; ${conteggio} == ${steps} " | bc -l )
8327- [ ${risultato} -eq 1 ] && break
8402+ risultato=$( echo " scale=10; ${conteggio} == ${steps} " | bc -l ) ; [ ${risultato} -eq 1 ] && break
83288403 #
83298404 done
8330- sleep 1 ; ${qdbus_or_dcop} ${progress_var} close
8405+ sleep 1 ; [ " ${qdbus_or_dcop} " != " notify_progress " ] && ${qdbus_or_dcop_bin } ${progress_var} close
83318406 # exit_if_user_closes_window
83328407 #
83338408 }
0 commit comments