dots

git clone git://mattcarlson.org/repos/dots.git
Log | Files | Refs

commit b17135ff0cdc8db4b1b77cdccbcbd7b5cf033689
parent 6b81d7498fa44def726cb2d8e0bafee930f7276b
Author: Matthew Carlson <matt@mcarlson.xyz>
Date:   Fri, 23 Jul 2021 23:26:34 -0400

screenshot script

Diffstat:
A.local/bin/shot.sh | 23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/.local/bin/shot.sh b/.local/bin/shot.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# shot + +COLORS="${XDG_CACHE_HOME:-${HOME}/.cache}/wal/colors.sh" + +[ -f "${COLORS}" ] && . "${COLORS}" + +hex="$(printf '%s' "${color4}" | tr '[:lower:]' '[:upper:]' | tr -d '[:punct:]')" + +a=$(printf '%s' "${hex}" | cut -c 1-2) +b=$(printf '%s' "${hex}" | cut -c 3-4) +c=$(printf '%s' "${hex}" | cut -c 5-6) + +r=$(printf '%s\n' "ibase=16; ${a}" | bc) +g=$(printf '%s\n' "ibase=16; ${b}" | bc) +b=$(printf '%s\n' "ibase=16; ${c}" | bc) + +rf=$(printf '%s\n' "scale=10; ${r}/255" | bc) +gf=$(printf '%s\n' "scale=10; ${g}/255" | bc) +bf=$(printf '%s\n' "scale=10; ${b}/255" | bc) + +scrot -a "$(slop -b 3 -c "${rf}","${gf}","${bf}",1.0 -f '%x,%y,%w,%h')" -q 100 -z -C 'screenshot' "${HOME}/pix/captures/%m-%d-%Y-%I-%M-%S.png"