Skip to content

Instantly share code, notes, and snippets.

@akku1139
Last active March 31, 2026 02:47
Show Gist options
  • Select an option

  • Save akku1139/81226ff7ab9f2659cfcc66bac9ba496c to your computer and use it in GitHub Desktop.

Select an option

Save akku1139/81226ff7ab9f2659cfcc66bac9ba496c to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
STEAM_DIR="$HOME/.local/share/Steam/ubuntu12_64"
DESKTOP_DIR="$HOME/.local/share/applications"
echo "=== Steam Wayland Wrapper + Desktop Setup ==="
# Create directories if needed
mkdir -p "$STEAM_DIR" "$DESKTOP_DIR"
cd "$STEAM_DIR"
# 1. Rename original binary if it exists and wrapper doesn't
if [[ -f steamwebhelper && ! -f steamwebhelper.real ]]; then
echo "Renaming original steamwebhelper to steamwebhelper.real..."
mv steamwebhelper steamwebhelper.real
elif [[ -f steamwebhelper.real ]]; then
echo "steamwebhelper.real already exists — skipping rename."
else
echo "ERROR: steamwebhelper not found in $STEAM_DIR"
echo "Make sure Steam is installed and has been run at least once."
exit 1
fi
# 2. Create the smart wrapper
cat > steamwebhelper << 'EOF'
#!/bin/bash
# Wayland mode via environment variable
if [[ "${STEAM_WEBHELPER_WAYLAND:-0}" == "1" ]]; then
echo "SteamWebHelper: Forcing native Wayland Ozone mode (GPU acceleration enabled)"
exec ./steamwebhelper.real \
--ozone-platform=wayland \
--enable-features=UseOzonePlatform,WaylandWindowDecorations \
--disable-features=UseChromeOSDirectVideoDecoder \
"$@"
else
# Normal XWayland mode - unchanged
exec ./steamwebhelper.real "$@"
fi
EOF
chmod +x steamwebhelper
echo "Wrapper script created and made executable."
# 3. Create the two desktop files (only if they don't exist or are different)
cd "$DESKTOP_DIR"
cat > SteamW.desktop << 'EOF'
[Desktop Entry]
Name=Steam (Wayland)
Comment=Valve's digital software delivery platform (Wayland mode)
Exec=env STEAM_WEBHELPER_WAYLAND=1 steam -noverifyfiles %U
Icon=steam
Terminal=false
Type=Application
Categories=Network;Game;
StartupNotify=true
StartupWMClass=steam
MimeType=x-scheme-handler/steam;
EOF
cat > SteamX.desktop << 'EOF'
[Desktop Entry]
Name=Steam (xWayland)
Comment=Valve's digital software delivery platform (XWayland fallback)
Exec=env STEAM_WEBHELPER_WAYLAND=0 steam -noverifyfiles %U
Icon=steam
Terminal=false
Type=Application
Categories=Network;Game;
StartupNotify=true
StartupWMClass=steam
MimeType=x-scheme-handler/steam;
EOF
chmod +x SteamW.desktop SteamX.desktop
echo "Desktop files created:"
echo " ~/.local/share/applications/SteamW.desktop (Wayland)"
echo " ~/.local/share/applications/SteamX.desktop (xWayland)"
echo ""
echo "Setup complete!"
echo ""
echo "Usage:"
echo "• Use 'Steam (Wayland)' for native Wayland library view"
echo "• Use 'Steam (xWayland)' for best compatibility with store/community pages"
echo ""
echo "After any Steam update that overwrites steamwebhelper, just re-run this script."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment