mirror of
https://github.com/swaywm/sway.git
synced 2024-12-01 02:49:26 +00:00
jq optimisation
This commit is contained in:
parent
3caf6914fe
commit
bdde54602f
|
@ -131,10 +131,9 @@ elif [ "$SUBJECT" = "area" ] ; then
|
||||||
fi
|
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)')
|
eval "$( swaymsg -t get_tree |\
|
||||||
GEOM=$(echo "$FOCUSED" | jq -r '.rect | "\(.x),\(.y) \(.width)x\(.height)"')
|
jq -r '..|try select(.focused == true)|
|
||||||
APP_ID=$(echo "$FOCUSED" | jq -r '.app_id')
|
"GEOM=\"\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)\"\nAPP_ID=\"\(.app_id)\"\nWHAT=\"\(.app_id) window\""' )"
|
||||||
WHAT="$APP_ID window"
|
|
||||||
elif [ "$SUBJECT" = "screen" ] ; then
|
elif [ "$SUBJECT" = "screen" ] ; then
|
||||||
GEOM=""
|
GEOM=""
|
||||||
WHAT="Screen"
|
WHAT="Screen"
|
||||||
|
|
Loading…
Reference in a new issue