gamescope-session/debian/extras/gamescope-resolution-configurator

84 lines
2.0 KiB
Plaintext
Raw Normal View History

#!/usr/bin/bash
2023-04-27 16:27:21 +02:00
DEFAULT_RESOLUTION=$(xdpyinfo | awk '/dimensions/{print $2}')
# Steam Deck Default
SCREEN_WIDTH=1280
SCREEN_HEIGHT=800
# Sometimes gamescope's DRM-retrieved resolution values
# don't work well with what gamescope actually allows,
# and can result in a "verifying installation" hang.
# To fix that we have to make some adjustments for
# those values to ones gamescope accepts.
# 32:9
if [[ $DEFAULT_RESOLUTION == 5120x1440 ]]; then
SCREEN_WIDTH=5120
SCREEN_HEIGHT=1440
fi
if [[ $DEFAULT_RESOLUTION == 3840x1080 ]]; then
SCREEN_WIDTH=3840
SCREEN_HEIGHT=1080
fi
# 21:9
if [[ $DEFAULT_RESOLUTION == 3440x1440 ]]; then
SCREEN_WIDTH=3440
SCREEN_HEIGHT=1440
fi
if [[ $DEFAULT_RESOLUTION == 2160x1080 ]]; then
SCREEN_WIDTH=2160
SCREEN_HEIGHT=1080
fi
# 16:10
# gamescope is not friendly to 16:10 aspect ratio other than it's default 1280x800, so we have to do some conversion:
if [[ $DEFAULT_RESOLUTION == 3840x2400 ]]; then
SCREEN_WIDTH=3840
SCREEN_HEIGHT=2160
fi
# Oddly enough many 2560x1600 laptops dont support 2560x1440, so we have to drop them down to 1920x1080
if [[ $DEFAULT_RESOLUTION == 2560x1600 ]]; then
SCREEN_WIDTH=1920
SCREEN_HEIGHT=1080
fi
if [[ $DEFAULT_RESOLUTION == 1920x1200 ]]; then
SCREEN_WIDTH=1920
SCREEN_HEIGHT=1080
fi
# 16:9
if [[ $DEFAULT_RESOLUTION == 3840x2160 ]]; then
SCREEN_WIDTH=3840
SCREEN_HEIGHT=2160
fi
if [[ $DEFAULT_RESOLUTION == 2560x1440 ]]; then
SCREEN_WIDTH=2560
SCREEN_HEIGHT=1440
fi
if [[ $DEFAULT_RESOLUTION == 1920x1080 ]]; then
SCREEN_WIDTH=1920
SCREEN_HEIGHT=1080
fi
if [[ $DEFAULT_RESOLUTION == 1280x720 ]]; then
SCREEN_WIDTH=1280
SCREEN_HEIGHT=720
fi
#Quirk for framework laptop:
if [[ $DEFAULT_RESOLUTION == 2256x1504 ]]; then
SCREEN_WIDTH=2160
SCREEN_HEIGHT=1080
fi
CONFIG=$HOME/.config/environment.d/gamescope-session.conf
if [ ! -f $CONFIG ]; then
2023-04-27 16:27:21 +02:00
echo "Creating $CONFIG"
mkdir -p $HOME/.config/environment.d/
echo 'SCREEN_WIDTH='$SCREEN_WIDTH > $CONFIG
echo 'SCREEN_HEIGHT='$SCREEN_HEIGHT >> $CONFIG
fi