mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-04-24 06:47:44 +02:00
Attempt to get desktop scaling factor from the environment directly.
This commit is contained in:
parent
d5527f87cb
commit
13c4aca5ac
1 changed files with 30 additions and 1 deletions
|
@ -20,4 +20,33 @@ if command -v gamemoderun > /dev/null 2>&1; then
|
||||||
COMMAND="$COMMAND gamemoderun"
|
COMMAND="$COMMAND gamemoderun"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if user already has a manual Avalonia scaling override or session type is x11
|
||||||
|
if [[ -n "${AVALONIA_GLOBAL_SCALE_FACTOR-}" || "$(echo "$XDG_SESSION_TYPE")" == "x11" ]]; then
|
||||||
|
echo "Scaling: Performed by environment, skipping." >&2
|
||||||
|
else
|
||||||
|
# Attempt to get desktop scaling from environment (GNOME)
|
||||||
|
if [[ "$(echo "$XDG_CURRENT_DESKTOP")" == "GNOME" ]] && command -v gsettings >/dev/null; then
|
||||||
|
echo -n 'Scaling: GNOME desktop scaling query...' >&2
|
||||||
|
SCALING="$(gsettings get org.gnome.desktop.interface scaling-factor)"
|
||||||
|
SCALING="${SCALING##* }"
|
||||||
|
echo "found! Factor: ${SCALING}" >&2
|
||||||
|
|
||||||
|
# Attempt to get desktop scaling from X Query (Others)
|
||||||
|
elif command -v xrdb >/dev/null && command -v bc >/dev/null; then
|
||||||
|
echo -n 'Scaling: X FreeType DPI scaling query...' >&2
|
||||||
|
dpi="$(xrdb -get Xft.dpi)"
|
||||||
|
if [[ -n "${dpi}" ]]; then
|
||||||
|
SCALING=$(echo "scale=2; ${dpi}/96" | bc)
|
||||||
|
echo "found! Factor: ${SCALING}" >&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${SCALING-}" || "${SCALING-}" == "0" ]]; then
|
||||||
|
echo 'Scaling: Unset scaling value, using default scaling.' >&2
|
||||||
|
SCALING="1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMMAND="$COMMAND AVALONIA_GLOBAL_SCALE_FACTOR=$SCALING"
|
||||||
|
fi
|
||||||
|
|
||||||
exec $COMMAND "$SCRIPT_DIR/$RYUJINX_BIN" "$@"
|
exec $COMMAND "$SCRIPT_DIR/$RYUJINX_BIN" "$@"
|
Loading…
Add table
Reference in a new issue