LibreOffice
This document will explain how to install and configure LibreOffice on Alpine Linux. LibreOffice is an open-source office suite.
Background
LibreOffice is a more advanced and feature-rich fork of Apache OpenOffice. OpenOffice, in turn, was developed from StarOffice, which was a proprietary office suite originally developed from the mid 1980s by German company Star Division. Sun Microsystems purchased Star Division and eventually released the software under an open source license as OpenOffice. After Oracle acquired Sun Microsystems, most of the OpenOffice developers left and created the LibreOffice fork. Today, LibreOffice is an advanced office suite that has good compatibility with Microsoft Office documents and isn’t (yet) plagued by annoying “AI” features.
Installation
To install LibreOffice on Alpine Linux, run:
doas apk add libreoffice libreoffice-qt6
Launch Script
LibreOffice currently doesn’t have complete Wayland support, which leads to some interesting bugs when running under Wayland. It is possible to work around these bugs by forcing LibreOffice to run under the XWayland X11 compatibility layer. First, we need to create a directory in which to put commands that can override system commands. Create this directory on the command line, and start editing a wrapper for the libreoffice command like so:
cd
mkdir -p .local/bin
cd .local/bin
nvim libreoffice
Put the following content into your newly created wrapper file:
#!/bin/sh
export WAYLAND_DISPLAY=
export SAL_USE_VCPLUGIN=kf6
exec /usr/bin/libreoffice "$@"
Double-check that you have the above script correct. Save and exit Neovim.
Make your newly created wrapper script executable by running:
chmod +x libreoffice
Now we need to add our newly created .local/bin directory to our PATH. We need to be sure that this directory comes before /usr/bin in our PATH, so that anything that runs the libreoffice command runs our wrapper script. We can set our path as soon as we log into the system by editing our .zshrc file like so:
cd
nvim .zshrc
At the bottom of the file, add the following line:
export PATH="${HOME}/.local/bin:${PATH}"
This line puts any commands that we put into our .local/bin directory ahead of the default directories, so that we can override systemwide commands with our own versions as needed.
Save the file, then exit Neovim. To make this change effective in KDE Plasma, first log out of Plasma (start menu, then Leave, then Log out). Run the exit command to log out of the console. Log back in as your regular user, then run startkde to restart KDE Plasma.
Configuring LibreOffice
You can now start LibreOffice by launching any of its components from the Office category on your start menu. For this first run, choose LibreOffice Writer to start the word processor application. When it starts for the first time, you can choose whether or not to keep startup tips enabled. To access the main configuration settings, go to Tools…Options from the menu bar at the top.
Options categories are on the left side of the Options window, while the settings are on the right side. Some useful things to consider changing include:
- LibreOffice: User Data
- Entering your name and initials can be useful for document change tracking.
- Load/Save: General
- UNcheck “Warn when not saving in ODF or default format” to turn off an annoying message when saving Word/Excel/PowerPoint files.
- Language Settings: Languages
- Under Default Languages for Documents, be sure “Western” is set to English (USA).
Click OK to close the Options dialog when finished changing settings.
Zoom Level
I prefer to work with the page zoomed to the window width. LibreOffice will remember your zoom setting once you set it the first time. To use the window width, go to View, then Zoom, and select Page Width. If you prefer a different zoom level, you can choose one of the other options.
Ribbon
Since I originally learned to use a word processor back in the days when everyone used menu options (on WordPerfect, Microsoft Works, and older versions of Word), I actually prefer the default menu-based interface. However, you can make LibreOffice use a ribbon-style interface similar to newer versions of Microsoft Office. Go to View…User Interface to bring up a dialog that allows the interface to be changed. There are multiple available settings here, but the Standard Toolbar is the default. To use a ribbon-style interface, choose the Tabbed option. You can apply your choice to all LibreOffice components or just to individual components (Writer, in our case).
To change back to the menu-based interface from the ribbon-style interface, click the hamburger menu in the upper right part of the window, then click User Interface. Choose the Standard Toolbar, then hit one of the apply buttons.