1
#!/bin/bash
set -e  

WAYLAND_SESSIONS_DIR="/usr/share/wayland-sessions/"

# Ensure the script is run as root
if [ "$EUID" -ne 0 ]; then
    echo "This script must be run with sudo."
    exit 1
fi

# Check if Wayland sessions directory exists
if [ ! -d "$WAYLAND_SESSIONS_DIR" ]; then
    echo "Error: $WAYLAND_SESSIONS_DIR does not exist. Is Wayland installed?"
    exit 1
fi

# Confirm installation
echo "Ensure you have followed the es-de quickstart instructions before runninging this script."
echo "See: https://gitlab.com/es-de/emulationstation-de/-/blob/master/USERGUIDE.md#quick-start-guide - for details"
read -p "Do you want to continue? (Y/n) " -r
echo
if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
    echo "Aborting installation."
    exit 1
fi

# Create Emu-DE-sesion script in /usr/bin
EMU_SCRIPT="/usr/bin/Emu-DE-sesion"

cat > "$EMU_SCRIPT" <<EOF
#!/bin/bash
gamescope -h 2160 -r 100 -- es-de
EOF

chmod +x $EMU_SCRIPT
echo "wrote to $EMU_SCRIPT"
echo "Configuring desktop session..."

# Create emu.desktop session file in /usr/share/wayland-sessions
EMU_DESKTOP="$WAYLAND_SESSIONS_DIR/emu.desktop"
cat > "$EMU_DESKTOP" <<EOF
[Desktop Entry]
Encoding=UTF-8
Name=Emu-DE
Comment=Launch emulationstation desktop edition within gamescope
Exec=Emu-DE-session
Type=WaylandSession
DesktopNames=EMU_DE
EOF

echo "Session added to $EMU_DESKTOP"

For immediate assistance, please email our customer support: [email protected]

Download RAW File