From 69f1e8eaafe756421ca47c7c414b7ddfeb6f7f43 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Mon, 5 Feb 2024 02:00:39 +0000 Subject: [PATCH] Fix: Area screenshot saving empty files Area screenshot saves a file on exit and no area has been selected. --- config/hypr/scripts/ScreenShot.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index fa1b40a..f35f929 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -75,7 +75,13 @@ shotwin() { } shotarea() { - cd ${dir} && grim -g "$(slurp)" - | tee "$file" | wl-copy + tmpfile=$(mktemp) + grim -g "$(slurp)" - >"$tmpfile" + if [[ -s "$tmpfile" ]]; then + wl-copy <"$tmpfile" + mv "$tmpfile" "$dir/$file" + fi + rm "$tmpfile" notify_view }