Only pass through scaling parameters when needed

This commit is contained in:
Peter Cai 2025-03-09 18:12:58 -04:00
parent 82a0dc47e3
commit d549d68c89

View file

@ -40,6 +40,12 @@ if [ "$(get_image_label "$image_name" net.typeblog.dobu.x11_required)" == "true"
x11_required=true
fi
scaling_params_required=false
if [ "$(get_image_label "$image_name" net.typeblog.dobu.scaling_params_required)" == "true" ]; then
scaling_params_required=true
fi
if [[ -n $PULSE_SERVER ]]; then # remove prefix
host_pulse=${PULSE_SERVER#unix:}
else # default guess
@ -90,6 +96,11 @@ if $x11_required; then
extra_args="$extra_args -v ${XORG_SRC}:/tmp/.X11-unix/X0 -e DISPLAY=:0"
fi
# Same for scaling params
if $scaling_params_required; then
extra_args="$extra_args -e GDK_SCALE=$GDK_SCALE -e QT_SCALE_FACTOR=$QT_SCALE_FACTOR -e QT_SCREEN_SCALE_FACTORS=$QT_SCREEN_SCALE_FACTORS -e QT_AUTO_SCREEN_SCALE_FACTOR=$QT_AUTO_SCREEN_SCALE_FACTOR"
fi
# Expose Pipewire socket if it exists
if [ -S "$XDG_RUNTIME_DIR/pipewire-0" ]; then
extra_args="$extra_args -v $XDG_RUNTIME_DIR/pipewire-0:/xdg_runtime/pipewire-0"
@ -141,11 +152,6 @@ podman run --rm "${podman_security_args[@]}" --name "$container_name" \
-e TZ="$(date +%Z)" \
`# SHM is needed by some browser engines (such as CEF used by Steam)`\
--shm-size=1G \
`# Scaling parameters` \
-e GDK_SCALE="$GDK_SCALE" \
-e QT_SCALE_FACTOR="$QT_SCALE_FACTOR" \
-e QT_SCREEN_SCALE_FACTORS="$QT_SCREEN_SCALE_FACTORS" \
-e QT_AUTO_SCREEN_SCALE_FACTOR="$QT_AUTO_SCREEN_SCALE_FACTOR" \
`# Use podman's init stub inside the container for better control` \
--init \
$extra_args "$image_name"