Files
i3-dot/sway/scripts/vrr-follow
T
2026-09-27 17:16:30 +07:00

15 lines
589 B
Bash
Executable File

#!/bin/sh
# adaptive_sync on DP-1 only while the visible workspace shows a fullscreen window
OUT=DP-1
update() {
if [ "$(swaymsg -t get_tree | jq --arg o "$OUT" '
.nodes[] | select(.name==$o) as $out | $out.nodes[]
| select(.name==$out.current_workspace)
| [.. | objects | select((.fullscreen_mode? // 0) > 0)] | length')" -gt 0 ]
then s=on; else s=off; fi
[ "$s" != "$last" ] && swaymsg -q output "$OUT" adaptive_sync "$s" && last=$s
}
[ "$1" = once ] && { update; exit; }
update
swaymsg -t subscribe -m '["workspace","window"]' | while read -r _; do update; done