-
yad > fenêtre de progression
Lorsqu’on utilise
--progress, yad lit les lignes de données depuis la sortie standard. Si les lignes commencent par#le texte après#sera displayed in the progress bar label. Numeric values treats like a persents for progress bar.--progress-text=TEXTtexte de progression--percentage=NOMBREpourcentage initial--pulsatebarre pulsative--auto-closeFerme la fenêtre dès que les 100% sont atteints--auto-killtue les processus parent si cancel est cliqué--rtldirection de la barre de progression de droite à gauche--value=VALUEvaleur initiale--min-value=VALUE--max-value=VALUEvaleurs mini / maxi--step=VALUEvaleur des intervalles (ou pas)--page=VALUEtaille de la pagination--print-partialPrint partial values--hide-valuemasquer les valeurs--verticalafficher une barre verticales--invertinverser la progression--mark=NAME:VALUEajouter un repère (may be used multiple times)--bar=LABEL[:TYPE]Add the progress bar (NORM,RTLouPULSE)LOG
--enable-log[=TEXT]Show log window. This window gathers all of lines from stdin, started from#instead of setting appropriate progress labels. Optional argumentTEXTis a text label for window expander.--log-on-topPlace log window above progress bar.--log-expandedStart with expanded log window.--log-heightSet the height of log window.MULTI PROGRESS
Exemple : afficher les disques durs montés :
eval exec yad --image=drive-harddisk --text="Disk usage:" --width=650 --multi-progress \ $(df -hT $1 | tail -n +2 | awk '{printf "--bar=\"<b>%s</b> (%s - %s) [%s/%s]\" %s ", $7, $1, $2, $4, $3, $6}')
--bar=LABEL[:TYPE]Add the progress bar (TYPE :NORM,RTLouPULSE)pulsefor pulsating progress bar (moves on receiving data) orpermfor permanent pulsatin progress bar.premprogress bar understant two commands -startfor start movement andstopfor stop it.--align=TYPESet alignment of bar labels. Possible types areleft,centerorright. Default is left.--watch-bar=NUMBERWatch for 100% of barNUMBERfor close dialog.--auto-killKill parent process if cancel button is pressed. Initial values for bars set as an extra arguments. Each lines with progress data passed to stdin must be started fromN:whereNis a number of progress bar.Afficher une barre de progression lors d’une recherche de fichiers :
#! /bin/bash myNR=0 fcMY(){ while read data; do myNR=$((myNR + 1)) # file counter prefix number echo "$myNR" echo "$data" | sed 's/&/&/g' # sanitize ampersand char (due to yad error message) echo "#Found $myNR item(s)" # third line here goes the text for the progress bar done | tee >(lisT) # A way to kill the progress (well, sort of) echo "" echo "" echo 100 # Printing 100 closes the progress dialog } function lisT(){ (yad \ --notebook \ --list --column "Num" \ --column "Files" \ --column "hidden" \ --title "Some App Title" \ --fontname "mono 10" \ --width 600 --height 300 \ --hide-column="3" \ --print-column="2" \ --separator="" > /home/roelof/Desktop/result.txt # write the result(s) to a file if [[ $? == 1 ]]; then rm -f /home/roelof/Desktop/result.txt exit 0 fi) || exit } find /home/roelof/Desktop/FBset/ -name '*.jpg' | \ fcMY | awk 'NR % 3 == 0;fflush()' | yad --progress --pulsate --auto-close --auto-kill --button gtk-cancel:1 --on-top # awk - prints every third line and flushes to stdout #---------------------