Fix LibreOffice Scaling Issues on Linux

I have been struggling with an irritating issue with LibreOffice in relation to how the suite of applications handle fractional scaling. The widgets in LibreOffice would have comically oversided UI elements (toolbars, icons) on some displays but only if that display was scaled at 100% or less.

LibreOffice comical scaling of widgets

For months, (on and off), I would search for a fix for this and the short term fix was to have Fractional scaling of anything greater than 100% on the displays. So, for some time, I would have 105% scaling on displays even when I didn’t want it scaled up. This worked and I was satisfied for quite a while, maybe over a year but when I purchased some new, larger, higher resolution, monitors, I was again annoyed by this and spent some time searching, once again for a solution to this scaling issue. I just don’t like using any of the other office applications on Linux as much as LibreOffice, truly, I tried… them all… even that one from Microsoft…

The Fix

I was reading through this bug report and the solution was about midway through and it is a simple fix. I should say that this is the fix for now as I know things are getting better with Wayland and although XWayland is a temporary fix, this should be considered a temporary fix too.

Setting the environment variable before running LibreOffice has made all the scaling troubles go away.

QT_QPA_PLATFORM=xcb

To use this with LibreOffice Calc, lets say for testing, this is how you would run it in the terminal:

QT_QPA_PLATFORM=xcb libreoffice --calc

Since this worked fantastically well, it was time to adjust all the menu entries on my system to enforce the “xcb” environment variable. On KDE Plasma, I opened up the KDE Menu Editor. The easiest way is to right-click on the Menu and select “Edit Applications”

A screenshot of a KDE Plasma application menu with options including 'Edit Applications...', 'Configure Application Menu...', and others.

In the KDE Menu Editor, filter down “libreoffice” and add QT_QPA_PLATFORM=xcb to the “Environment variables” box:

KDE Menu Editor interface displaying LibreOffice Calc settings, including environment variables and command-line arguments.

I added it to all the LibreOffice entries as I use just about everything in the LibreOffice suite of tools. Once that is done, whenever you launch LibreOffice, it will enforce the use of Xwayland which fixes all the scaling issues and as a bonus benefit, the lagging of scrolling through documents, spreadsheets and presentations is now completely gone. The LibreOffice experience is once again, top notch as it all scrolls as smooth as butter!

What QT_QPA_PLATFORM=xcb does is control the platform abstraction (QPA) backend that Qt applications use to render and interact with the system’s display server. Since I am using Wayland, designed for modern general purpose, desktop computing that is more secure and efficeint than X11 with better HiDPI support (in theory) and not all applications fully support it, there are some pains here and there.

XCB is the legacy X11 backend which is a lower-level interface to X11. It is more modern than Xlib but iss still part of the X11 ecosystem. By setting QT_QPA_PLATFORM=xcb, you are forcing LibreOffice to use the X11/XCB backend instead of Wayland, even though it is a Wayland session. KDE Plasma 6.3 supports this through XWayland, a compatibility layer that allows X11 applications to run on Wayland by providing an X11 server within the Wayland environment.

Why This Works

Wayland’s native HiDPI support is designed to handle fractional scaling better than X11, but it’s still maturing. In KDE Plasma 6.3, fractional scaling can lead to rendering inconsistencies, especially with applications that don’t fully support Wayland’s scaling model. LibreOffice, when using the Qt/KDE VCL plugin (SAL_USE_VCLPLUGIN=qt5), relies on Qt to render its UI. On Wayland, Qt’s scaling implementation might misinterpret the fractional scaling factor, leading to oversized UI elements monitors at 100%. This is likely due to a bug or mismatch between Qt’s Wayland backend and KDE’s scaling implementation.

When you set QT_QPA_PLATFORM=xcb, LibreOffice switches to the XCB backend, rendering through XWayland instead of Wayland directly. It applies the system scaling factor more consistently across applications, as X11 historically relies on the X server to manage scaling. KDE’s XWayland integration in Plasma 6.3 is mature, ensuring that HiDPI scaling is applied uniformly, fixing the oversized UI issue in LibreOffice.

Performance Boost

This is only a guess as to why there is a boost but Wayland’s rendering pipeline, while efficient for many use cases, can introduce lag in some applications with fractional scaling. This is often due to how Wayland handles buffer swaps and scaling transformations, especially on high-DPI displays. LibreOffice, being a complex application with lots of UI elements, might trigger excessive redraws or buffer copies when scaled fractionally on Wayland, leading to noticeable lag.

XWayland, despite being a compatibility layer, often provides smoother performance for some applications. X11’s rendering model is more predictable for fractional scaling, as it doesn’t involve Wayland’s compositor-specific optimizations (which can sometimes misfire).

By forcing LibreOffice to use XCB, you’re bypassing Wayland’s rendering pipeline, letting XWayland handle the display output which reduces the overhead of Wayland’s scaling and buffer management, eliminating the lag and smoothing out the user experience.

Final Thoughts

This was an annoying, lingering problem I have been having with LibreOffice and I finally got it figured out. So, now that it is working perfectly, I am back on the LibreOffice-is-the-best-office-suite bandwagon again! Truly, it is a great application suite but this Wayland transition was a bit troublesome.

