Hack 55. Reduce OpenOffice.org Startup Time
OpenOffice.org might seem like it is composed of separate productivity applications, such as a word processor and spreadsheet, but it actually is closer to being a single large application with different faces, one being a word processor, another a presentation manager, etc. That's why it takes so long to start the first OpenOffice.org application you decide to use. When you launch the first OpenOffice.org application, such as the word processor, you can run out to the nearest Starbucks for coffee and get back in time to see the opening splash screen finish loading. OK, that's a bit of an exaggeration, but sometimes it seems like it takes that long to start an OpenOffice.org application.
Yet, did you ever notice that if you leave the word processor running, you can open a spreadsheet application very quickly? That's because the behemoth engine behind the spreadsheet was already loaded into memory when you started the word processor.
The obvious solution to providing quick launches of OpenOffice.org is to preload the bulk of OpenOffice.org when you first start your window manager or desktop, before you launch your first application.
8.2.1. OOOQS, I Did It Again
A utility is available for KDE that does just that. It preloads much of OpenOffice.org, and then makes it possible for OpenOffice.org applications to start up almost immediately. The utility is called OpenOffice.org Quickstarter, or oooqs, and it was created by Christian Nitschkowski.
Quickstarter places an icon on the KDE panel. You right-click the icon, and from a menu, select what you want to do with OpenOffice.org, such as start a new text document or open an existing document. Depending on the speed of your computer, the application can appear on-screen almost immediately.
Many Linux distributions make the OpenOffice.org Quickstarter package readily available. You can get the Debian version over the Internet by logging in as root and issuing this command:
# apt-get install oooqs-kde
An RPM package is available for Fedora Core, SUSE, and other RPM-based distributions and goes under the name oooqs. You can retrieve this package from a number of sites, including http://www.rpmfind.net. Chances are that if you are running apt or yum, you can simply install it with either of these two commands:
# apt-get install oooqs # yum install oooqs
You can also download an RPM package of the latest version from http://developer.berlios.de/project/showfiles.php?group_id=366&release_id=1620. Finally, if you prefer to roll your own software, you can download the source code from http://kde-apps.org/content/show.php?content=10156 or from http://segfaultskde.berlios.de/index.php?content=oooqs.
Depending on how you or the package manager installed the program, either oooqs starts automatically and makes an icon appear in the KDE panel, or you might have to start it manually from the KDE menu the first time, after which it will start automatically from then on.
8.2.2. The OOQSTART-GNOME of Antiquity
A similar hack is available that preloads some of OpenOffice.org and then places an icon on your GNOME panel. It is called ooqstart-gnome, and it was written by Kumaran Santhanam. If it works at all for your Linux distribution, it works basically the same way oooqs works. You right-click the icon to launch any of the OpenOffice.org applications quickly, avoiding the typically long startup times.
The problem is that this utility has remained basically unchanged since 2002, which makes its usefulness and compatibility questionable. It seems to work well with Debian, even the unstable branch, which has the most up-to-date software (for Debian, anyway). Debian users can install the program with this command:
# apt-get install ooqstart-gnome
You can also find an RPM package of ooqstart-gnome at http://sourceforge.net/project/showfiles.php?group_id=47895. When I tried to install it in Fedora Core 2, the installer complained about unmet dependencies. I took the dangerous path and forced RPM to ignore package dependencies, using this command:
# rpm -i --nodeps ooqstart-gnome-0.8.3-1.i386.rpm
Surprisingly, it installed and worked fine. Then I tried the same thing with Fedora Core 3, the latest version. It didn't work at all. (What did work, mysteriously enough, was the KDE oooqs program. It appeared in the GNOME panel just as it would in the KDE panel.)
8.2.3. Alternative Methods to Quick-Start OpenOffice.org
It so happens that OpenOffice.org has a feature called quickstart, which works fine with any desktop or window manager. You activate it with this command:
$ ooffice -quickstart &
Once you issue this command, the bulk of the OpenOffice.org engine starts up invisibly in the background and remains theresort of (more about this in a moment). This makes it possible to start up Writer, Calc, or other OpenOffice.org applications very quickly. Of course, no pretty icon appears in the panel, so you have to use the regular KDE or GNOME menu icons, or another means of starting the word processor, spreadsheet, or other OpenOffice.org applications.
Now let's get back to the "sort of" part of the equation. First you start ooffice -quickstart manually, or have it launched automatically when you start your window manager or desktop [Hack #72] . Then you start up your OpenOffice.org productivity applications, do a little work, and then close the applications.
As soon as you close the last OpenOffice.org productivity application, the background quickstart process automatically exits, too. Unlike the methods employed by oooqs, quickstart interprets the closing of the last application as an indication that you're done with OpenOffice.org for the day. So, the next time you open the word processor, it's back to "trip to Starbucks" time again. (Well, not necessarily. If you ran the OpenOffice.org application recently, much of it might still be in memory, and it will start quickly.)
8.2.4. Respawn Trick to the Rescue
Here's where the respawn method I describe later in [Hack #73] comes in really handy. Log in as root, start up your favorite editor, and create a file called /usr/local/bin/oostay. Type the following text into the file:
#!/bin/bash # Restart ooffice -quickstart every time it exits instances=`ps ax | grep -e -quickstart | grep -v grep | wc -l` if [ $instances == 0 ]; then while true; do ooffice -quickstart ; done else exit 1 fi
Save your work and make the file executable with this command:
# chmod +x /usr/local/bin/oostay
Now execute oostay instead of ooffice -quickstart whenever you want OpenOffice.org's quickstart feature to keep running no matter how many times you open and close OpenOffice.org applications. Best of all, this trick is completely window manager- and desktop-agnostic. It doesn't work any better or worse for KDE, GNOME, WindowMaker, Fluxbox, or any other environment you like best. You can start up /usr/local/bin/oostay automatically when you start your window manager [Hack #72] .