diff --git a/CHANGELOG.md b/CHANGELOG.md index f4a342c..3acf389 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 2026-10-05 + +grimblast: create parent dirs when saving to file instead of failing when they don't exist. + ### 2026-08-21 grimblast: update layerrule to lua syntax diff --git a/grimblast/grimblast b/grimblast/grimblast index 61c9561..8a72eff 100755 --- a/grimblast/grimblast +++ b/grimblast/grimblast @@ -153,6 +153,9 @@ grimblast::check() { # The actual grim command used is printed to stderr screenshot() { local file="$1" output="$2" + if [[ -n "$file" ]]; then + mkdir -p "$(dirname "$file")" + fi xargs --verbose grim <<<"${CURSOR:+-c} ${SCALE:+-s \"$SCALE\"} -t \"$FILETYPE\" ${output:+-o \"$output\"} ${GEOM:+-g \"$GEOM\"} ${WINDOW:+-T \"$WINDOW\"} \"$file\"" } @@ -292,6 +295,7 @@ copysave() { screenshot - "$OUTPUT" | tee >(wl-copy --type "$(get-mime-type)") || die "Clipboard error" notify::ok "$WHAT copied to buffer and piped to stdout" else + mkdir -p "$(dirname "$file")" screenshot - "$OUTPUT" | tee "$file" | wl-copy --type "$(get-mime-type)" || die "Clipboard error" title="Screenshot of $WHAT" message="$WHAT copied to buffer and saved to $file"