Open New LibreOffice Documents Easily

After the most successful poll in Twitter’s history, I switched from Office to LibreOffice more than one year ago. There were many reasons to this shift, the main one being my non-willingness to pay a licence for software that I use less and less. For instance, Excel is only a UI to have a glance at data, since I analyse and produce graphics and summaries from them exclusively with R; and I use Word and PowerPoint only for compatibility with my colleagues, since I use LaTeX, Markdown, or R to produce text documents and presentations.

However, on macOS, LibreOffice is not a bundle of several apps (Writer, Calc, Impress), but a single application that contains the modules necessary for all these features. The application dynamically shows on the UI only the relevant modules (eg only the ones for a text document, for a spreadsheet, or for a presentation). I’m fine with that, except that there is no shortcut to open any given type of document. If you’re running a text-focused UI, the shortcut to open a new document opens a new text document. If you’re running a spreadsheet-focused UI, the same shortcut opens a new spreadsheet. Etc. But I found a solution.

There is a Terminal command to open any given type of LibreOffice document, regardless what the UI is currently set to. For instance, below is the command to open a new spreadsheet.

/Applications/LibreOffice.app/Contents/MacOS/soffice --calc &> /dev/null &

So calc is for a spreadsheet. If you want a text document, replace it by writer, or by impress if you want a presentation.

Now, obviously, we don’t want to fire a Terminal each time we want to open a LibreOffice document. To make things run smooth, the secret lies in an Alfred Workflow, as shown below.

An Alfred Workflow for LibreOffice. Each keyword is connected to a bash script (equivalent to a Terminal window) that contains the appropriate code.

This workflow consists in a set of keywords. Each keyword is connected to the related code as explained above, and it only takes a few letters to open new LibreOffice documents. For instance, for a new spreadsheet, type calc in Alfred’s main window, and hit Enter.

Et voilà!

One more thing. In the introduction I talked about compatibility. More than one year after I replaced Office apps by LibreOffice, no one has complained about my files not being exploitable with their Office-based environment. However, I did have a hard time opening someone else’s Office documents with the official Office Viewer apps, while LibreOffice did the job perfectly. I’m much comfortable with supporting such software!

Posted by Benjamin

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.