diff --git a/CHANGELOG.md b/CHANGELOG.md index c03b987..42a7118 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 2025-03-03 + +grimblast: add environment var `GRIMBLAST_HIDE_CURSOR` to avoid high CPU loads on some machines + ### 2025-03-01 grimblast: hide the grim cursor before taking a screenshot diff --git a/grimblast/grimblast b/grimblast/grimblast index 38366b4..5d65a28 100755 --- a/grimblast/grimblast +++ b/grimblast/grimblast @@ -209,11 +209,15 @@ takeScreenshot() { GEOM=$2 OUTPUT=$3 if [ -n "$OUTPUT" ]; then - moveCursorPosition && grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} -o "$OUTPUT" "$FILE" && restoreCursorPosition || die "Unable to invoke grim" + grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} -o "$OUTPUT" "$FILE" || die "Unable to invoke grim" elif [ -z "$GEOM" ]; then grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} "$FILE" || die "Unable to invoke grim" else - moveCursorPosition && grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} -g "$GEOM" "$FILE" && restoreCursorPosition || die "Unable to invoke grim" + if [ "$SUBJECT" != "area" ] || [ "$GRIMBLAST_HIDE_CURSOR" = 0 ]; then + grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} -g "$GEOM" "$FILE" || die "Unable to invoke grim" + else + moveCursorPosition && grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} -g "$GEOM" "$FILE" && restoreCursorPosition || die "Unable to invoke grim" + fi fi } diff --git a/grimblast/grimblast.1.scd b/grimblast/grimblast.1.scd index 857d6f3..b2fea12 100644 --- a/grimblast/grimblast.1.scd +++ b/grimblast/grimblast.1.scd @@ -79,6 +79,8 @@ _area_ and captures that. Slurp can be customized by setting its arguments in the *SLURP_ARGS* environment variable. + If you experience high cpu loads when taking a screenshot with this target, + you can set the *GRIMBLAST_HIDE_CURSOR* environment variable to **0**. _output_ Captures the currently active output. @@ -102,6 +104,9 @@ An example usage pattern is to add these bindings to your hyprland config: # Optionally, customize slurp's appearance env = SLURP_ARGS, -d -b -B F050F022 -b 10101022 -c ff00ff +# Can fix high cpu loads on some machines +env = GRIMBLAST_HIDE_CURSOR, 0 + bind = SUPER, p, exec, grimblast save active bind = SUPER SHIFT, p, exec, grimblast save area bind = SUPER ALT, p, exec, grimblast save output