diff options
Diffstat (limited to 'bin/grimshot')
| -rwxr-xr-x | bin/grimshot | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/bin/grimshot b/bin/grimshot index af7bcd1..de01976 100755 --- a/bin/grimshot +++ b/bin/grimshot @@ -29,15 +29,15 @@ _silence_notifications() { ACTION=${1:-usage} SUBJECT=${2:-screen} -FILE=${3:-$(xdg-user-dir PICTURES)/screenshots/$(now).png} +FILE=${3:-${HOME}/Pictures/screenshots/$(now).png} case "$ACTION" in - usage | help | -h | --help) - echo "Usage:" - echo " grimshot copy|save|rec win|screen|area|output [FILE]" - echo "Troubleshoot:" - echo " grimshot check" - exit - ;; +usage | help | -h | --help) + echo "Usage:" + echo " grimshot copy|save|rec win|screen|area|output [FILE]" + echo "Troubleshoot:" + echo " grimshot check" + exit + ;; esac notify() { @@ -134,6 +134,10 @@ else die "Unknown subject to take a screen shot from" "$SUBJECT" fi +if [ ! "$ACTION" = "copy" ]; then + mkdir -p "$(dirname "${FILE}")" +fi + if [ "$ACTION" = "copy" ]; then TMP=$(mktemp) || die "Unable to create temp file: is mktemp installed?" takeScreenshot "$TMP" "$GEOM" "$OUTPUT" @@ -151,8 +155,8 @@ elif [ "$ACTION" = "save" ]; then notifyError "Error taking screenshot with grim" fi elif [ "$ACTION" = "rec" ]; then - echo "$FILE" | awk '/png$/{exit 0}' \ - && FILE=$(xdg-user-dir VIDEOS)/grimshot/$(now).mp4 + echo "$FILE" | awk '/png$/{exit 0}' && + FILE=$(xdg-user-dir VIDEOS)/grimshot/$(now).mp4 # create dir if not exists [ -d "$(dirname "$FILE")" ] || mkdir -p "$(dirname "$FILE")" recordScreen "$FILE" "$GEOM" "$OUTPUT" |