Swayscript : Fix multiple toggles.

This commit is contained in:
Dmitry Voronin 2024-09-08 03:39:26 +03:00
parent 1c7afa8072
commit a01d65e118
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k

View file

@ -20,11 +20,8 @@
# Toggle monitors.
function montoggle() {
if [[ "$(_monstate)" = "on" ]]; then
monoff
else
monon
fi
local state=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .power')
''${state} && monoff || monon
}
function monbar() {
@ -78,11 +75,8 @@
# Toggle gaming.
function gamingtoggle() {
if [[ "$(_gamingstate)" = "on" ]]; then
gamingoff
else
gamingon
fi
local state=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .adaptive_sync_status')
[[ "''${state}" = "disabled" ]] && gamingon || gamingoff
}
function _gamingstate() {