From 89387549e2670159a211de39a4ddf668addd9e9e Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Tue, 13 Oct 2026 17:03:34 -0400 Subject: Misc updates --- files/sway/vrr_fullscreen.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 files/sway/vrr_fullscreen.sh (limited to 'files/sway/vrr_fullscreen.sh') diff --git a/files/sway/vrr_fullscreen.sh b/files/sway/vrr_fullscreen.sh new file mode 100755 index 0000000..0db4e10 --- /dev/null +++ b/files/sway/vrr_fullscreen.sh @@ -0,0 +1,29 @@ +#! /usr/bin/env bash + +# https://github.com/swaywm/sway/issues/5076#issuecomment-1753499364 + +output_vrr_whitelist=("$(awk -F ' ' 'NR==1{print $3}' $HOME/.config/sway/monitors)") + +swaymsg -t subscribe -m '[ "window" ]' | while read window_json; do + app_id=$(echo ${window_json} | jq -r '.container.app_id') + if [[ $app_id == "com.moonlight_stream.Moonlight" || $app_id == "Waydroid" ]]; then + continue + fi + window_event=$(echo ${window_json} | jq -r '.change') + if [[ $window_event = "focus" || $window_event = "fullscreen_mode" ]]; then + output_json=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused == true)') + output_name=$(echo ${output_json} | jq -r '.name') + if [[ ${output_vrr_whitelist[*]} =~ ${output_name} ]]; then + output_vrr_status=$(echo ${output_json} | jq -r '.adaptive_sync_status') + window_fullscreen_status=$(echo ${window_json} | jq -r '.container.fullscreen_mode') + if [[ $output_vrr_status = "disabled" && $window_fullscreen_status = "1" ]]; then + swaymsg output "${output_name}" adaptive_sync 1 + swaymsg 'seat * hide_cursor 0' + fi + if [[ $output_vrr_status = "enabled" && $window_fullscreen_status = "0" ]]; then + swaymsg output "${output_name}" adaptive_sync 0 + swaymsg 'seat * hide_cursor 4000' + fi + fi + fi +done -- cgit v1.2.3-101-g0448