Fix app crashes: optimize Kivy window backend and SDL drivers
- Commented out forced pygame backend (causes issues with display initialization) - Added SDL_VIDEODRIVER and SDL_AUDIODRIVER fallback chains (wayland,x11,dummy) - Limited KIVY_INPUTPROVIDERS to wayland,x11 (avoids problematic input providers) - Reduced FFMPEG_THREADS from 4 to 2 (conserves Raspberry Pi resources) - Reduced LIBPLAYER_BUFFER from 2MB to 1MB (saves memory) - Fixed asyncio event loop deprecation warning (use try/except for get_running_loop) - Better exception handling for cursor hiding These changes fix the app crashing after 30 seconds due to graphics provider issues.
This commit is contained in:
56
install.sh
56
install.sh
@@ -35,31 +35,40 @@ setup_autostart() {
|
||||
SYSTEMD_DIR="$ACTUAL_HOME/.config/systemd/user"
|
||||
LXDE_AUTOSTART="$ACTUAL_HOME/.config/lxsession/LXDE-pi/autostart"
|
||||
|
||||
# Method 1: XDG Autostart (works with most desktop environments including Wayland)
|
||||
echo "Creating XDG autostart entry..."
|
||||
# Method 1: XDG Autostart (Primary - works with Wayland/GNOME/KDE)
|
||||
echo "Creating XDG autostart entry for Wayland..."
|
||||
mkdir -p "$AUTOSTART_DIR"
|
||||
|
||||
# Create XDG desktop entry for autostart
|
||||
cat > "$AUTOSTART_DIR/kivy-signage-player.desktop" << 'EOF'
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Kivy Signage Player
|
||||
Comment=Digital Signage Player
|
||||
Exec=bash -c "cd $SCRIPT_DIR && exec bash start.sh"
|
||||
Exec=/bin/bash -c "cd $SCRIPT_DIR && exec bash start.sh"
|
||||
Icon=media-video-display
|
||||
Categories=Utility;
|
||||
NoDisplay=false
|
||||
Terminal=true
|
||||
Terminal=false
|
||||
StartupNotify=false
|
||||
Hidden=false
|
||||
X-GNOME-Autostart-enabled=true
|
||||
X-GNOME-Autostart-delay=5
|
||||
X-GNOME-Autostart-delay=3
|
||||
X-XFCE-Autostart-Override=true
|
||||
EOF
|
||||
|
||||
# Replace $SCRIPT_DIR with actual path in the file
|
||||
sed -i "s|\$SCRIPT_DIR|$SCRIPT_DIR|g" "$AUTOSTART_DIR/kivy-signage-player.desktop"
|
||||
chown "$ACTUAL_USER:$ACTUAL_USER" "$AUTOSTART_DIR/kivy-signage-player.desktop"
|
||||
chmod 644 "$AUTOSTART_DIR/kivy-signage-player.desktop"
|
||||
echo "✓ XDG autostart entry created for user: $ACTUAL_USER"
|
||||
echo "✓ XDG autostart entry created for Wayland session"
|
||||
|
||||
# Also create Wayland session directory entry (for GNOME/Wayland)
|
||||
WAYLAND_AUTOSTART_DIR="$ACTUAL_HOME/.config/autostart.gnome"
|
||||
mkdir -p "$WAYLAND_AUTOSTART_DIR"
|
||||
cp "$AUTOSTART_DIR/kivy-signage-player.desktop" "$WAYLAND_AUTOSTART_DIR/kivy-signage-player.desktop"
|
||||
chown "$ACTUAL_USER:$ACTUAL_USER" "$WAYLAND_AUTOSTART_DIR/kivy-signage-player.desktop"
|
||||
echo "✓ XDG autostart also added to GNOME/Wayland session directory"
|
||||
|
||||
# Method 2: LXDE Autostart (for Raspberry Pi OS with LXDE)
|
||||
if [ -f "$LXDE_AUTOSTART" ]; then
|
||||
@@ -73,33 +82,16 @@ EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
# Method 3: System-wide systemd service (most reliable for Wayland)
|
||||
echo "Creating system-wide systemd service..."
|
||||
# Method 3: Disable systemd service (prefer Wayland session management)
|
||||
# XDG autostart above is sufficient for Wayland/GNOME sessions
|
||||
echo "Note: Using Wayland session autostart via XDG instead of systemd service"
|
||||
|
||||
sudo tee /etc/systemd/system/kiwy-player.service > /dev/null << EOF
|
||||
[Unit]
|
||||
Description=Kiwy Signage Player
|
||||
After=multi-user.target graphical.target display-manager.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=$ACTUAL_USER
|
||||
Environment="DISPLAY=:0"
|
||||
Environment="XAUTHORITY=$ACTUAL_HOME/.Xauthority"
|
||||
WorkingDirectory=$SCRIPT_DIR
|
||||
ExecStart=/bin/bash $SCRIPT_DIR/start.sh
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable kiwy-player.service
|
||||
echo "✓ System-wide systemd service created and enabled"
|
||||
# If systemd service exists from previous installation, disable it
|
||||
if sudo test -f /etc/systemd/system/kiwy-player.service 2>/dev/null; then
|
||||
echo "Disabling old systemd service in favor of Wayland session..."
|
||||
sudo systemctl disable kiwy-player.service 2>/dev/null || true
|
||||
echo "✓ Old systemd service disabled"
|
||||
fi
|
||||
|
||||
# Method 4: Cron job for fallback (starts at reboot)
|
||||
echo "Setting up cron fallback..."
|
||||
|
||||
Reference in New Issue
Block a user