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