2024-06-14 05:13:07 +03:00
|
|
|
# TODO: Add different modes for different screens.
|
2024-05-08 18:26:33 +03:00
|
|
|
{ ... }: {
|
|
|
|
text = ''
|
2024-05-04 23:15:57 +03:00
|
|
|
export _swayvrrlist=(
|
|
|
|
"Huawei Technologies Co., Inc. ZQE-CBA 0xC080F622"
|
|
|
|
)
|
|
|
|
|
2024-05-08 18:26:33 +03:00
|
|
|
# Enable VRR.
|
|
|
|
function vrron() {
|
|
|
|
on() {
|
2024-05-04 23:15:57 +03:00
|
|
|
for vrr in ''${_swayvrrlist[@]}; do
|
|
|
|
swaymsg "output \"''${vrr}\" adaptive_sync on"
|
2024-06-14 05:13:07 +03:00
|
|
|
swaymsg "output \"''${vrr}\" mode 3440x1440@164.999Hz"
|
2024-05-04 23:15:57 +03:00
|
|
|
done
|
2024-05-08 18:26:33 +03:00
|
|
|
_vrrstate on
|
|
|
|
}
|
|
|
|
_sway_iterate_sockets on
|
|
|
|
}
|
|
|
|
|
|
|
|
# Disable VRR.
|
|
|
|
function vrroff() {
|
|
|
|
off() {
|
2024-05-04 23:15:57 +03:00
|
|
|
for vrr in ''${_swayvrrlist[@]}; do
|
|
|
|
swaymsg "output \"''${vrr}\" adaptive_sync off"
|
2024-06-14 05:13:07 +03:00
|
|
|
swaymsg "output \"''${vrr}\" mode 3440x1440@59.973Hz"
|
2024-05-04 23:15:57 +03:00
|
|
|
done
|
2024-05-08 18:26:33 +03:00
|
|
|
_vrrstate off
|
|
|
|
}
|
|
|
|
_sway_iterate_sockets off
|
|
|
|
}
|
|
|
|
|
|
|
|
# Toggle VRR.
|
|
|
|
function vrrtoggle() {
|
2024-05-08 19:22:04 +03:00
|
|
|
if [[ "$(_vrrstate)" = "on" ]]; then
|
2024-05-08 18:26:33 +03:00
|
|
|
vrroff
|
2024-05-08 19:22:04 +03:00
|
|
|
else
|
|
|
|
vrron
|
2024-05-08 18:26:33 +03:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function _vrrstate() {
|
|
|
|
if [[ "''${1}" = "" ]]; then
|
2024-05-08 21:12:48 +03:00
|
|
|
cat /tmp/.vrrstate 2> /dev/null || echo off
|
2024-05-08 18:26:33 +03:00
|
|
|
else
|
|
|
|
echo "''${*}" > /tmp/.vrrstate
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
}
|