Thursday, November 02, 2006

OpenOffice icon fix for Solaris

One thing that has always bugged me when I install Solaris and add 2.x, is that the icons for 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 desktop integration installed package. This ensures that the links are removed when the package is removed.

# Usage: openoffice-icon-fix
# Currently 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)

APPS="writer printeradmin math impress draw calc base"

# Check to see if is installed.
/usr/bin/pkginfo | /usr/bin/grep ${PKGINST} >/dev/null || {
echo "${PKGINST} is not installed."
echo "Please install 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}
/usr/sbin/installf ${PKGINST} ${PIXDIR}/${NEW}-${i}.png=${OLD}-${i}.png s

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

Good Hunting!