#!/bin/sh

outputs_json="$(niri msg --json outputs)"

echo "$outputs_json" | jq -c '.[]' | while read -r out; do
    name=$(echo "$out" | jq -r '.name')
    dpms=$(echo "$out" | jq -r '.dpms')

    if [ "$dpms" = "On" ]; then
        echo "Turning off $name"
        niri msg output "$name" dpms off
    fi
done
