From: Ralph Ronnquist Date: Sat, 13 Nov 2021 09:37:38 +0000 (+1100) Subject: commenting X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=dc50b3267cb3af8d91f85e7c028bf20d5740c492;p=rrq%2Fkbdo.git commenting --- diff --git a/kbdo b/kbdo index 595a984..fb4315f 100755 --- a/kbdo +++ b/kbdo @@ -9,14 +9,19 @@ # Example for simply saving it in the ~/Pictures directory. # kbdo cp -t $HOME/Pictures # -# Example for running custom "copying script" -# kbdo $HOME/bin/mycp $HOME/Pictures/snap 4 -# .. where $HOME/bin/mycp could be a file with the following line: -# cp $3 $1/$(printf %0${2}d.png $(ls $1|wc -l)) -# .. for saving screenshots by serial numbering instead +# Example for custom copying by inline scripting (same effect): +# kbdo 'bash -c "X(){ cp $1 $HOME/Pictures; }; X $1"' CP # -# Example for custom copying by inline scripting (note the backslashes): -# kbdo 'bash -c "X(){ cp \$1 \$HOME/Pictures; }; X \$1" mycp' +# Note above, that bash needs CP as the $0 for the -c scripting +# +# Example for post-processing with convert into fix resolution +# kbdo 'bash -c "X(){ convert $1 -resize 800x600 ${1#.*}-x.png; }; X $1"' CVT +# +# Example for running custom script +# kbdo $HOME/bin/mycp arg1 arg2 +# +# Note above, that the temporary snapshot file is added as an additional +# last argument ("arg3" as it were); something like /tmp/Screenshot-date.png ARGS="$*" if [ -z "$ARGS" ] ; then @@ -27,10 +32,6 @@ fi EVL="" -foo() { - echo $1 >&2 -} - stdbuf -o0 xxd -c 24 -p < /dev/input/event0 | \ stdbuf -o0 sed 's/.\{32\}//;s/\(.\{12\}\).*/\1/' | \ while read EV ; do @@ -38,7 +39,9 @@ stdbuf -o0 xxd -c 24 -p < /dev/input/event0 | \ EVL+=" $EV" continue fi + # echo "$EVL" >&2 if [ -z "${EVL%%*010063000100}" ] ; then + # Act on the [PrtSc/SysRq] key echo "${PRG[@]}" >&2 "${PRG[@]}" & fi