Added a check to prevent overflow counted if scrolling is not is

enabled
This commit is contained in:
2026-02-27 17:15:01 +01:00
parent 65e8a338ab
commit f5308dd2e3
@@ -13,6 +13,13 @@ fail_json() {
command -v hyprctl >/dev/null 2>&1 || fail_json "hyprctl not in PATH"
command -v jq >/dev/null 2>&1 || fail_json "jq not in PATH"
# If layout is not scrolling → respond with 0
layout="$(hyprctl getoption general:layout 2>/dev/null | awk '/str:/ {print $2; exit}')"
if [[ "$layout" != "scrolling" ]]; then
printf '{"text":"%s 0","tooltip":"layout != scrolling","class":"ok"}\n' "$ICON"
exit 0
fi
# Focused monitor id + its active workspace id (both numeric)
read -r focused_mon_id focused_ws_id < <(
hyprctl -j monitors 2>/dev/null | jq -r '
@@ -24,7 +31,7 @@ read -r focused_mon_id focused_ws_id < <(
# Count mapped windows on that monitor+workspace
win_count="$(
hyprctl -j clients 2>/dev/null | jq --argjson ws "$focused_ws_id" --argjson mid "$focused_mon_id" '
hyprctl -j clients 2>/dev/null | jq --argjson ws it should only respond with a"$focused_ws_id" --argjson mid "$focused_mon_id" '
[ .[]
| select(.mapped == true)
| select(.workspace.id == $ws)