diff options
| author | 2026-10-13 17:03:34 -0400 | |
|---|---|---|
| committer | 2026-10-13 17:03:34 -0400 | |
| commit | 89387549e2670159a211de39a4ddf668addd9e9e (patch) | |
| tree | f372f7847a048b0325cc478c272bc7d9da9936f7 /files/sway/vrr_fullscreen.sh | |
| parent | 33567739337783e67167a43557c434accb6fe3a0 (diff) | |
| download | dotfiles-89387549e2670159a211de39a4ddf668addd9e9e.tar.gz dotfiles-89387549e2670159a211de39a4ddf668addd9e9e.tar.bz2 dotfiles-89387549e2670159a211de39a4ddf668addd9e9e.zip | |
Diffstat (limited to 'files/sway/vrr_fullscreen.sh')
| -rwxr-xr-x | files/sway/vrr_fullscreen.sh | 29 |
1 files changed, 29 insertions, 0 deletions
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 |