Development/GTK4

    From The Document Foundation Wiki

    GTK is one of several user interface toolkits that can be used with LibreOffice. While GTK4 is the latest stable version of GTK, GTK3 is still dominant in many Linux distributions. GTK4 interface for LibreOffice is still under heavy development, but it can be built and tested. Here are the instructions.

    Building LibreOffice with GTK4 Support

    In order to build LibreOffice with GTK4 support, first you should install GTK4 development libraries. On Fedora Workstation 36 this can be done with sudo dnf install gtk4-devel.

    If GTK4 is not available for your distribution, you should compile it from source. Appropriate build and install instructions are available for different operating systems:

    If you are using Linux and install GTK4 in /opt/gtk, then you set PKG_CONFIG_PATH and then build LibreOffice after adding --enable-gtk4 to autogen.input or directly as autogen parameters.

    export PKG_CONFIG_PATH=/opt/gtk/share/pkgconfig:/opt/gtk/lib/x86_64-linux-gnu/pkgconfig
    make

    Because GTK4 support is experimental, there may be some warnings that you should ignore in order to build, so you should add --disable-werror to autogen.input or directly as autogen parameters, in order to accept these warnings.

    Running LibreOffice with GTK4 Interface

    After you could be able to build LibreOffice with GTK4 interface, then you can run LibreOffice with GTK4 toolkit. In Linux, first you should add GTK libraries to the LD path:

    export LD_LIBRARY_PATH=/opt/gtk/lib/x86_64-linux-gnu
    SAL_USE_VCLPLUGIN=gtk4 ./instdir/program/soffice

    The GTK4 interface can be selected in an alternative way:

    ./instdir/program/soffice -env:SAL_USE_VCLPLUGIN=gtk4

    You can verify that you are actually running GTK4 interface by looking at Help ▸ About LibreOffice, "User Interface" section. There you should see: UI render: default; VCL: gtk4