Enable HiDPI support only if the framebuffer size is detectable

This commit is contained in:
Igor Pecovnik
2025-05-29 06:45:12 +02:00
committed by Igor
parent a268b2dd69
commit b2fd69b34d

View File

@@ -687,16 +687,31 @@ if [[ -f /root/.not_logged_in_yet && -n $(tty) ]]; then
systemctl start systemd-networkd-wait-online systemctl start systemd-networkd-wait-online
fi fi
# enable hiDPI support # Enable HiDPI support only if the framebuffer size is detectable
if [[ "$(cut -d, -f1 < /sys/class/graphics/fb0/virtual_size 2> /dev/null)" -gt 1920 ]]; then FB_VIRTUAL_SIZE="/sys/class/graphics/fb0/virtual_size"
# lightdm HIDPI_THRESHOLD="1920"
[[ -f /etc/lightdm/slick-greeter.conf ]] && echo "enable-hidpi = on" >> /etc/lightdm/slick-greeter.conf if [[ -r "$FB_VIRTUAL_SIZE" ]]; then
# xfce fb_virtual_width=$(cut -d, -f1 < "$FB_VIRTUAL_SIZE" 2>/dev/null)
[[ -f /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml ]] && sed -i 's|<property name="WindowScalingFactor" type="int" value=".*|<property name="WindowScalingFactor" type="int" value="2">|g' /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml if [[ "$fb_virtual_width" =~ ^[0-9]+$ && "$fb_virtual_width" -gt "${HIDPI_THRESHOLD}" ]]; then
# Enable HiDPI in LightDM slick-greeter
if [[ -f /etc/lightdm/slick-greeter.conf ]]; then
if ! grep -q "^enable-hidpi *= *on" /etc/lightdm/slick-greeter.conf; then
echo "enable-hidpi = on" >> /etc/lightdm/slick-greeter.conf
fi
fi
# framebuffer console larger font # Set XFCE scaling factor in skeleton config
XFCE_XSETTINGS="/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml"
if [[ -f "$XFCE_XSETTINGS" ]]; then
sed -i 's|\(<property name="WindowScalingFactor" type="int" value="\)[^"]*\(">\)|\12\2|' "$XFCE_XSETTINGS"
fi
# Set a larger console font for framebuffer
if [[ -f /usr/share/consolefonts/Uni3-TerminusBold32x16.psf.gz ]]; then
setfont /usr/share/consolefonts/Uni3-TerminusBold32x16.psf.gz setfont /usr/share/consolefonts/Uni3-TerminusBold32x16.psf.gz
fi fi
fi
fi
clear clear