Results 1 to 6 of 6

Thread: Open given file type with given application

  1. #1
    Join Date
    Feb 2010
    Location
    Baltimore, MD, USA
    Beans
    17
    Distro
    Ubuntu 12.04 Precise Pangolin

    Open given file type with given application

    Hello,

    I currently have Ubuntu 11.04 with Unity desktop.

    I have been working with triangulated surfaces, which are formatted text files with extension ".byu". I want them to open with a custom OpenGL application when I double click them. I can do this with no problem.

    The problem is that now all text files ".txt" will open in this custom application by default. Is there a way to open one type of text file with one application (gEdit), and a different type with a different application (my OpenGL application) based on their extension?

    Looking at "open with" in "properties" shows that I can only change the program for my ".byu" files AND other files of type "plain text document".


    Thanks for any help!

  2. #2
    Join Date
    Nov 2009
    Location
    Lithuania
    Beans
    Hidden!
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Open given file type with given application

    If all else fails... Ubuntu Tweak had detailed lists where you could assign file types to applications, might work.

    But that app also attracts some criticism from the community and is a rather clumsy choice for such a simple problem.

  3. #3
    Join Date
    Feb 2010
    Location
    Baltimore, MD, USA
    Beans
    17
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Open given file type with given application

    Thanks I will give that a try on my laptop. My work computer has Kubuntu installed. Do you know if there is something similar for Kubuntu?

  4. #4
    Join Date
    Nov 2009
    Location
    Lithuania
    Beans
    Hidden!
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Open given file type with given application

    I have a suspicion it might work on KDE as well but never really tried.

    If you use Kubuntu, however, there is a chance somebody wrote a separate tool for your environment. KDE is known for all sorts of gadgets, you might try asking in their forums.

    As I never used Kubuntu, I can't really help you further.

  5. #5
    Join Date
    Feb 2010
    Location
    Baltimore, MD, USA
    Beans
    17
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Open given file type with given application

    I got this working. I wanted to post the procedure in case anybody else is reading this.

    I ended up getting this working using File Types Editor from the Ubuntu Software Center.

    I created a new file type under the 3D models category. I filled in these four entries and left everything else blank.

    Name: model/byu

    Description: byu surface

    Related Types: Parent Types: text/plain

    Filename pattern: *.byu

    Then logged out and back in. I can now change the program to open "byu surface" file types without affecting plain text file types.

    Now, I also wanted to figure out exactly what "File Types Editor" was doing. I undid all the changes in File Types Editor, and through finding all the changes File Types Editor made to files on my disk, and skimming this website http://library.gnome.org/admin/syste...tabase.html.en , I found the following 3 steps give the same results.

    1. in ~/.local/share/mime/packages/Override.xml I write this text (this is all the text the file contains)

    <?xml version="1.0"?>
    <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"><mime-type type="model/byu"><glob pattern="*.byu"/><sub-class-of type="text/plain"/><comment>byu surface</comment><comment xml:lang="en_US">byu surface</comment></mime-type></mime-info>

    2. in ~/.local/share/mime/types I add the line "model/byu" in alphabetical order among the other entries

    3. run "update-mime-database ~/.local/share/mime" in the terminal (without the quotes)

    As far as I can tell, this gave exactly the same affect as using the File Types Editor. In fact, after doing this, there is an entry in the File Types Editor browser that is exactly the same as the one I created in the first method.

    I'm marking this as solved. I'll update if a similar procedure works in kubuntu when I get a chance to try it out.

  6. #6
    Join Date
    Feb 2010
    Location
    Baltimore, MD, USA
    Beans
    17
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Open given file type with given application

    Yes this last method I posted works in Kubuntu also.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •