Fix app crash: resolve DISPLAY environment and input device issues

- Fixed start.sh environment variable loading from systemctl
- Use here-document (<<<) instead of pipe for subshell to preserve exports
- Added better error handling for evdev device enumeration
- Added exception handling in intro video playback with detailed logging
- App now properly initializes with DISPLAY=:0 and WAYLAND_DISPLAY=wayland-0
This commit is contained in:
Kiwy Player
2026-01-17 22:32:02 +02:00
parent e2abde9f9c
commit 11436ddeab
4 changed files with 114 additions and 50 deletions

View File

@@ -35,12 +35,24 @@ load_user_environment() {
if command -v systemctl &>/dev/null; then
user_env=$(systemctl --user show-environment 2>/dev/null)
if [ -n "$user_env" ]; then
# Extract display-related variables
echo "$user_env" | grep -E '^(DISPLAY|WAYLAND_DISPLAY|XDG_RUNTIME_DIR|DBUS_SESSION_BUS_ADDRESS)=' | while read -r line; do
export "$line"
done
# Extract display-related variables without subshell to preserve exports
while IFS='=' read -r key value; do
case "$key" in
DISPLAY|WAYLAND_DISPLAY|XDG_RUNTIME_DIR|DBUS_SESSION_BUS_ADDRESS)
export "$key=$value"
;;
esac
done <<< "$user_env"
log_message "Loaded user environment from systemctl --user"
return 0
# Verify we got valid display
if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then
log_message "Display environment ready: DISPLAY='$DISPLAY' WAYLAND_DISPLAY='$WAYLAND_DISPLAY'"
return 0
else
log_message "Systemctl didn't provide display variables, trying fallback..."
fi
fi
fi