Add -r (restrict selection) option to slurp

This commit is contained in:
Paulo Diovani Gonçalves 2022-09-02 13:01:03 -03:00
parent 07bfeb2abc
commit f0d06185e6

View file

@ -143,7 +143,7 @@ elif [ "$SUBJECT" = "output" ] ; then
OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name') OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name')
WHAT="$OUTPUT" WHAT="$OUTPUT"
elif [ "$SUBJECT" = "window" ] ; then elif [ "$SUBJECT" = "window" ] ; then
GEOM=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp) GEOM=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp -r)
# Check if user exited slurp without selecting the area # Check if user exited slurp without selecting the area
if [ -z "$GEOM" ]; then if [ -z "$GEOM" ]; then
exit 1 exit 1