tfinally a working popup wrapper ! - scripts - various script and utils
 (HTM) git clone git://z3bra.org/scripts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 2e0a6261e9bee32d21a51c4c1168b31cee6ae5eb
 (DIR) parent 8978083896701bf52995d95c24e7d9234b023c93
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Thu,  5 Feb 2015 14:10:07 +0100
       
       finally a working popup wrapper !
       
       Diffstat:
         M wrappop                             |      34 ++++++++++++++++++++-----------
       
       1 file changed, 22 insertions(+), 12 deletions(-)
       ---
 (DIR) diff --git a/wrappop b/wrappop
       t@@ -2,24 +2,34 @@
        
        # fifo that we'll use to feed the popups
        test -p /tmp/popup.fifo || mkfifo /tmp/popup.fifo
       +test -d /tmp/popup.d || mkdir /tmp/popup.d
        
       -w=150
       +w=190
        h=20
       -x=1930
       +x=1200
        y=10
        
       -n=-1
       +find_place() {
       +    NUM=$(fcount /tmp/popup.d)
       +    for n in `seq 0 $NUM`; do
       +        test ! -f /tmp/popup.d/$n && echo $n && return
       +    done
       +    echo $NUM
       +}
       +
       +mkpop() {
       +    local f=$1
       +
       +    touch /tmp/popup.d/$f
       +
       +    ~/bin/popup -g ${w}x${h}+${x}+$((y + (h+y) * f)) $f ${message}
       +
       +    rm /tmp/popup.d/$f
       +}
        
        # get messages from the fifo
        tail -f /tmp/popup.fifo |
        while IFS= read -r message; do
       -    # increment the counter
       -    n=$((n + 1))
       -
       -    # display the popup under the others
       -    {
       -        ~/bin/popup -g ${w}x${h}+${x}+$((y + (h+y) * n)) $n ${message}
       -        # decrement the counter
       -        n=$((n - 1))
       -    } &
       +    mkpop $(find_place) &
        done
       +