From 21d15707069f01555ec56848e240d931bf062c86 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 3 Jan 2020 22:56:12 -0500 Subject: [PATCH] Refactor bin/scrcap --- bin/scrcap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/scrcap b/bin/scrcap index 2ae935c4..d1478b3c 100755 --- a/bin/scrcap +++ b/bin/scrcap @@ -4,6 +4,8 @@ # capture) and stores it in the clipboard. tmp=$(mktemp) +cleanup() { rm -f "$tmp"; } +trap cleanup EXIT # Delay for long enough that we can refocus the targeted window if maim --delay=${1:-0.6} -us >"$tmp"; then @@ -12,5 +14,3 @@ if maim --delay=${1:-0.6} -us >"$tmp"; then else notify-send -u low "Aborted screenshot" fi - -rm -f "$tmp"