Different calculation
This commit is contained in:
@@ -13,14 +13,6 @@ 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":"","tooltip":"%d windows; approx %d fit","class":"ok"}\n' \
|
||||
"$win_count" "$max_visible"
|
||||
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 '
|
||||
@@ -47,6 +39,13 @@ max_visible="$(awk -v w="$COLUMN_WIDTH" 'BEGIN{ if (w<=0) {print 1} else {print
|
||||
|
||||
overflow=$(( win_count - max_visible ))
|
||||
|
||||
# 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
|
||||
overflow= 0
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if (( overflow > 0 )); then
|
||||
printf '{"text":"%s +%d","tooltip":"%d windows; approx %d fit (column_width=%s)","class":"overflow"}\n' \
|
||||
"$ICON" "$overflow" "$win_count" "$max_visible" "$COLUMN_WIDTH"
|
||||
|
||||
Reference in New Issue
Block a user