From 561312f2f0831b4d2facae28440c84e9be7a40aa Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Mon, 15 Aug 2022 11:59:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=AA=E5=9B=BE=E5=90=8E=E5=B0=86=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=B7=BB=E5=8A=A0=E5=88=B0=E7=B2=98=E8=B4=B4=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/screenshot | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/script/screenshot b/script/screenshot index 06f97e3..76c7821 100644 --- a/script/screenshot +++ b/script/screenshot @@ -1,7 +1,12 @@ #!/bin/sh -timestamp="$(date +%Y%m%d%H%M%S)" -targetbase="$HOME/screenshots" -mkdir -p $targetbase +TIMESTAMP="$(date +%Y%m%d%H%M%S)" +TARGETBASE="$HOME/screenshots" +mkdir -p $TARGETBASE +FILENAME="$TARGETBASE/${TIMESTAMP}.png" [ -d $targetbase ] || exit 1 -scrot -s $targetbase/$timestamp.png +scrot -s $FILENAME + +if [[ -n $(type -p xclip) ]]; then + xclip -selection clipboard -t image/png $FILENAME +fi