Thursday, November 02, 2006

OpenOffice icon fix for Solaris

One thing that has always bugged me when I install Solaris and add OpenOffice.org 2.x, is that the icons for OpenOffice.org never appear next to their menu entries in JDS. I know it is not life threatening, or stops the application for working. It just looks bad!

A quick and dirty fix to this is to change the "Icon" entry in the relevent .desktop files in /usr/share/applications. For a slightly quicker and cleaner fix I have written a small script which just adds symbolic links to the installed icon files. The script does this by adding the links directly to the OpenOffice.org desktop integration installed package. This ensures that the links are removed when the package is removed.

#!/bin/sh
# Usage: openoffice-icon-fix
#
# Currently OpenOffice.org for Solaris is delivered with the wrong filenames
# for the icons in the .desktop files. This means the icons will not show
# up in the JDS menus. To work around this, this script adds a link to the
# original file the Solaris package database, which in-turn creates a
# physical link in the filesystem (via installf -f)
#

PKGINST=openofficeorg-desktop-integratn
APPS="writer printeradmin math impress draw calc base"
PIXDIR=/usr/share/pixmaps
OLD=openoffice.org-2.0
NEW=openofficeorg-20

#
# Check to see if OpenOffice.org is installed.
#
/usr/bin/pkginfo | /usr/bin/grep ${PKGINST} >/dev/null || {
echo "${PKGINST} is not installed."
echo "Please install OpenOffice.org 2.x, before running this command"
exit 1
}

#
# Note: The trailing 's' on the end of the installf command is NOT a typo!
#
for i in ${APPS}
do
/usr/sbin/installf ${PKGINST} ${PIXDIR}/${NEW}-${i}.png=${OLD}-${i}.png s
done

/usr/sbin/installf -f openofficeorg-desktop-integratn

Good Hunting!