updated sh files
This commit is contained in:
@@ -1,16 +1,61 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Aggressive display keep-alive for Raspberry Pi
|
# Aggressive display keep-alive for Raspberry Pi
|
||||||
# Prevents HDMI from powering down
|
# Supports both X11 and Wayland environments
|
||||||
|
|
||||||
DISPLAY_TIMEOUT=30
|
DISPLAY_TIMEOUT=30
|
||||||
|
|
||||||
|
# Detect display server type
|
||||||
|
detect_display_server() {
|
||||||
|
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||||
|
echo "wayland"
|
||||||
|
elif [ -n "$DISPLAY" ]; then
|
||||||
|
echo "x11"
|
||||||
|
else
|
||||||
|
echo "unknown"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
DISPLAY_SERVER=$(detect_display_server)
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
# Keep HDMI powered on (tvservice command)
|
# Keep HDMI powered on (works for both X11 and Wayland)
|
||||||
if command -v tvservice &> /dev/null; then
|
if command -v tvservice &> /dev/null; then
|
||||||
/usr/bin/tvservice -p 2>/dev/null
|
/usr/bin/tvservice -p 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable screensaver
|
if [ "$DISPLAY_SERVER" = "wayland" ]; then
|
||||||
|
# Wayland-specific power management
|
||||||
|
|
||||||
|
# Method 1: Use wlr-randr for Wayland compositors (if available)
|
||||||
|
if command -v wlr-randr &> /dev/null; then
|
||||||
|
wlr-randr --output HDMI-A-1 --on 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Method 2: Prevent idle using systemd-inhibit
|
||||||
|
if command -v systemd-inhibit &> /dev/null; then
|
||||||
|
# This is already running, but refresh the lock
|
||||||
|
systemctl --user restart plasma-ksmserver.service 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Method 3: Use wlopm (Wayland output power management)
|
||||||
|
if command -v wlopm &> /dev/null; then
|
||||||
|
wlopm --on \* 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Method 4: Simulate activity via input (works on Wayland)
|
||||||
|
if command -v ydotool &> /dev/null; then
|
||||||
|
ydotool mousemove -x 1 -y 1 2>/dev/null || true
|
||||||
|
ydotool mousemove -x -1 -y -1 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Method 5: GNOME/KDE Wayland idle inhibit
|
||||||
|
if command -v gnome-session-inhibit &> /dev/null; then
|
||||||
|
# Already inhibited by running process
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
# X11-specific power management (original code)
|
||||||
if command -v xset &> /dev/null; then
|
if command -v xset &> /dev/null; then
|
||||||
DISPLAY=:0 xset s off 2>/dev/null
|
DISPLAY=:0 xset s off 2>/dev/null
|
||||||
DISPLAY=:0 xset -dpms 2>/dev/null
|
DISPLAY=:0 xset -dpms 2>/dev/null
|
||||||
@@ -28,6 +73,7 @@ while true; do
|
|||||||
if command -v xrandr &> /dev/null; then
|
if command -v xrandr &> /dev/null; then
|
||||||
DISPLAY=:0 xrandr --output HDMI-1 --power-profile performance 2>/dev/null || true
|
DISPLAY=:0 xrandr --output HDMI-1 --power-profile performance 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
sleep $DISPLAY_TIMEOUT
|
sleep $DISPLAY_TIMEOUT
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
1768675283.8000998
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Wait for desktop environment to be ready
|
# Wait for desktop environment to be ready
|
||||||
sleep 10
|
sleep 15
|
||||||
|
|
||||||
# Start the player
|
# Start the player
|
||||||
cd "/home/pi/Desktop/Kiwy-Signage" && bash start.sh
|
cd "/home/pi/Desktop/Kiwy-Signage" && bash start.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user