scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit fe4d70f9e802ea8401d7d71401700bc5ffeebfcf
parent 726fd4eeadd4b0ab4a9c48d72643315e6aa4c64d
Author: z3bra <willyatmailoodotorg>
Date:   Wed Sep 23 00:49:09 +0200

beepop + popup - client/server popup service

beepop is the full script. It starts a listener on /tmp/beepop.fifo, and creates
a lasting popup for each line that comes.
Now if it's called as "popup" (eg, ln -s beepop popup; ./popup) it will write
all arguments to the FIFO. ISN'T THAT AWESOME?!

Typical use

    # download beepop...
    ln -s beepop popup
    ./beepop &
    popup "testing a popup!"

Enjoy!

Diffstat:
beepop | 44++++++++++++++++++++++++++++++++++++++++++++
popup | 46----------------------------------------------
popup | 2++
3 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/beepop b/beepop @@ -0,0 +1,44 @@ +#!/bin/sh +# +# depends: lemonbar, wattr and common sense + +default_geometry() { + # get screen size + x=$(wattr w `lsw -r`) + y=$(wattr h `lsw -r`) + + width=256 + height=28 + + offy=32 + offx=$(( x - $width )) + + echo "${width}x${height}+${offx}+${offy}" +} + +FIFO=/tmp/beepop.fifo +GEOM=$(default_geometry) +SLEEP=3 + +# bar options +ICON='-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*' +FONT='-*-codingfonttobi1-medium-r-*--12-90-96-96-c-70-iso8859-1' +BG="#00000000" +FG="#ffffffff" +HL="%{F#ff666666}" + +case $(basename $0) in + beepop) + test -p $FIFO || mkfifo $FIFO + + tail -f $FIFO | while read LINE; do + ( + echo "%{r}$LINE ${HL} " + sleep $SLEEP + ) | lemonbar -d -g "$GEOM" -f $FONT -f $ICON -B $BG -F $FG + done + ;; + popup) + echo "$*" > $FIFO + ;; +esac diff --git a/popup b/popup @@ -1,46 +0,0 @@ -#!/bin/sh -# -# z3bra - (c) wtfpl 2014 -# Create a small popup with the given text -# -# depends: lemonbar, wattr and common sense - - -# bar options -#font='-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*' -font="-*-creep-*-*-*--16-*-*-*-*-*-*-1" -bg="#ff040201" -fg="#ffdfd5d2" -hl="#ff443232" - - -default_geometry() { - # get screen size - x=$(wattr w `lsw -r`) - y=$(wattr h `lsw -r`) - - width=256 - height=28 - - offy=10 - offx=$(( x - x/2 - $width/2 )) - - echo "${width}x${height}+${offx}+${offy}" -} - -test "$#" -lt 1 && exit 1 - -while getopts "d:g:h" opt; do - case $opt in - d) SLEEP=$OPTARG ;; - g) GEOM=$OPTARG ;; - h) usage; exit 0 ;; - *) usage; exit 1 ;; - esac -done - -GEOM=${GEOM:-$(default_geometry)} -SLEEP=${SLEEP:-3} - -(echo "%{c}$@"; sleep $SLEEP) | lemonbar -d -g $GEOM -f $font -B $bg -F $fg - diff --git a/popup b/popup @@ -0,0 +1 @@ +beepop+ \ No newline at end of file