Open LibreOffice apps Individually on MacOS: Difference between revisions
| (13 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
Next [[LibreOffice Knowledge Base]] | Next [[LibreOffice Knowledge Base]] | ||
</span></p><hr> | </span></p><hr> | ||
== Synopsis == | == Synopsis == | ||
LibreOffice on MacOs is a monolithic application, it is just one executable. There are no individual applications like on Linux or Windows, i.e. writer or scalc.<br> | LibreOffice on MacOs is a monolithic application, it is just one executable. There are no individual applications like on Linux or Windows, i.e. writer or scalc.<br> | ||
It is however possible to start LibreOffice with blank writer, calc or other LibreOffice document. | It is however possible to start LibreOffice with blank writer, calc or other LibreOffice document.<br> | ||
This is done with the use of the terminal application and the open command. | This is done with the use of the terminal application and the open command.<br> | ||
== Implementation == | == Implementation == | ||
This implementation is tested on macOS Catalina with LibreOffice 7.3 and using the zsh in terminal.<br> | |||
This implementation is | |||
=== Bare Bones === | === Bare Bones === | ||
Locate the LibreOffice application in finder.<br> | Locate the LibreOffice application in finder.<br> | ||
* Right Click and select |'''Show Package Content'''| | * Right Click and select | '''Show Package Content''' | | ||
* Then open |'''Content'''| and |'''MacOs'''| | * Then open | '''Content''' | and |'''MacOs''' | | ||
* Locate the soffice executable. | * Locate the soffice executable. | ||
Now open an terminal and type at the prompt |'''open -a '''| , observe the space after the a. | Now open an terminal and type at the prompt | '''open -a ''' | , observe the space after the a. | ||
Now drag the soffice icon from the finder window to the terminal window. You should get the path to the soffice executable.<br> | Now drag the soffice icon from the finder window to the terminal window. You should get the path to the soffice executable.<br> | ||
After that type | '''--new --args --writer''' | | After that type | '''--new --args --writer''' | | ||
| Line 60: | Line 56: | ||
This process can be repeated for the other applications.<br> | This process can be repeated for the other applications.<br> | ||
=== Making it Nicer === | |||
There is one particular behavior using the shell scripts<br> | |||
Although the terminal window closes after the script is completed, a Terminal Instance without a window exist after the LibreOffice application is closed!<br> | |||
To prevent that we can call the shell-script from an Apple-Script.<br> | |||
To do this for swriter open Script Editor.<br> | |||
Under '''File''' select '''new'''.<br> | |||
Then type or Copy / Past in the AppleScript pane: | |||
<pre>do shell script "~/swriter"</pre> | |||
Then press the run Key (The right pointing triangle), to see if there are no issues. | |||
Now save the script, but be aware. The Apple-Script needs to be save as an application. Preferably in the Application Folder. | |||
To do this select '''File Save'''.<br> | |||
In the dialog box under '''File Format:''' select '''[Application]'''<br> | |||
Now we have to copy and pass the icon for writer similar as we did above for the shell-script.<br> | |||
This can be done for the other applications in the same way. Before you start you might want to place the shell-scripts in a special folder. Dragging the shell-script icon from the finder to the AppleScript pane will copy the location in the apple script.<br> | |||
<br> | |||
<hr><p style="text align:left;"> | <hr><p style="text align:left;"> | ||
Return [[LibreOffice Knowledge Base]] | Return [[LibreOffice Knowledge Base]] | ||
Latest revision as of 16:18, 4 April 2022
Return LibreOffice Knowledge Base Next LibreOffice Knowledge Base
Synopsis
LibreOffice on MacOs is a monolithic application, it is just one executable. There are no individual applications like on Linux or Windows, i.e. writer or scalc.
It is however possible to start LibreOffice with blank writer, calc or other LibreOffice document.
This is done with the use of the terminal application and the open command.
Implementation
This implementation is tested on macOS Catalina with LibreOffice 7.3 and using the zsh in terminal.
Bare Bones
Locate the LibreOffice application in finder.
- Right Click and select | Show Package Content |
- Then open | Content | and |MacOs |
- Locate the soffice executable.
Now open an terminal and type at the prompt | open -a | , observe the space after the a.
Now drag the soffice icon from the finder window to the terminal window. You should get the path to the soffice executable.
After that type | --new --args --writer |
You should have something like this
open -a /Applications/LibreOffice.app/Contents/MacOS/soffice --new --args --writer
Now press enter and LibreOffice should open with a blank writer document.
The same can be done for: calc, draw, impress, math, global and web.
Just replace: -- writer with: --calc , --draw , --impress , --math , --global or --web .
Automate
The process can be automated using a shell script.
Open TextEditor and create a file swriter.
In the document type or copy past:
#!/bin/zsh open -a /Applications/LibreOffice.app/Contents/MacOS/soffice --new --args --writer
Open terminal and locate the swriter document. Make the document executable.
chmod +x swriter
You can now double click the swriter script in finder and Libreoffice will open with a blank writer document.
You might need to change | #!/bin/zsh | with | #!/bin/bash |, if you use bash instead of zsh.
Making it nice
The scripts icons can be replaced by the appropriate document icons.
Again locate the LibreOffice application in finder.
- Right Click and select | Show Package Content |
- Then open | Content | and | Resources |
- Locate the icons at the bottom of the window.
Now open for instance the | text.icns | file with preview.
Select the icon with [command]A and copy [command]C.
Now select the swriter script and [command]I, which gives the | Get Info | dialog.
Select the icon in the top left corner and past the icon copied before with [command]V. Now close the dialog and you have a nice icon.
This process can be repeated for the other applications.
Making it Nicer
There is one particular behavior using the shell scripts
Although the terminal window closes after the script is completed, a Terminal Instance without a window exist after the LibreOffice application is closed!
To prevent that we can call the shell-script from an Apple-Script.
To do this for swriter open Script Editor.
Under File select new.
Then type or Copy / Past in the AppleScript pane:
do shell script "~/swriter"
Then press the run Key (The right pointing triangle), to see if there are no issues.
Now save the script, but be aware. The Apple-Script needs to be save as an application. Preferably in the Application Folder.
To do this select File Save.
In the dialog box under File Format: select [Application]
Now we have to copy and pass the icon for writer similar as we did above for the shell-script.
This can be done for the other applications in the same way. Before you start you might want to place the shell-scripts in a special folder. Dragging the shell-script icon from the finder to the AppleScript pane will copy the location in the apple script.
Return LibreOffice Knowledge Base Next LibreOffice Knowledge Base