#!/bin/sh bus-monitor --session "type='signal',interface='org.freedesktop.ScreenSaver'" | while read x; do case "$x" in # Simulate monitor being off *"boolean true"*) xrandr --output HDMI-0 --brightness 0.0;; # Restore monitor brightness *"boolean false"*) xrandr --output HDMI-0 --brightness 1.0;; esac done