Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Using xdg-open to open MS Word files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
sirlark
Guru
Guru


Joined: 25 Oct 2004
Posts: 306
Location: Limerick, Ireland

PostPosted: Mon Dec 30, 2013 8:28 am    Post subject: Using xdg-open to open MS Word files Reply with quote

Hi All,

I have MS Word 2007 installed in it's own wine prefix for work documents. Sadly, my place of employment is a firmly Microsoft shop, although I use Linux exclusively at home. It runs, it works, the only thing I can't figure out is how to integrate it with my desktop, specifically, when click on a doc file in my file manager or browser I would like it to open the doc in Ms Word. Depending on the application, presently doing either does nothing, or starts Word with a blank document. Ideally, I'd like to use xdg-open to do this, but I can't figure out how xdg-open

a) determines that it should use word/wine
b) passes the filename (which is presumably not working in the case of blank documents)

All help appreciated
Thanks
_________________
Adopt an unanswered post today
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Wed Jan 01, 2014 2:42 pm    Post subject: Re: Using xdg-open to open MS Word files Reply with quote

sirlark wrote:
Hi All,

I have MS Word 2007 installed in it's own wine prefix for work documents. Sadly, my place of employment is a firmly Microsoft shop, although I use Linux exclusively at home. It runs, it works, the only thing I can't figure out is how to integrate it with my desktop, specifically, when click on a doc file in my file manager or browser I would like it to open the doc in Ms Word. Depending on the application, presently doing either does nothing, or starts Word with a blank document. Ideally, I'd like to use xdg-open to do this, but I can't figure out how xdg-open

a) determines that it should use word/wine
b) passes the filename (which is presumably not working in the case of blank documents)

All help appreciated
Thanks


xdg-open users the mime database, specifically, you can "associate" a given mime type to a given .desktop file.

.desktop files are plain text files which contains info about programs that are "handlers" for some file type(s). In Gentoo, they live under /usr/share/applications/. You probably have some wine-*.desktop files in there if you have wine installed.

You can use the regular "%f" and "%u" placeholders to pass arguments to the programs represented by a given desktop file. Just taking a look in the .desktop files that are already there should be enlightening in this regard.

Besides having a handler, you need a way to associate it to a given file type, and that would be xdg-mime. For example, to associate the image/jpeg mime type to feh, you'd do:

Code:
xdg-mime default feh.desktop image/jpeg


You should also be able to use your DE mime mechanism, I can't guide you in that cause I don't use DE's, but it should be straightforward.

In the case that you are using a DE, you should also be able to just create a wrapper shell script to handle a given file type, for example, you could create something like this:

Code:
#!/bin/sh

WINE_PREFIX=$HOME/fooobarmoocow
wine progname.exe "$@"


Then chmod it +x, and associate it to the given file type. Any extra parameter will be passed to the program, so that should work. But since I am not into wine :lol: I haven't tested this :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum