#!/bin/bash # Aggressive display keep-alive for Raspberry Pi # Prevents HDMI from powering down DISPLAY_TIMEOUT=30 while true; do # Keep HDMI powered on (tvservice command) if command -v tvservice &> /dev/null; then /usr/bin/tvservice -p 2>/dev/null fi # Disable screensaver if command -v xset &> /dev/null; then DISPLAY=:0 xset s off 2>/dev/null DISPLAY=:0 xset -dpms 2>/dev/null DISPLAY=:0 xset dpms force on 2>/dev/null DISPLAY=:0 xset s reset 2>/dev/null fi # Move mouse to trigger activity if command -v xdotool &> /dev/null; then DISPLAY=:0 xdotool mousemove_relative 1 1 2>/dev/null DISPLAY=:0 xdotool mousemove_relative -1 -1 2>/dev/null fi # Disable monitor power saving if command -v xrandr &> /dev/null; then DISPLAY=:0 xrandr --output HDMI-1 --power-profile performance 2>/dev/null || true fi sleep $DISPLAY_TIMEOUT done