From 9d13b3496f9505a715cf262616ce6402c4c1a8f1 Mon Sep 17 00:00:00 2001 From: Niklas Date: Wed, 1 Jul 2020 00:21:39 +0200 Subject: [PATCH] added screenshot scripts --- .local/share/scripts/take-screenshot.sh | 18 ++++++++++++++++++ .../share/scripts/take-selected-screenshot.sh | 15 +++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 .local/share/scripts/take-screenshot.sh create mode 100755 .local/share/scripts/take-selected-screenshot.sh diff --git a/.local/share/scripts/take-screenshot.sh b/.local/share/scripts/take-screenshot.sh new file mode 100755 index 0000000..bde400e --- /dev/null +++ b/.local/share/scripts/take-screenshot.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env sh +# makes a selection screenshot and prints out the filename in a date format +# not intended for direct use. Dosn't remove tmp dir +# required packages: +# - deepin-screenshot + +set -e + +TMPDIR=$(mktemp -d) + +deepin-screenshot -n -s "$TMPDIR" 2>/dev/null + +filename="$(date +"%d-%m-%y-%H-%M-%Z").png" + +mv $TMPDIR/* "$TMPDIR/$filename" + +printf "$TMPDIR/$filename" + diff --git a/.local/share/scripts/take-selected-screenshot.sh b/.local/share/scripts/take-selected-screenshot.sh new file mode 100755 index 0000000..9ebe07a --- /dev/null +++ b/.local/share/scripts/take-selected-screenshot.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh +set -e + +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") + +SCREENSHOT_DIR="$HOME/pictures/screenshots" + +screenshotFile=$($SCRIPTPATH/take-screenshot.sh) + +mv "$screenshotFile" "$SCREENSHOT_DIR" +rm -rf "$(dirname $screenshotFile)" + +printf "$SCREENSHOT_DIR/$(basename $screenshotFile)" +