diff --git a/scripts/selecthover b/scripts/selecthover index d47e8e4..aafe0b2 100755 --- a/scripts/selecthover +++ b/scripts/selecthover @@ -2,9 +2,20 @@ CURSORPOS=$(hyprctl cursorpos -j) +X_POS=$(jq '.x' <<< $CURSORPOS) +Y_POS=$(jq '.y' <<< $CURSORPOS) + ACTIVE_WORKSPACE=$(hyprctl activeworkspace -j | jq '.id') -hyprctl clients -j | jq ".[] | \ - select(.workspace.id == $ACTIVE_WORKSPACE) | \ - select(.at[0] <= $(jq '.x' <<< $CURSORPOS) and .at[1] <= $(jq '.y' <<< $CURSORPOS) and (.at[0] + .size[0] >= $(jq '.x' <<< $CURSORPOS)) and (.at[1] + .size[1] >= $(jq '.y' <<< $CURSORPOS))) | .pid \ -" +hyprctl clients -j | jq "$(cat << EOF + .[] | + select(.workspace.id == $ACTIVE_WORKSPACE) | + select( + .at[0] <= $X_POS + and .at[1] <= $Y_POS + and (.at[0] + .size[0] >= $X_POS) + and (.at[1] + .size[1] >= $Y_POS) + ) | .pid +EOF +)" | tail -n 1 +