Enabling screen scaling in Linux DE with AVALONIA_GLOBAL_SCALE_FACTOR

merge-requests/131/head
WilliamWsyHK 2025-08-31 08:45:21 +08:00 committed by GreemDev
parent f55aa87ab9
commit d3c902180b
1 changed files with 12 additions and 0 deletions

View File

@ -16,6 +16,18 @@ fi
COMMAND="env LANG=C.UTF-8 DOTNET_EnableAlternateStackCheck=1"
XFT_DPI=$(xrdb -get Xft.dpi 2> /dev/null)
if [ -z "$XFT_DPI" ]; then
XFT_DPI=96
fi
AVALONIA_GLOBAL_SCALE_FACTOR=$(echo "scale=2; $XFT_DPI/96" | bc)
if [ -n "$AVALONIA_GLOBAL_SCALE_FACTOR" ]; then
COMMAND="$COMMAND AVALONIA_GLOBAL_SCALE_FACTOR=$AVALONIA_GLOBAL_SCALE_FACTOR"
fi
if command -v gamemoderun > /dev/null 2>&1; then
COMMAND="$COMMAND gamemoderun"
fi