HOWTO: Thumbnails for OpenOffice.org 2 files
This also works for OOo1 files created or altered with OOo2. Beacuse OOo2 saves thumbnail of document into created file all what is needed is to extract the image a save it with right name :)
So first create file named ooo2-thumbnailer in /usr/bin
Code:
sudo gedit /usr/bin/ooo2-thumbnailer
and put in it following code
Code:
#!/usr/bin/python
# released into the public domain http://creativecommons.org/licenses/publicdomain
import zipfile
import sys
import gnomevfs
inURL=gnomevfs.get_local_path_from_uri(sys.argv[1])
outURL=sys.argv[2]
zip=zipfile.ZipFile(inURL,mode="r")
picture=zip.read("Thumbnails/thumbnail.png")
thumbnail=open(outURL,"w")
thumbnail.write(picture)
thumbnail.write("/n")
zip.close()
thumbnail.close()
and save the file.
Now we need to make it executable
Code:
sudo chmod +x /usr/bin/ooo2-thumbnailer
The next step is to tell Gnome how to use this thumbnailer. So create file ooo2.schemas in /usr/share/gconf/schemas
Code:
sudo gedit /usr/share/gconf/schemas/ooo2.schemas
and paste in it following code
Code:
<gconfschemafile>
<schemalist>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/enable</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/enable</applyto>
<owner>ooo2-thumb</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/command</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/command</applyto>
<owner>ooo2-thumb</owner>
<type>string</type>
<default>/usr/bin/ooo2-thumbnailer %u %o</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/enable</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/enable</applyto>
<owner>ooo2-thumb</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/command</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/command</applyto>
<owner>ooo2-thumb</owner>
<type>string</type>
<default>/usr/bin/ooo2-thumbnailer %u %o</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/enable</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/enable</applyto>
<owner>ooo2-thumb</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/command</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/command</applyto>
<owner>ooo2-thumb</owner>
<type>string</type>
<default>/usr/bin/ooo2-thumbnailer %u %o</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/enable</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/enable</applyto>
<owner>ooo2-thumb</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/command</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/command</applyto>
<owner>ooo2-thumb</owner>
<type>string</type>
<default>/usr/bin/ooo2-thumbnailer %u %o</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/enable</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/enable</applyto>
<owner>ooo2-thumb</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/command</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/command</applyto>
<owner>ooo2-thumb</owner>
<type>string</type>
<default>/usr/bin/ooo2-thumbnailer %u %o</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/enable</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/enable</applyto>
<owner>ooo2-thumb</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/command</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/command</applyto>
<owner>ooo2-thumb</owner>
<type>string</type>
<default>/usr/bin/ooo2-thumbnailer %u %o</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/enable</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/enable</applyto>
<owner>ooo2-thumb</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/command</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/command</applyto>
<owner>ooo2-thumb</owner>
<type>string</type>
<default>/usr/bin/ooo2-thumbnailer %u %o</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/enable</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/enable</applyto>
<owner>ooo2-thumb</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/command</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/command</applyto>
<owner>ooo2-thumb</owner>
<type>string</type>
<default>/usr/bin/ooo2-thumbnailer %u %o</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/enable</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/enable</applyto>
<owner>ooo2-thumb</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/command</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/command</applyto>
<owner>ooo2-thumb</owner>
<type>string</type>
<default>/usr/bin/ooo2-thumbnailer %u %o</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/enable</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/enable</applyto>
<owner>ooo2-thumb</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/command</key>
<applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/command</applyto>
<owner>ooo2-thumb</owner>
<type>string</type>
<default>/usr/bin/ooo2-thumbnailer %u %o</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
</schemalist>
</gconfschemafile>
and save it.
Now there are two ways to start gnome to use this thumbnailer
1) reboot
2) tell gnome to read this file:
Code:
gconftool-2 --install-schema-file /usr/share/gconf/schemas/ooo2.schemas
and restart nautilus
Code:
killall -9 nautilus
Re: HOWTO: Thumbnails for OpenOffice.org 2 files
Awesome howto, works perfectly! Anyone know if there's a quick/easy way to add a small icon or watermark over the thumbnail?
Re: HOWTO: Thumbnails for OpenOffice.org 2 files
Could someone provide a screenshot to show the finished product?
1 Attachment(s)
Re: HOWTO: Thumbnails for OpenOffice.org 2 files
Quote:
Originally Posted by OttoDestruct
Could someone provide a screenshot to show the finished product?
Here's a shot of my homework, two Writer files: one with images, and the other one with formulas.
If you decide to try out the thumbnails and don't like the results afterwards, you can roll back by deleting the two files:
Code:
sudo rm /usr/bin/ooo2-thumbnailer
sudo rm /usr/share/gconf/schemas/ooo2.schemas
And then restart Gnome (or nautilus, following minio's instructions).
Btw, thank you minio for the how-to :KS. The only downside I notice is that Ooo2 generates thumbnails with transparent backgrounds, so they don't look that good if you have set a background in nautilus.
Re: HOWTO: Thumbnails for OpenOffice.org 2 files
Re: HOWTO: Thumbnails for OpenOffice.org 2 files
I have followed the instructions perfectly, and I still can't get this to work. Every file is in the right place with the right owner and permissions. Does anyone have a hint?
Re: HOWTO: Thumbnails for OpenOffice.org 2 files
One of following steps should help
1) open gconf-editor and go to desktop->gnome->thumbnailers check if there ar e folders like "application@vnd.oasis.opendocument.graphics","app lication@vnd.sun.xml.impress" and similar. then check if key "command" in these folders contains correct path to thumbnailer (it should be /usr/bin/ooo2-thumbnailer %u %o) and if is enable checked.
2)try to delete entire ~/.thumbnails/fail directory and restart nautilus
3)check if those files you want to be thumbnailed were created with OOo2.
4)open one file with file-roller and look if there is Thumbnails directory some older betas of OOo2 used Thumbnail directory instead
Re: HOWTO: Thumbnails for OpenOffice.org 2 files
found the mistake. I executed this command:
Code:
gconftool-2 --install-schema-file /usr/share/gconf/schemas/ooo2.schemas
as root, not my usual user.
Re: HOWTO: Thumbnails for OpenOffice.org 2 files
SCHWEET! Works great - any chance this can be incorporated into dapper with an option to turn it off sumwhere? Its definatly an improvement and I can't see how a load of open office file logos are any better in any way except maybe that they tell you what file format it is in. Maybe if you could get a little overlay on each if it is possible (I doubt its easy if I understand how you are doing it correctly)
Brilliant anyway...
Re: HOWTO: Thumbnails for OpenOffice.org 2 files
Nice one!
I am very picky, but try this:
Using the GNOME Templates system in Nautilus, put an empty OpenOffice document (a template) in the /home/user/Templates folder, right-click on your desktop and look inside your "Create Document" menu. The icon for the document will now reflect the empty document, resulting in the icon of a "blank sheet".
:)
I suppose it can be fixed in some way.