Some finetuning of toggling mode
This commit is contained in:
@@ -39,18 +39,12 @@ max_visible="$(awk -v w="$COLUMN_WIDTH" 'BEGIN{ if (w<=0) {print 1} else {print
|
|||||||
|
|
||||||
overflow=$(( win_count - max_visible ))
|
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}')"
|
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' \
|
printf '{"text":"%s +%d","tooltip":"%d windows; approx %d fit (column_width=%s)","class":"overflow"}\n' \
|
||||||
"$ICON" "$overflow" "$win_count" "$max_visible" "$COLUMN_WIDTH"
|
"$ICON" "$overflow" "$win_count" "$max_visible" "$COLUMN_WIDTH"
|
||||||
else
|
else
|
||||||
# If you want it visible even when OK, change "" to "•"
|
|
||||||
printf '{"text":"","tooltip":"%d windows; approx %d fit","class":"ok"}\n' \
|
printf '{"text":"","tooltip":"%d windows; approx %d fit","class":"ok"}\n' \
|
||||||
"$win_count" "$max_visible"
|
"$win_count" "$max_visible"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
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
|
if [[ "$cur" == "scrolling" ]]; then
|
||||||
hyprctl keyword general:layout dwindle
|
new="dwindle"
|
||||||
else
|
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
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user