From f6219cb8944cee6cd1826b8d6f7529742c01c2d1 Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Sat, 18 May 2019 09:21:36 -0500 Subject: [PATCH] Fixed shot.sh after some neglect --- .bashrc.d/shot.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.bashrc.d/shot.sh b/.bashrc.d/shot.sh index de9ae21..cb45c06 100644 --- a/.bashrc.d/shot.sh +++ b/.bashrc.d/shot.sh @@ -28,7 +28,7 @@ p Upload to a pastebin (defined in function) case ${1:0:1} in # Active window w) printf "Focus target window now...\n" - opts="-i $(xdotool getactivewindow)" + opts="-i" msgt="active window" ;; # All @@ -51,7 +51,8 @@ p Upload to a pastebin (defined in function) # Post to a pastebin p) destdir=$destdir/pasted msgd="pastebin" - paste=1;; + paste=1 + ;; *) printf "Invalid destination: %s\n" "${1:1:1}" return @@ -63,9 +64,12 @@ p Upload to a pastebin (defined in function) local fpath="${destdir}/${fname}" # If target is active window, give a 5 second countdown before running maim - [[ "$msgt" = "active window" ]] && countdown 5 + if [[ "$msgt" = "active window" ]]; then + countdown 5 + opts="-i $(xdotool getactivewindow)" + fi - maim "$opts" "$fpath" + maim $opts "$fpath" printf "Captured %s -> %s\n" "$msgt" "$msgd" # If destination is a pastebin, do the needful