Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grimblast: add environment var 'GRIMBLAST_HIDE_CURSOR' to avoid high CPU loads on some machines #136

Merged
merged 2 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 6 additions & 2 deletions grimblast/grimblast
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 5 additions & 0 deletions grimblast/grimblast.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down