adaptive sync
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
wall_dir="${1:?wallpaper directory required}"
|
||||
img=$(find "$wall_dir" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | shuf -n1)
|
||||
if [ -n "$img" ]; then
|
||||
exec swaylock -f -i "$img"
|
||||
else
|
||||
exec swaylock -f
|
||||
fi
|
||||
swaymsg -q output DP-1 adaptive_sync off # lock screen redraws rarely: fixed 240 Hz
|
||||
swaylock -f ${img:+-i "$img"}
|
||||
# once unlocked, let vrr-follow decide again (in background so swayidle/suspend aren't held up)
|
||||
( while pgrep -x swaylock >/dev/null; do sleep 1; done
|
||||
~/.config/sway/scripts/vrr-follow once ) &
|
||||
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user