LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "Open With..." File Type Association??? (https://www.linuxquestions.org/questions/linux-newbie-8/open-with-file-type-association-16515/)

Calum 03-18-2002 09:57 AM

"Open With..." File Type Association???
 
:newbie: question!

How would i associate a particular type of file (say .pdf or .mov) with a particular application, both in GNOME and in KDE (or is there some Config file i can edit? if so how?)?

In windows you can right click, select "Open With..." (you can also do this in KDE and GNOME) but in KDE and GNOME, there is no option to set the default application for that file type, like there is in windows. How do i set this please?

I have been reading the man pages and the red hat 7.0 (the version i have) getting started book , and cannot find any answer whatsoever!

Please help i am stumped!
thanks!

acid_kewpie 03-18-2002 10:19 AM

in gnomecc there is a file types section in the Document Handlers section.

Calum 03-18-2002 10:49 AM

where is that exactly?

somebody gave me a similar answer in another forum regarding KDE, but i have looked through the control centers of both GNOME and KDE and i can't find anything that resembles that option!

i know i am missing something obvious so maybe you could walk me step by step towards where i might find that particular thing there please?

and if anybody can explain in idiot language the same thing for KDE i would be most grateful!

ta a lot, folks!

isajera 03-19-2002 12:05 AM

in gnome, you open the control center - go to Document Handlers. under Document Handlers, there's a "File Types and Programs" section. there's a list of file extensions and associated actions that go with the file type. it's called mime types - you can edit them in that section.

Calum 03-19-2002 04:55 AM

oh yes, those mime types...

well, i have been in there a few times, but to no avail.
What i do is i open up the mime types thing, and select the file type i want to fiddle with, let's say it's "application/pdf", then i click the edit button, which takes me to a little thing where i can specify the read, write, and execute command string for that type of file. Okay, so far so good.
I note that i am given "emacs %f" as an example and reason that the " %f" must be the part of the string that gets substituted for the filename...
Right, so i have got all three boxes (read, write and execute) set to "xpdf %f", i have also tried just "xpdf". Of course i only want to read pdfs right now so the other two boxes are irrelevant.

Now, looks okay, i click okay to save the settings, then exit the control center.
doubleclick on a pdf file (it still doesn't come up with a pdf logo, bad sign) and i get asked which app i want to use. No good, i just specified it in the control center, so why's it still asking?
I reason that perhaps i have to log out of X for the changes to take effect (why i wouldn't know...) so i reboot to be on the safe side. Try doubleclicking the file again, no joy, i still get asked. I look in the control center to check the settings, and yes they still say "xpdf %f" just like before, so my settings *have* been saved, they just *don't work*!

Oh please, if you know the answer, please help! thanks to the two guys who answered me already btw! maybe my syntax is wrong...?

Also, what about KDE?
thanks...

Calum 03-19-2002 10:02 AM

I have done a bit of searching regarding mime types, it seems that a few people have had this problem, so i thought i'd post my results in case they are of any help to anybody else. Of course, if you are a person who can add more to this topic, please do, i will be happy to read what you say! myself, i am just guddling in the dark with this subject!

Firstly, here's this stuff that i found on mail.gnome.org
Quote:

> On Wed, 6 Dec 2000, Minson, John M. [Contractor] wrote:
>
> > All my attempts to change the mime association of a <something>.mpeg file
> > to 'gtv' fail.
> > The 'edit mime types' operation seems to work and shows 'gtv' in both the
> > open and view fields of the Mime Type Actions . When I open a 'mpeg' it
> > insists on running 'xanim' .
> > Is there some system wide default overriding my personnel settings ?
----------------------------------
Ralph Slooten wrote:
> I have the same problem with MTV. Each time I get an error that xamin can't
> be opened. Only when I right-mouse-click on the MPG and select view doe it
> work.
>
----------------------------------
> I don't know why the mime-types capplet insists on screwing this up.
> Take a look at the ~/.gnome/mime-info/user.keys file. If you see
> "[(null)]" anywhere then remove it. My user-keys file looks like:
>
> video/mpeg:
> open=mtvp -l %f
> view=mtvp -l %f
>
> If I use the control panel capplet to edit any mime types, what my
> user-keys file turns into is:
>
> video/mpeg:
> [(null)]open=mtvp -l %f
> [(null)]view=mtvp -l %f
>
> I don't have any idea what those [(null)]s are supposed to be for, but
> get rid of them and everything will work as you expect.
-------------------------------------
Håvard wrote:
The (null)s are the current locale, which Gmc insists on adding. I've yet
to get MIME-types to work without hand editing. :( Håvard
-------------------------------------
On Thu, 7 Dec 2000, Ralph Slooten wrote:
> Well, in the beginning when I edited it it didn't work, yet now it works
perfectly :-)
> Just strange that it didn't work for MPG! The rest worked fine, just not
> that one?!?!
>
I haven't tried it yet, but will tonight or tomorrow...
also, in KDE, from the KDE User Manual:
Quote:

5.1.1. Opening Files
KDE comes with a set of applications to view and edit many common kinds of files, and when you click a file containing, say, a document or image, Konqueror will start the appropriate application to display the file. If it doesn't know what application to start to open a file
you clicked, Konqueror will prompt you for the name of the application to run.

Konqueror uses MIME types to associate files with applications...

5.1.3. Setting File Properties
To change file properties, such as its name and permissions, right-click the icon and choose Properties from the menu.

KDE comes with a number of MIME types predefined, but you can add your own MIME types by choosing Settings-&gt;Configure-&gt;File Associations in a Konqueror window.
Again, haven't tried it yet, but thought i'd post it in case it was useful to somebody else.
If it doesn't work, i'll be back, screaming and shouting about it, no doubt...

Sixpax 03-19-2002 10:11 AM

This is pretty simple under KDE... just go to the control center, expand "File Browsing", and click on "File Associations".

Calum 03-20-2002 09:22 AM

i can't find it there, maybe it's moving around because it knows i;m looking for it...

I have had 3 or 4 people tell me how to do the file type thing in KDE, and no two have been the same, not only that, none work on my computer! i may be missing something because the one thing everybody says is that it's really easy!

Right, as far as the GNOME file types problem was concerned, i went and did all that stuff from my last post and *no change*!
well, it turns out that what i had to do was this:
right click on the GNOME/Sawfish desktop, and DEselect the "detect file types by their mime types rather than their extension" box, and it all works fine now!
Just thought i'd post this, as i say, for posterity...
:) :Pengy:

Nightfrost 09-30-2004 12:34 PM

...and in KDE?
 
Does anyone know how to do the above (i.e. turn off mime and enable recognition by extension) in KDE?
I can't find any solution to this seemingly easy problem anywhere. Thanks.

GinEric 12-07-2004 09:03 AM

Nobody does it better, but Katy does it backwards!

Changing file associations in KDE is broken, period.

If you attempt to use the properties of a file and edit the file type, you will not edit the file type for that singular file, but for all files with that type embedded in their properties!

This is a fubar.

Why? Because if you delete, for example, the file associations and types or change the name of the file type, kde will change all files associated as that type.

For example, should you wish to change a file that shows up as cpp {C++ Sourec File} meaning only to change that particular file, say newproggie.c.my kde will go and change every cpp files association on your system, and delete all of the associations, types, and description. So now all of your previous cpp files will show up as the new type and will no longer look pretty and open in kwrite with multicolors as they did before.

.h files, headers files, are similarly associated so you might think if kde fubar'ed cpp you can fix it quickly by making cpp similar to .h Not so.

kde conventions and developers need to add both a warning about changing the file associations, and, more importantly, make changing the file association work on only the particular file you want to change.

What all of this means is that you can't create a new file association. I hate to say that a little could be learned from Windows, but in this case it's true. If you create a file with Kwrite, it remains a Kwrite file no matter what you think you've changed it to. Adding a new extension and trying to edit the file association will only change all of the Kwrite file associations on your system.

Maybe kde needs a "create file type" set.
:Pengy:

GinEric 01-28-2005 04:43 PM

No answers yet because no one knows how KDE is broke, along with all programs that depend on file type associations in Linux.

KDE and KWrite, or any attempt to associate a file with an extension, takes the file descriptor and not the association and changes all files of that genre on the entire Linux Operating System.

Neither KDE nor KWrite, not any program should have permission to do this.

For example, when you do get to File Associations and select the tree for Text, then select a file type, such as one I've created called x-zone, based on plain text, create the endings and the application preference orderand then click on the icon button, if you dare change the icon, all files of the previous icon button, i.e., plain text, will be changed for every file on the system!

The file type is selected by the Description, and all files of that description will be changed!

This is totally backwards.

You only wanted to change the association so that a new ending would be affected, but that is not how KDE works. Rather, it works on the Description and changes all files of that Description!

It is really a bad attempt at file association on the developers' part, in that it associates the Description and the changes you apply, and not the file ending. It can royally screw up a file system.

Creating a new type is difficult as well because if you don't have a file to associate [created already], you can't associate it. So the Description comes from a file whose association you want to change, however, this causes KDE to change all files and apparently totally disregard the ending you have supplied.

The Howto on mime types, and creating one, leave out one crucial element: how to make KDE or KWrite install and use the new mime type and show it in the drop down menus.

All in all, it's developing too fast without paying attention to what is going on.

And widgets, like File Association, are consequently broke because of this approach.


All times are GMT -5. The time now is 05:20 AM.