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 breaks fade animation in hyprland #123

Closed
DHDcc opened this issue Nov 3, 2024 · 5 comments
Closed

grimblast breaks fade animation in hyprland #123

DHDcc opened this issue Nov 3, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@DHDcc
Copy link
Contributor

DHDcc commented Nov 3, 2024

Program

grimblast

Maintainers of the program

@fufexan, @Misterio77

Bug or Regression?

Bug

Description

After using grimblast, the fade animation of apps (example: swaync, rofi) stops working in hyprland. You can make it work again by using hyprctl reload.

How to reproduce

  1. Run grimblast with the area option. (example: grimblast -n -f save area ~/test.png )
  2. Open apps. (exemple: swaync, rofi)

Hyprland crash reports, program logs, images, videos

2024-11-03_02-06-49.mp4
@DHDcc DHDcc added the bug Something isn't working label Nov 3, 2024
@DHDcc DHDcc changed the title [grimblast ] grimblast breaks fade animation in hyprland grimblast breaks fade animation in hyprland Nov 3, 2024
@fufexan
Copy link
Member

fufexan commented Nov 3, 2024

Can you try this patch?

diff --git a/grimblast/grimblast b/grimblast/grimblast
index 27c37e1..de7a286 100755
--- a/grimblast/grimblast
+++ b/grimblast/grimblast
@@ -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"
@@ -229,7 +227,7 @@ elif [ "$SUBJECT" = "area" ]; then
 
   # get fade & fadeOut animation and unset it
   # 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')"
+  FADELAYERS="$(hyprctl -j animations | jq -jr '.[0][] | select(.name == "fadeLayers") | .name, ",", (if .enabled == true then "1" else "0" end), ",", (.speed|floor), ",", (if .bezier == "" then "default" else .bezier end)')"
   hyprctl keyword animation 'fadeLayers,0,1,default' >/dev/null
 
   WORKSPACES="$(hyprctl monitors -j | jq -r '[(foreach .[] as $monitor (0; if $monitor.specialWorkspace.name == "" then $monitor.activeWorkspace else $monitor.specialWorkspace end)).id]')"

@DHDcc
Copy link
Contributor Author

DHDcc commented Nov 3, 2024

Can you try this patch?

diff --git a/grimblast/grimblast b/grimblast/grimblast
index 27c37e1..de7a286 100755
--- a/grimblast/grimblast
+++ b/grimblast/grimblast
@@ -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"
@@ -229,7 +227,7 @@ elif [ "$SUBJECT" = "area" ]; then
 
   # get fade & fadeOut animation and unset it
   # 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')"
+  FADELAYERS="$(hyprctl -j animations | jq -jr '.[0][] | select(.name == "fadeLayers") | .name, ",", (if .enabled == true then "1" else "0" end), ",", (.speed|floor), ",", (if .bezier == "" then "default" else .bezier end)')"
   hyprctl keyword animation 'fadeLayers,0,1,default' >/dev/null
 
   WORKSPACES="$(hyprctl monitors -j | jq -r '[(foreach .[] as $monitor (0; if $monitor.specialWorkspace.name == "" then $monitor.activeWorkspace else $monitor.specialWorkspace end)).id]')"

Same issue

@fufexan
Copy link
Member

fufexan commented Nov 4, 2024

Can you try with this?

diff --git a/grimblast/grimblast b/grimblast/grimblast
index 27c37e1..c12ace1 100755
--- a/grimblast/grimblast
+++ b/grimblast/grimblast
@@ -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"
@@ -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
@@ -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
 }
 
@@ -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)))')"
@@ -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"

@DHDcc
Copy link
Contributor Author

DHDcc commented Nov 4, 2024

Can you try with this?

diff --git a/grimblast/grimblast b/grimblast/grimblast
index 27c37e1..c12ace1 100755
--- a/grimblast/grimblast
+++ b/grimblast/grimblast
@@ -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"
@@ -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
@@ -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
 }
 
@@ -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)))')"
@@ -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"

This patch works

@fufexan
Copy link
Member

fufexan commented Nov 4, 2024

Great, will commit that then.

@fufexan fufexan closed this as completed in 792f6b8 Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants