82 lines
2.1 KiB
Bash
Executable File
82 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
gamescope_has_option() {
|
|
if (gamescope --help 2>&1 | grep -e "$1" > /dev/null); then
|
|
return 0
|
|
fi
|
|
|
|
return 1
|
|
}
|
|
|
|
# Source device quirks if exists
|
|
if [ -f /usr/share/gamescope-session-plus/device-quirks ]; then
|
|
. /usr/share/gamescope-session-plus/device-quirks
|
|
fi
|
|
|
|
# Source user configuration from ~/.config/environment.d
|
|
set -a
|
|
for i in "${HOME}"/.config/environment.d/*.conf; do
|
|
[[ -f "${i}" ]] && . "${i}"
|
|
done
|
|
set +a
|
|
|
|
# Gamescope parameters
|
|
: "${OUTPUT_CONNECTOR:=*,eDP-1}"
|
|
GAMESCOPE_PARAMS="--prefer-output $OUTPUT_CONNECTOR"
|
|
|
|
# Check if NVK driver is in use
|
|
if vulkaninfo 2>/dev/null | grep -i "driverName" | grep -q "NVK"; then
|
|
# Workaround for https://gitlab.freedesktop.org/mesa/mesa/-/issues/13478
|
|
BACKEND="sdl"
|
|
GAMESCOPE_PARAMS+=" -f"
|
|
fi
|
|
|
|
if [ -n "$SCREEN_WIDTH" ] && [ -n "$SCREEN_HEIGHT" ]; then
|
|
GAMESCOPE_PARAMS+=" -W $SCREEN_WIDTH -H $SCREEN_HEIGHT"
|
|
fi
|
|
|
|
if [ -n "$INTERNAL_WIDTH" ] && [ -n "$INTERNAL_HEIGHT" ] ; then
|
|
GAMESCOPE_PARAMS+=" -w $INTERNAL_WIDTH -h $INTERNAL_HEIGHT"
|
|
fi
|
|
|
|
if [ -n "$DRM_MODE" ] ; then
|
|
GAMESCOPE_PARAMS+=" --generate-drm-mode $DRM_MODE"
|
|
fi
|
|
|
|
if [ -n "$ORIENTATION" ] ; then
|
|
GAMESCOPE_PARAMS+=" --force-orientation $ORIENTATION"
|
|
fi
|
|
|
|
if [ -n "$ADAPTIVE_SYNC" ]; then
|
|
GAMESCOPE_PARAMS+=" --adaptive-sync"
|
|
fi
|
|
|
|
if [ -n "$PANEL_TYPE" ] && gamescope_has_option "--force-panel-type"; then
|
|
GAMESCOPE_PARAMS+=" --force-panel-type $PANEL_TYPE"
|
|
fi
|
|
|
|
if [ -n "$CUSTOM_REFRESH_RATES" ] && gamescope_has_option "--custom-refresh-rates"; then
|
|
GAMESCOPE_PARAMS+=" --custom-refresh-rates $CUSTOM_REFRESH_RATES"
|
|
fi
|
|
|
|
if [ -n "$USE_ROTATION_SHADER" ] && gamescope_has_option "--use-rotation-shader"; then
|
|
GAMESCOPE_PARAMS+=" --use-rotation-shader $USE_ROTATION_SHADER"
|
|
fi
|
|
|
|
if [ -n "$BACKEND" ] && gamescope_has_option "--backend"; then
|
|
GAMESCOPE_PARAMS+=" --backend $BACKEND"
|
|
fi
|
|
|
|
if [ -f "$CURSOR_FILE" ]; then
|
|
# Use specified cursor if file exists
|
|
GAMESCOPE_PARAMS+=" --cursor ${CURSOR_FILE}"
|
|
fi
|
|
|
|
# Prefer a specific Vulkan adapter if defined
|
|
if [ -n "$VULKAN_ADAPTER" ]; then
|
|
GAMESCOPE_PARAMS+=" --prefer-vk-device $VULKAN_ADAPTER"
|
|
fi
|
|
|
|
# Start client application with Gamescope
|
|
gamescope $GAMESCOPE_PARAMS -- portprotonqt --fullscreen
|