diff --git a/Dockerfile.ubuntu-helix b/Dockerfile.ubuntu-helix index 4ddeccc942..407aca8ce7 100644 --- a/Dockerfile.ubuntu-helix +++ b/Dockerfile.ubuntu-helix @@ -362,7 +362,40 @@ else rm onlyoffice-desktopeditors_amd64.deb apt-get clean rm -rf /var/lib/apt/lists/* - echo "=== OnlyOffice Desktop Editors installed ===" + + # OnlyOffice wrapper script for XWayland support + # OnlyOffice bundles Qt5 WITHOUT Wayland plugin - it requires X11 via XWayland. + # The wrapper sets DISPLAY, XAUTHORITY, and cursor theme environment variables. + echo "=== Creating OnlyOffice XWayland wrapper script ===" + cat > /usr/local/bin/onlyoffice-wrapper << 'WRAPPER_EOF' +#!/bin/bash +# OnlyOffice requires X11 via XWayland (Qt5 without Wayland plugin) +export DISPLAY=:0 + +# Find the Mutter XWayland auth file (name changes on each session) +XAUTH_FILE=$(ls /run/user/1000/.mutter-Xwaylandauth.* 2>/dev/null | tail -1) +if [ -n "$XAUTH_FILE" ]; then + export XAUTHORITY="$XAUTH_FILE" +fi + +# Cursor theme for X11 apps - use Helix-Invisible for client-side cursor rendering +export XCURSOR_THEME=Helix-Invisible +export XCURSOR_SIZE=48 + +# Required library path for bundled Qt5 +APP_PATH=/opt/onlyoffice/desktopeditors +export LD_LIBRARY_PATH=$APP_PATH${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} + +exec $APP_PATH/DesktopEditors "$@" +WRAPPER_EOF + chmod +x /usr/local/bin/onlyoffice-wrapper + + # Replace the original launcher script to use our wrapper + mv /usr/bin/onlyoffice-desktopeditors /usr/bin/onlyoffice-desktopeditors.orig + ln -sf /usr/local/bin/onlyoffice-wrapper /usr/bin/onlyoffice-desktopeditors + ln -sf /usr/local/bin/onlyoffice-wrapper /usr/bin/desktopeditors + + echo "=== OnlyOffice Desktop Editors installed with XWayland wrapper ===" fi _INSTALL_ONLYOFFICE diff --git a/desktop/ubuntu-config/startup-app.sh b/desktop/ubuntu-config/startup-app.sh index 31942ee84d..de64e17e99 100644 --- a/desktop/ubuntu-config/startup-app.sh +++ b/desktop/ubuntu-config/startup-app.sh @@ -226,8 +226,11 @@ gow_log "[start] Remapped Super→Ctrl and CapsLock→Ctrl via XKB (macOS keyboa if [ -n "\$HELIX_SCALE_FACTOR" ] && [ "\$HELIX_SCALE_FACTOR" -gt 1 ]; then gow_log "[start] Setting global scaling factor to \$HELIX_SCALE_FACTOR via GSettings..." gsettings set org.gnome.desktop.interface scaling-factor \$HELIX_SCALE_FACTOR - # Also enable fractional scaling feature (needed for the UI to show scale options) - gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']" + # Enable fractional scaling + xwayland-native-scaling + # xwayland-native-scaling makes XWayland report physical resolution (e.g., 3840x2160) + # instead of logical resolution (e.g., 1920x1080 at 2x scale). This fixes X11 apps + # like OnlyOffice that only render in the top-left quarter at 4K with scaling. + gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer', 'xwayland-native-scaling']" fi # Start Helix services via shared init scripts