Fix primary output detection in sunshine-run
Sometimes (perhaps with some recent update, it is listed as just "connected" not "primary".
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
# File Created: Tuesday, 23rd August 2023 3:28:52 pm
|
||||
# Author: Josh.5 (jsunnex@gmail.com)
|
||||
# -----
|
||||
# Last Modified: Friday, 23rd August 2023 4:21:00 pm
|
||||
# Modified By: Josh.5 (jsunnex@gmail.com)
|
||||
# Last Modified: Saturday, 20th July 2024 7:07:00 pm
|
||||
# Modified By: Josh5 (jsunnex@gmail.com)
|
||||
###
|
||||
set -e
|
||||
|
||||
@@ -71,8 +71,12 @@ if ([ "X${SUNSHINE_CLIENT_WIDTH:-}" != "X" ] && [ "X${SUNSHINE_CLIENT_HEIGHT:-}"
|
||||
__current_refresh_rate=$(echo ${__current_current_mode:?} | awk '{sub(/\*/, "", $2); print $2}')
|
||||
|
||||
# Get the primary output device
|
||||
__primary_output="$(echo "${__xrandr_out:?}" | grep primary | awk '{print $1}')"
|
||||
__primary_output="$(echo "${__xrandr_out:?}" | grep primary | head -n1 | awk '{print $1}')"
|
||||
if [ "X${__primary_output:-}" = "X" ]; then
|
||||
__primary_output="$(echo "${__xrandr_out:?}" | grep -E "\sconnected" | head -n1 | awk '{print $1}')"
|
||||
fi
|
||||
|
||||
if [ "X${__primary_output:-}" != "X" ]; then
|
||||
# Get the modeline from cvt and extract the second line (which contains the modeline)
|
||||
__client_modeline=$(cvt "${SUNSHINE_CLIENT_WIDTH:?}" "${SUNSHINE_CLIENT_HEIGHT:?}" "${SUNSHINE_CLIENT_FPS:?}" | grep Modeline | sed -e 's/Modeline //')
|
||||
# Create a new mode for this. This allows us to force a set refresh rate that may not be supported by the display
|
||||
@@ -136,6 +140,7 @@ if ([ "X${SUNSHINE_CLIENT_WIDTH:-}" != "X" ] && [ "X${SUNSHINE_CLIENT_HEIGHT:-}"
|
||||
echo "primary_output='${__primary_output:?}'" >> /tmp/sunshine-exec-run.conf
|
||||
echo "display_mode='${__current_resolution:?}'" >> /tmp/sunshine-exec-run.conf
|
||||
echo "display_rate='${__current_refresh_rate:?}'" >> /tmp/sunshine-exec-run.conf
|
||||
fi
|
||||
)
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user