scripts

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

commit f72a48a74216972783d10a9a2be1cf6e37ac94f5
parent 74170a59af4296f61aade26676fba9e06424516a
Author: z3bra <willy@mailoo.org>
Date:   Thu Feb  5 14:07:07 +0100

popup: now waaaaaaayyyyyyyyyyyy simpler !

Diffstat:
popup | 77++---------------------------------------------------------------------------
1 file changed, 2 insertions(+), 75 deletions(-)
diff --git a/popup b/popup @@ -6,8 +6,6 @@ TEXT='none' SLEEP=3 -ALSACHANNEL=$(amixer | sed "1s/^.*'\(.*\)'.*$/\1/p;d") - # bar options font='-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*' font="$font,-*-profont-medium-*-*--12-*-*-*-*-*-*-1" @@ -42,70 +40,6 @@ loop() { done) | bar -g $geom -f $font -B $bg -F $fg } -getvol() { - vol=`amixer sget $ALSACHANNEL | - sed -n 's/^.*\[\([0-9/]*%\)\].*\[\(o[nf]\+\)\]$/\1 (\2)/p' | - uniq` - case $1 in - value) echo $vol | sed 's/%.*$//' ;; - state) echo $vol | sed -n 's/^.*(\([onf]*\))/\1/p' ;; - *) echo $vol ;; - esac -} - -volume() { - test "`getvol state`" = "off" && echo -n "muted - " - echo -n "`getvol value`%%" -} - -volumebar() { - max=10 - cur=$((`getvol value` / max)) - - test "`getvol state`" = "off" && fg='#ffd43f10' - - for v in $(seq 1 $((max - 1))); do - if [ "$v" -lt "$cur" ]; then - val="$val%{F${fg}}xx" - else - val="$val%{F${hl}}xx" - fi - done - - echo -n "${val}" -} - -battery() { - BATC=`cat /sys/class/power_supply/BAT1/capacity` - BATS=`cat /sys/class/power_supply/BAT1/status` - echo "$BATC%% ($BATS)" -} - -mail() { - echo "`fcount ~/var/mail/INBOX/new` new mail!" -} - -date() { - date "+%d/%m/%y \(%H:%M\)" -} - -group() { - cur=`xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}'` - num=`xprop -root _NET_NUMBER_OF_DESKTOPS | awk '{print $3}'` - - val='' - - for w in $(seq 1 $((num - 1))); do - if [ "$w" -eq "$cur" ]; then - val="$val%{F${fg}}━━" - else - val="$val%{F${hl}}━━" - fi - done - - echo -n "${val}" -} - test "$#" -lt 1 && exit 1 while getopts ":bd:g:hlt:" opt; do @@ -122,15 +56,8 @@ done shift $(( OPTIND - 1 )); -case $1 in - volumebar|volume|battery|mail|date|group) - TEXT=`$1` - FUNC="$1" ;; - *) - TEXT="$@" - FUNC="echo $TEXT" - ;; -esac +TEXT="$@" +FUNC="echo $TEXT" # that beep can be *REALLY* annoying test -n "$BEEP" && beep -f 1500 -d 20 -l 100