diff options
-rwxr-xr-x | .local/bin/aqry | 22 | ||||
-rwxr-xr-x | .local/bin/chkb | 2 | ||||
-rwxr-xr-x | .local/bin/lps | 14 | ||||
-rwxr-xr-x | .local/bin/mc-pass | 20 | ||||
-rwxr-xr-x | .local/bin/qotd | 4 | ||||
-rwxr-xr-x | .local/bin/send-package | 12 | ||||
-rwxr-xr-x | .local/bin/smail | 29 | ||||
-rwxr-xr-x | .local/bin/timer | 42 | ||||
-rwxr-xr-x | .local/bin/uni | 13 | ||||
-rwxr-xr-x | .local/sbin/chtz | 4 |
10 files changed, 79 insertions, 83 deletions
diff --git a/.local/bin/aqry b/.local/bin/aqry index 6daef5d..38c70f3 100755 --- a/.local/bin/aqry +++ b/.local/bin/aqry @@ -1,15 +1,13 @@ -#!/bin/sh +#!/usr/local/bin/andy -set -e +set ADDR_FILE $(XDG_CONFIG_HOME:$HOME/.config)/aerc/addresses -readonly ADDR_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/aerc/addresses" +awk -v qry=$args[1] ' + BEGIN { + FS = "\t" + } -awk -v qry="$1" ' -BEGIN { - FS = "\t" -} - -$1 ~ qry { - printf "%s\t%s\n", $2, $1 -} -' "$ADDR_FILE" + $1 ~ qry { + printf "%s\t%s\n", $2, $1 + } +' $ADDR_FILE diff --git a/.local/bin/chkb b/.local/bin/chkb index 359f443..e26133a 100755 --- a/.local/bin/chkb +++ b/.local/bin/chkb @@ -1,7 +1,7 @@ #!/usr/local/bin/andy set -e NOTIFY_LONG keyboard -set -e NOTIFY_SHORT chkb +set -e NOTIFY_SHORT `basename $args[0] set KEYBOARD at-translated-set-2-keyboard diff --git a/.local/bin/lps b/.local/bin/lps index 135848d..8e49fa5 100755 --- a/.local/bin/lps +++ b/.local/bin/lps @@ -1,9 +1,9 @@ -#!/bin/sh +#!/usr/local/bin/andy -set -e +set flags -m color -r 300 +if test $#args -ge 2 { + set flags $flags --area=0,0,$args[1],$args[1] +} -flags='-m color -r 300' -[ $# -eq 1 ] && flags="$flags --area=0,0,$1,$1" - -uri="$(lpoptions | sed -E 's/.*device-uri=hp:([^ ]+).*/hpaio:\1/')" -chronic hp-scan -d "$uri" $flags +set uri `lpoptions | sed -E 's/.*device-uri=hp:([^ ]+).*/hpaio:\1/' +chronic hp-scan -d $uri $flags diff --git a/.local/bin/mc-pass b/.local/bin/mc-pass index 168e62e..83b701b 100755 --- a/.local/bin/mc-pass +++ b/.local/bin/mc-pass @@ -1,14 +1,18 @@ -#!/bin/sh +#!/usr/local/bin/andy -export NOTIFY_LONG='mc pass' -export NOTIFY_SHORT="${0##*/}" +set -e NOTIFY_LONG 'mc pass' +set -e NOTIFY_SHORT `basename $args[0] -trap ' - wl-copy </dev/null - notify "Password Cleared" "The password was cleared from the clipboard." -' INT EXIT TERM +for sig in int exit term { + func sig$sig { + wl-copy <_ + notify 'Password Cleared' 'The password was cleared from the clipboard.' + } +} vlt raw Email thomasvoss@live.com | wl-copy -notify 'Password Copied' \ +notify ( + 'Password Copied' 'The password will be cleared from the clipboard in 10 seconds.' +) sleep 10 diff --git a/.local/bin/qotd b/.local/bin/qotd index 7bf6e03..5c7d72d 100755 --- a/.local/bin/qotd +++ b/.local/bin/qotd @@ -9,8 +9,8 @@ func older_than_today file { test $mod != `date +%F } -set QUOTES $XDG_DATA_HOME/romir/quotes.yml -set QOTD $XDG_CACHE_HOME/qotd +set QUOTES $(XDG_DATA_HOME:$HOME/.local/share)/romir/quotes.yml +set QOTD $(XDG_CACHE_HOME:$HOME/.cache)/qotd if older_than_today $QUOTES { mkdir -p `dirname $QUOTES diff --git a/.local/bin/send-package b/.local/bin/send-package index bcd7eb0..453a148 100755 --- a/.local/bin/send-package +++ b/.local/bin/send-package @@ -1,11 +1,11 @@ -#!/bin/sh +#!/usr/local/bin/andy # Why not? -readonly tmpl="${XDG_DATA_HOME:-$HOME/.local/share}/send-package/template" +set tmpl $(XDG_DATA_HOME:$HOME/.local/share)/send-package/template -sed -En '/^Angel Cakes/,/^Doozies/s/(\t|\s{2,})/\n/gp' ~/doc/tit-names \ -| shuf -n1 \ -| tr A-Z a-z \ -| xargs -I{} -- sed 's/$REPLACEME/{}/' "$tmpl" \ +sed -En '/^Angel Cakes/,/^Doozies/s/(\t|\s{2,})/\n/gp' ~/doc/tit-names +| shuf -n1 +| tr A-Z a-z +| xargs -I{} -- sed 's/$REPLACEME/{}/' $tmpl | smail diff --git a/.local/bin/smail b/.local/bin/smail index fa1c887..7268307 100755 --- a/.local/bin/smail +++ b/.local/bin/smail @@ -1,20 +1,19 @@ -#!/bin/sh +#!/usr/local/bin/andy -set -e - -tmp=`mktemp` -trap "rm -f $tmp" EXIT +set tmp `mktemp +func sigexit { + rm -f $tmp +} cat >$tmp -addr="`mhdr -h from $tmp | sed -E '/.*<.*>$/s/.*<(.*)>$/\1/'`" -mbox="$MAILDIR/$addr/Sent" +set addr `mhdr -h from $tmp | sed -E '/.*<.*>$/s/.*<(.*)>$/\1/' +set mbox $MAILDIR/$addr/Sent -if msmtp -t --read-envelope-from <$tmp -then - mgenmid \ - | sed 's/^/Message-Id: /' \ - | cat - $tmp \ - | mmime \ - | mdeliver -cv "$mbox" \ +if msmtp -t --read-envelope-from <$tmp { + mgenmid + | sed 's/^/Message-Id: /' + | cat - $tmp + | mmime + | mdeliver -cv $mbox | xargs chronic mflag -S -fi +} diff --git a/.local/bin/timer b/.local/bin/timer index 4c33fb0..fc2652f 100755 --- a/.local/bin/timer +++ b/.local/bin/timer @@ -1,28 +1,26 @@ -#!/bin/sh +#!/usr/local/bin/andy -set -e - -abort() -{ - notify 'Timer Interrupted' 'The timer was unexpectedly interrupted' \ - -u critical - exit 1 +for sig in hup int quit abrt kill alrm term { + func sig$sig { + notify ( + 'Timer Interrupted' + 'The timer was unexpectedly interrupted' + -u critical + ) + exit 1 + } } -export NOTIFY_LONG=timer -export NOTIFY_SHORT=${0##*/} +set -e NOTIFY_LONG timer +set -e NOTIFY_SHORT `basename $args[0] -if [ $# -eq 0 ] -then - echo 'Usage: timer duration [message]' >&2 +if test $#args -lt 2 { + echo 'Usage: timer duration [message]' >/dev/stderr exit 1 -fi - -trap abort HUP INT QUIT ABRT KILL ALRM TERM +} -if sleep "$1" -then - notify 'Timer Finished' "$2" -else - abort -fi +if sleep $args[1] { + notify 'Timer Finished' $args[2] +} else { + sigint +} diff --git a/.local/bin/uni b/.local/bin/uni index a45b4c5..a882c8c 100755 --- a/.local/bin/uni +++ b/.local/bin/uni @@ -1,11 +1,11 @@ #!/usr/local/bin/andy -set -e NOTIFY_LONG unicode -set -e NOTIFY_SHORT uni +set -e NOTIFY_LONG unicode +set -e NOTIFY_SHORT `basename $args[0] func setup { curl 'https://www.unicode.org/Public/UNIDATA/UnicodeData.txt' - | sed -E r#' + | sed -E ' s/;[^;]*//2g s/\<(.)([A-Z]*)/\1\L\2/2g /^[^;]*;</d @@ -13,11 +13,10 @@ func setup { /Variation Selector/d s/[^;]*/\\u&/ s/^\\u([^;]{5})/\\U000\1/ - '# >$DATA + ' >$DATA } -test $#XDG_DATA_HOME -gt 0 || set XDG_DATA_HOME $HOME/.local/share -set DATA $XDG_DATA_HOME/unicode-data +set DATA $(XDG_DATA_HOME:$HOME/.local/share)/unicode-data test -f $DATA || setup set i `{ @@ -33,5 +32,3 @@ if test -t 2 { } else { wtype -- $rune } - -# vi: ft=sh diff --git a/.local/sbin/chtz b/.local/sbin/chtz index 2033ab2..573cd9d 100755 --- a/.local/sbin/chtz +++ b/.local/sbin/chtz @@ -1,7 +1,7 @@ #!/usr/local/bin/andy -set -e NOTIFY_LONG timezone -set -e NOTIFY_SHORT chtz +set -e NOTIFY_LONG timezone +set -e NOTIFY_SHORT `basename $args[0] set choice `timedatectl list-timezones | grep ./. | osel sudo timedatectl set-timezone $choice |