Add check for empty GEOM variable

In case when slurp is used to select part of screen, if user aborts the
selection, grimshot will capture the whole screen instead of exiting.
This is fixed with check for empty variable.
This commit is contained in:
Vinko Kašljević 2020-07-15 17:09:14 +02:00
parent acbe902815
commit 2f7b3b63d5

View file

@ -111,6 +111,10 @@ if [ "$ACTION" = "check" ] ; then
exit exit
elif [ "$SUBJECT" = "area" ] ; then elif [ "$SUBJECT" = "area" ] ; then
GEOM=$(slurp -d) GEOM=$(slurp -d)
# Check if user exited slurp without selecting the area
if [ -z "$GEOM" ]; then
exit
fi
WHAT="Area" WHAT="Area"
elif [ "$SUBJECT" = "active" ] ; then elif [ "$SUBJECT" = "active" ] ; then
FOCUSED=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)') FOCUSED=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)')