Office toilings are once again perfect! My Linux desktop workflow is closer to perfection. Yes, this is an annoying problem and could be viewed as a strike against the Linux Desktop Experience but standing back, just a few steps, looking at the pain of Linux vs the pain of Windows or Mac and still, Linux is far less painful.

I am actually surprised that XWayland offers some efficiencies for LibreOffice. That was not something I was expecting but here we are and I am happy with this solution. I am not sure what the solution should be for users using Wayland. I think Fedora has it right by dumping X11 and removing that variable but I am still using X11 on some systems as the performance on some older machines are just better with X11 at this time.

Wayland is so close… so close… But that is the fun of Linux, understanding how your system works and tweaking it for better performance or your own unique situation. I realize that my situation is likely an edge case so for those three other people using displays as I am, here you are!

References

https://bugs.documentfoundation.org/show_bug.cgi?id=141578
https://www.libreoffice.org/
https://get.opensuse.org
https://kde.org/plasma-desktop/
https://wayland.freedesktop.org/


Discover more from CubicleNate.com

Subscribe to get the latest posts sent to your email.


Comments

26 responses to “Fix LibreOffice Scaling Issues on Linux”

  1. Cody Avatar

    you’re the man, on mine it was too small, this fixed it, thanks!

    1. I’m glad to know it was useful for you!

  2. Jens Avatar

    Thanks for the fix, and for the thorough explanation. I have two 100% DPI monitors on either side of a bigger 200% DPI monitor. This mixed DPI configuration triggers lots of fun bugs in many operating systems/distros. I’ve actually found KDE handles it extremely well. Bad news is, now I have to do the thing I’ve been putting off for several days, since I can see LibreOffice without a magnifier now.

    1. I am glad this worked for you! This fix also ended my quest in trying other office applications and I am back to LibreOffice. The others are fine but this just works better for me.

      Have fun doing that thing you don’t want to do!

  3. lainfluenciadelasnubes Avatar
    lainfluenciadelasnubes

    Thanks for the fix!

    1. You are very welcome. I am glad it worked for you!

  4. rezzor Avatar
    rezzor

    Thanks for the simple solution, it was so annoying!

    1. I’m glad it was helpful!

  5. Such a fast fix, and instantly brought my scaling back to normal. I can put off that optometrist visit a little longer.

    1. Fantastic! I’m glad it was useful!

  6. Illia Avatar

    Thanks a lot for this workaround! Because of it, this period of me trying the wayland might actually last longer! (Fractional scaling is the most important reason because laptop display hurts my eyes; second killer feature is not flashing with the contents of your desktop before the lock-after-wakeup).

    1. Wayland has been my display server now for about 2 years. It’s been working very well, especially since I was able to work this out.

  7. Paul Wiegers Avatar
    Paul Wiegers

    thanks a million! This works like a charm 🙂

    1. Glad to hear! It has made such a massive difference for me as well.

  8. nell Avatar

    Thanks! On NixOS with Wayland and two monitors (100% and 125%), both now show sharp text at the same size.

  9. Thank you!

  10. thank you very much! I had already tried this before without luck. Thankfully, this time I’ve found your post. In my case LibreOffce was shrinking on a 125% scaled up monitor, as if the scaling factor is programmed in the opposite direction or something!

    1. I’m glad this was useful! Thank you for letting me know.

  11. Leloinadrass Avatar
    Leloinadrass

    Well, thanks a lot !

    It really did the trick. I followed a Redditor’s link here, and you saved me.

    I’ll detail my experience a bit, just in case…

    I’ve just got the same problem on my dual screen setup, with a secondary screen for monitoring (24″ ; 1080p) and a main screen Ultra-Wide (37,5″ ; 3840 x 1600).
    On the secondary screen, no problem.
    But on the main screen… Lord ! Even with good eyes, how tiny that Libre Office interface was !

    Happily enough, starting with “QT_QPA_PLATFORM=xcb libreoffice –draw” did the trick.

    Then I just had to change my “.desktop” files so that the “exec=” included that very command and that was it.

    Ah, or course, if you change your .desktop located in “/usr/share/applications/” , you have to refresh your menu before it’s taken into account.

    On CachyOS with KDE Plasma, the command was : “update-desktop-database ~/.local/share/applications/” . Just saying, in case you see that comment in the same situation and don’t realize why it’s working in Konsole and not with the application shortcut in the App Menu.

    1. Fantastic news that it is working for you! Thanks for letting me know. It was something I struggled with for quite a long while but now having LibreOffice as smooth as butter has made my world a wonderful place, once again.

      1. Leloinadrass Avatar
        Leloinadrass

        Thanks again.

        By the way, I’m back to get back to command, because an update re-did the shortcuts with their default exec lines and I had to tinker them again.

  12. Thanks a lot, this fixed it for me

    1. Fantastic! Thanks for letting me know!

  13. Frank G. Avatar
    Frank G.

    You saved my day. This fix is a game changer. Thank you!

    1. Glad it was useful! Thank you for letting me know.

Leave a Reply

Discover more from CubicleNate.com

Subscribe now to keep reading and get access to the full archive.

Continue reading