Skip to content

Commit

Permalink
grimblast: use layerrules instead of modifying animations
Browse files Browse the repository at this point in the history
Fixes #123
  • Loading branch information
fufexan committed Nov 4, 2024
1 parent d72bc8b commit 792f6b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 2024-11-04

grimblast: use layerrules instead of modifying animations

### 2024-10-17

shellevents: support windowtitlev2 event
Expand Down
19 changes: 4 additions & 15 deletions grimblast/grimblast
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@

# Check whether another instance is running


grimblastInstanceCheck="${XDG_RUNTIME_DIR:-$XDG_CACHE_DIR:-$HOME/.cache}/grimblast.lock"
if [ -e "$grimblastInstanceCheck" ]; then
exit 2
exit 2
else
touch "$grimblastInstanceCheck"
touch "$grimblastInstanceCheck"
fi
trap "rm -f '$grimblastInstanceCheck'" EXIT


getTargetDirectory() {
test -f "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" &&
. "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
Expand Down Expand Up @@ -146,12 +144,6 @@ notifyError() {
fi
}

resetFade() {
if [[ -n $FADELAYERS ]]; then
hyprctl keyword animation "$FADELAYERS" >/dev/null
fi
}

killHyprpicker() {
if [ ! $HYPRPICKER_PID -eq -1 ]; then
kill $HYPRPICKER_PID
Expand Down Expand Up @@ -185,7 +177,6 @@ takeScreenshot() {
grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} "$FILE" || die "Unable to invoke grim"
else
grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} -g "$GEOM" "$FILE" || die "Unable to invoke grim"
resetFade
fi
}

Expand Down Expand Up @@ -227,10 +218,9 @@ elif [ "$SUBJECT" = "area" ]; then
HYPRPICKER_PID=$!
fi

# get fade & fadeOut animation and unset it
# disable animation for layer namespace "selection" (slurp)
# this removes the black border seen around screenshots
FADELAYERS="$(hyprctl -j animations | jq -jr '.[0][] | select(.name == "fadeLayers") | .name, ",", (if .enabled == true then "1" else "0" end), ",", (.speed|floor), ",", .bezier')"
hyprctl keyword animation 'fadeLayers,0,1,default' >/dev/null
hyprctl keyword layerrule "noanim,selection" >/dev/null

WORKSPACES="$(hyprctl monitors -j | jq -r '[(foreach .[] as $monitor (0; if $monitor.specialWorkspace.name == "" then $monitor.activeWorkspace else $monitor.specialWorkspace end)).id]')"
WINDOWS="$(hyprctl clients -j | jq -r --argjson workspaces "$WORKSPACES" 'map(select([.workspace.id] | inside($workspaces)))')"
Expand All @@ -240,7 +230,6 @@ elif [ "$SUBJECT" = "area" ]; then
# Check if user exited slurp without selecting the area
if [ -z "$GEOM" ]; then
killHyprpicker
resetFade
exit 1
fi
WHAT="Area"
Expand Down

0 comments on commit 792f6b8

Please sign in to comment.