shot.sh (751B)
1 #!/bin/sh 2 # 3 # shot 4 5 COLORS="${XDG_CACHE_HOME:-${HOME}/.cache/}/wal/colors.sh" 6 7 main() { 8 [ -f "${COLORS}" ] && . "${COLORS}" 9 10 hex="$(printf '%s' "${color2}" | tr '[:lower:]' '[:upper:]' | tr -d '[:punct:]')" 11 12 a=$(printf '%s' "${hex}" | cut -c 1-2) 13 b=$(printf '%s' "${hex}" | cut -c 3-4) 14 c=$(printf '%s' "${hex}" | cut -c 5-6) 15 16 r=$(printf '%d' 0x${a}) 17 g=$(printf '%d' 0x${b}) 18 b=$(printf '%d' 0x${c}) 19 20 rf=$(awk -v var=${r} 'BEGIN { print var/255 }') 21 gf=$(awk -v var=${g} 'BEGIN { print var/255 }') 22 bf=$(awk -v var=${b} 'BEGIN { print var/255 }') 23 24 scrot -a "$(slop -b 3 -c "${rf}","${gf}","${bf}",1.0 -f '%x,%y,%w,%h')" -q 100 -z -C 'screenshot' "${PICTURES_DIR}/shots/%m-%d-%Y-%I-%M-%S.png" 25 } 26 27 main "${@}"