1
#!/bin/bash
set -e
WAYLAND_SESSIONS_DIR="/usr/share/wayland-sessions/"
USERNAME=$(logname)
# 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 "Configuring a big picture mode desktop session..."
read -p "Do you want to continue? (Y/n) " -r
echo
if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
echo "Aborting installation."
exit 1
fi
# Create gamescope-session script in /usr/bin
GAMESCOPE_SCRIPT="/usr/bin/gamescope-session"
EXIT_STEAM_SCRIPT="/usr/bin/steamos-session-select"
cat > "$GAMESCOPE_SCRIPT" <<EOF
#!/bin/bash
gamescope -h 2160 -r 100 --hdr-enabled --hdr-itm-target-nits 400 --mangoapp -e -- steam -gamepadui -steamos3 -steampal -steamdeck
EOF
chmod +x "$GAMESCOPE_SCRIPT"
echo "Gamescope session script installed to $GAMESCOPE_SCRIPT"
# this should return user to desktop mode
cat > "$EXIT_STEAM_SCRIPT" <<EOF
#!/bin/bash
steam -shutdown
EOF
chmod +x "$EXIT_STEAM_SCRIPT"
# Create steam.desktop session file in /usr/share/wayland-sessions
STEAM_DESKTOP="$WAYLAND_SESSIONS_DIR/steam.desktop"
cat > "$STEAM_DESKTOP" <<EOF
[Desktop Entry]
Encoding=UTF-8
Name=Steam (gamescope)
Comment=Launch Steam within Gamescope
Exec=gamescope-session
Type=WaylandSession
DesktopNames=gamescope
EOF
echo "Steam Gamescope session added to $STEAM_DESKTOP"
For immediate assistance, please email our customer support: [email protected]