Some finetuning of toggling mode

This commit is contained in:
2026-02-27 17:30:18 +01:00
parent f7c84fb9d1
commit b71ebb9cb1
2 changed files with 11 additions and 10 deletions
@@ -39,18 +39,12 @@ 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
if (( overflow > 0 )) && [[ "$layout" == "scrolling" ]]; 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"
else
# If you want it visible even when OK, change "" to "•"
printf '{"text":"","tooltip":"%d windows; approx %d fit","class":"ok"}\n' \
"$win_count" "$max_visible"
fi
@@ -1,8 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
cur="$(hyprctl getoption general:layout | awk '/str:/ {print $2; exit}')"
cur="$(hyprctl getoption general:layout 2>/dev/null | awk '/str:/ {print $2; exit}')"
if [[ "$cur" == "scrolling" ]]; then
hyprctl keyword general:layout dwindle
new="dwindle"
else
hyprctl keyword general:layout scrolling
new="scrolling"
fi
hyprctl keyword general:layout "$new" >/dev/null
msg="Hyprland layout: $new"
echo "$msg"
# Show a notification if possible
if command -v notify-send >/dev/null 2>&1; then
notify-send -a Hyprland "Layout switched" "$msg"
fi