Xfce Forum

Sub domains
 

You are not logged in.

#1 2010-11-06 09:58:00

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

[Solved] How to get Thunar to open a .doc with OpenOffice Writer

Thunar 1.0.2 (I'm running Debian Squeeze) refuses to see a .doc as a Microsoft Word application, instead seeing it as plain text. Posts on this problem on various forums suggest that it's not an easy bug to fix. Here's my workaround, which seems to work. I'd be grateful for feedback and other suggestions.

1. As root, comment out the line <glob pattern="*.doc"/> in /usr/share/mime/packages/kde.xml, as noted here: https://bbs.archlinux.org/viewtopic.php?id=60168
2. As root, create this XML file (mine's called 'wordms.xml') in /usr/share/mime/packages:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-example">
<comment>Microsoft Word document</comment>
<glob pattern="*.doc"/>
</mime-type>
</mime-info>

3. As root, run update-mime-database /usr/share/mime
4. Restart.
5. Open Thunar. A .doc will now be shown as 'Microsoft Word document' instead of 'plain text document'. Right-click on any .doc, go to Open With, choose OpenOffice Writer as the default application to open 'Microsoft Word document'.

Offline

#2 2010-11-06 10:43:00

ManOfSteel
Member
Registered: 2005-10-06
Posts: 104

Re: [Solved] How to get Thunar to open a .doc with OpenOffice Writer

Put a <some_name>.desktop file with a MimeType of application/msword in ~/.local/share/applications.

Offline

#3 2010-11-06 21:06:11

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: [Solved] How to get Thunar to open a .doc with OpenOffice Writer

Hi, ManOfSteel.

Have you tried creating that .desktop to see it works when Thunar sees a .doc as a plain text document? I ask because one of the posts on this problem

http://us.generation-nt.com/answer/bug- … 90831.html

says

"I see both Word documents (.doc) and Ogg Vorbis files (.ogg) misdetected as "plain text document" and "Ogg Theora video", respectively....[but] The .desktop files I have in /usr/share/applications for Open Office Writer and Audacious declare that they handle application/msword and application/ogg, but with default file associations (.local/share/applications/defaults.list, mimeinfo.cache, and all *-usercreated.desktop files deleted) Thunar only offers to open Word documents with Leafpad or Geany..."

so I didn't try it.

Offline

#4 2010-11-07 23:15:53

ManOfSteel
Member
Registered: 2005-10-06
Posts: 104

Re: [Solved] How to get Thunar to open a .doc with OpenOffice Writer

gnome_refugee wrote:

Have you tried creating that .desktop to see it works when Thunar sees a .doc as a plain text document?

What do you mean by that? What does Thunar display when you configure columns to display "MIME Type"? application/msword or text/plain?

Files in system directories are configured during the installation and should be left alone IMO. You can override the defaults inside your user directory.
The .local/share/applications/*.desktop files describe applications. defaults.list/mimeinfo.cache files are needed to *link* these .desktop files to specific MIME types. The following should work.

application/msword=doc.desktop

.local/share/applications/doc.desktop:

[Desktop Entry]
Type=Application
Name=<some name>
MimeType=application/msword
Exec=<some application> %f
NoDisplay=true
StartupNotify=true

Also make sure /usr/local/share/mime/globs (or /usr/share/mime/globs) is not missing the application/msword:*.doc line.

Offline

#5 2010-11-08 00:34:51

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: [Solved] How to get Thunar to open a .doc with OpenOffice Writer

Yes, that's right, Thunar shows a Microsoft Word .doc file as text/plain. This is the issue that I and others have been posting about on various forums. I don't know if it happens in a vanilla Gnome or Xfce installation because I always post-install certain KDE apps, which could be the source of the strange /usr/share/mime/packages/kde.xml file that says a .doc is plain text. And /usr/share/mime/globs lists *both*:

application/msword:*.doc
text/plain:*.doc

Many thanks for your suggestion of a fix at .local level, perhaps someone else with this .doc problem could try it and see what happens. I' don't have a problem with the system-level fix I suggested. For example, it's the way I get Thunar to recognise an .apr file as an ArcView project (GIS) for opening under Wine (with a suitable script). With the fix I suggested, Thunar of course follows my wordms.xml and gives 'application/x-example' as the MIME-type for a .doc.

Offline

#6 2010-11-08 00:47:06

ManOfSteel
Member
Registered: 2005-10-06
Posts: 104

Re: [Solved] How to get Thunar to open a .doc with OpenOffice Writer

gnome_refugee wrote:

And /usr/share/mime/globs lists *both*:

application/msword:*.doc
text/plain:*.doc

This doesn't look right. Maybe update-mime-database will fix it. And if doesn't, make sure the msword entry in the source (/usr/share/mime/packages/freedesktop.org.xml) database is valid.

Offline

#7 2010-11-08 01:20:42

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: [Solved] How to get Thunar to open a .doc with OpenOffice Writer

You bet it doesn't look right! The text/plain entry presumably comes from the strange kde.xml. No, a mime database update doesn't fix it. The freedesktop.org.xml entry for Word is the usual one and lists <glob pattern="*.doc"/>

From my fix, it seems that Thunar looks first at a 'dedicated' xml for its glob. Why it should choose text/plain when given a choice in /usr/share/mime/globs is an interesting question.

For more on this issue, please see
http://ubuntuforums.org/archive/index.p … 87866.html
https://bbs.archlinux.org/viewtopic.php?id=60168
http://us.generation-nt.com/answer/bug- … 90831.html
http://www.linuxquestions.org/questions … er-775406/
https://bbs.archlinux.org/viewtopic.php?id=76836
https://bbs.archlinux.org/viewtopic.php?pid=753866
https://bbs.archlinux.org/viewtopic.php?pid=550873

Offline

#8 2010-11-09 08:53:15

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: [Solved] How to get Thunar to open a .doc with OpenOffice Writer

I've been trying to get ManOfSteel's method to work, so far without any luck. One obstacle seems to be this: when I run update-mime-database on ~/.local/share/mime, I get the message:

"Note that '/home/[my name]/.local/share' is not in the search path set by the XDG_DATA_HOME and XDG_DATA_DIRS environment variables, so applications may not be able to find it until you set them. The directories currently searched are:

- /root/.local/share
- /usr/local/share/
- /usr/share/"

Maybe Thunar is also only looking in those places and not in ~/.local/share/applications?

Offline

#9 2010-11-10 07:09:11

gnome_refugee
Member
Registered: 2010-01-15
Posts: 169

Re: [Solved] How to get Thunar to open a .doc with OpenOffice Writer

I hope this is my last post on this topic!

In order to try various ways to get ManOfSteel's method to work (that is, get Thunar to see a .doc as a Word document using changes in .local files), I first deleted the new system-wide .xml which created a new mime-type (see my first post). I then ran update-mime-database on /usr/share/mime.

Guess what? Thunar now saw .doc as Word and opened it with the system-wide default, OpenOffice Writer. The *only* change from the default installation is the commenting-out in kde.xml (step 1 in my first post).

I had earlier tested doing this alone, because 'senjin' in this forum

https://bbs.archlinux.org/viewtopic.php?id=60168

said it had worked. However, it didn't work when I tried it, even with a restart. Now it does work. Do I understand what happened? No.

Offline

Board footer

Powered by FluxBB