feat: scanpdf, bash optimizations

This commit is contained in:
angeD 2022-05-16 14:44:31 +02:00
parent 0ea2a49df1
commit 484cc80fbd
3 changed files with 21 additions and 3 deletions

18
bin/scanpdf Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/bash
set -e
usage() {
echo -e "USAGE: $0 FILE.pdf"
exit 0
}
DEVICE='pixma:04A9178A_31A16C'
FORMAT='png'
RES=300
if [ "$1" == '-h' ] || [[ "$1" != *.pdf ]]; then
usage
fi
scanimage -d "$DEVICE" --format="$FORMAT" --resolution "$RES" > "$1"
convert "$1" "$1"

View File

@ -1,7 +1,7 @@
#!/usr/bin/bash
set -e
CUR_LIGHT="$(set-light "$@")"
CUR_LIGHT="$("$(dirname "$0")"/set-light "$@")"
SCREENS="$(ddcutil detect | awk '$1 == "Display" {print $2}')"

View File

@ -5,10 +5,10 @@ CUR="$(pactl get-sink-volume 0 | awk '$1 == "Volume:" {print substr($5, 1, lengt
SHIFT="${1}"
case "${1:0:1}" in
"")
'')
exit 1
;;
"+"|"-")
'+'|'-')
NEW="$((CUR - CUR % SHIFT + SHIFT))"
;;
*)