Compare commits

...

6 commits

Author SHA1 Message Date
Bluey Enjoyer
356ea7ea25 Merge branch 'brute_scaling' into 'master'
linux: Attempt to apply Avalonia scaling factor via environment pre-launch.

See merge request ryubing/ryujinx!1
2025-04-13 05:31:27 -05:00
yeager
7c89e87deb Update Swedish translation in locales.json
See merge request ryubing/ryujinx!7
2025-04-13 02:48:00 -05:00
Bluey Enjoyer
35f5188e75 Merge branch ryujinx:master into brute_scaling 2025-04-05 18:48:22 -05:00
Piplup
42518f2304
Github feedback 2025-03-13 17:55:48 +00:00
Piplup
4e61c3369b
Janky GNOME workaround and added a fallback kscreen-doctor implementation if needed. 2025-03-13 17:52:57 +00:00
Piplup
13c4aca5ac
Attempt to get desktop scaling factor from the environment directly. 2025-03-13 17:52:32 +00:00
2 changed files with 38 additions and 2 deletions

View file

@ -19914,7 +19914,7 @@
"pl_PL": "Skróty Klawiszowe Klawiatury", "pl_PL": "Skróty Klawiszowe Klawiatury",
"pt_BR": "Atalhos do Teclado", "pt_BR": "Atalhos do Teclado",
"ru_RU": "Горячие клавиши", "ru_RU": "Горячие клавиши",
"sv_SE": "Snabbtangenter för tangentbord", "sv_SE": "Snabbtangenter",
"th_TH": "ปุ่มลัดของคีย์บอร์ด", "th_TH": "ปุ่มลัดของคีย์บอร์ด",
"tr_TR": "Klavye Kısayolları", "tr_TR": "Klavye Kısayolları",
"uk_UA": "Гарячі клавіші", "uk_UA": "Гарячі клавіші",

View file

@ -20,4 +20,40 @@ 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-}" ] || [ "$XDG_SESSION_TYPE" = "x11" ]; then
echo "Scaling: Performed by environment, skipping." >&2
else
# Query monitor config directly (GNOME), default display only.
if [[ "$(echo "$XDG_CURRENT_DESKTOP")" == "GNOME" && -f ~/.config/monitors.xml ]] then
echo -n 'Scaling: Monitor config located, querying scale...' >&2
SCALING="$(grep '<scale' ~/.config/monitors.xml -m 1 | cut -f2 -d">"|cut -f1 -d"<")"
SCALING="${SCALING##* }"
echo "found! Factor: ${SCALING}" >&2
# Fallback to X DPI query for others.
# Plasma handles this fine, GNOME will always round up e.g. 1.25 -> 2.00.
elif command -v xrdb >/dev/null; then
echo -n 'Scaling: Attempting to get scaling from X DPI value...' >&2
dpi="$(xrdb -get Xft.dpi)"
if [[ -n "${dpi}" ]]; then
SCALING=$(awk -vdpi="$dpi" 'BEGIN{print dpi/96}')
fi
echo "found! Factor: ${SCALING}"
# Query kscreen-doctor for Plasma as a fallback.
elif [[ "$(echo "$XDG_CURRENT_DESKTOP")" == "KDE" ]] && command -v kscreen-doctor >/dev/null; then
# gsub strips ANSI color codes from ksd output
SCALING=$(kscreen-doctor --outputs | awk '/Scale:/{gsub(/\x1b\[[0-9;]*m/,""); print $2; exit}')
echo "found! Factor: ${SCALING}"
fi
if [[ -z "${SCALING-}" || "${SCALING-}" == "0" ]]; then
echo 'Unset invalid scaling value' >&2
SCALING="1"
fi
COMMAND="$COMMAND AVALONIA_GLOBAL_SCALE_FACTOR=$SCALING"
fi
exec $COMMAND "$SCRIPT_DIR/$RYUJINX_BIN" "$@" exec $COMMAND "$SCRIPT_DIR/$RYUJINX_BIN" "$@"