The FileTypes preferences application available under Haiku might be a bit disturbing to understand the first time.
If you don't know what attributes are under Haiku and how they are used for files, then this article might be of interest.
How is determined the type of a file under Haiku ? Which application is supposed to open that kind of file ?
Can I change the default application for a file type ?
The Haiku website gives a lot of information on that topic, so I will try to summarize -from a user's point of view- how FileTypes can be used.
Suppose you have just created a new text file named "sample" as below in the Terminal :
echo "sample file" >sample
file ./sample
The file is detected as an ASCII file by default here.
But if we look at the attributes attached to this file, there's nothing for the moment:
listattr ./sample
In that situation, the text file was not created by any application (like StyleEdit) and never opened in the tracker or in any application.
So it doesn't have any attribute yet to specify its type for instance.
Now suppose, you have just edited another text file named "other" with StyledEdit:
Save the file and check its attributes.
Type in a Terminal :
listattr ./other
As you can see, many attributes were attached to that file, specially the MIME String "BEOS:TYPE".
And if we check what is the type :
catattr BEOS:TYPE ./other
Yes !
The MIME type is identified as "text/plain".
Please note the "file" command has nothing to do with MIME type and has its own way of determining the file type (ASCII text) :
Now, let's take the first "sample" file, which didn't have any attribute yet, and apply the "mimeset" command on it :
mimeset ./sample
listattr ./sample
The "mimeset" command ask to attach the MIME attribute to the file. It's now identified as a "text/plain" :
Great, now let's check the FileTypes preferences.
In the Tracker, double click on the "sample" file :
It will be opened by the default editor : StyledEdit.
Now, in the Tracker, right click on the "sample" file, and select "Open with" :
From that point, you have 3 possibilities to open the file :
The last possibility with "open with FileTypes" will memorize for that file which preferred application will be used. Let's select our beloved "Pe" editor :
Then close the window to confirm your choice. As you can see the icon has changed :
Double click on the "sample" file again :
Tada !
The file is now using "Pe" as the preferred application :) Which is confirmed by the file attributes :
Now suppose you don't care about "StyledEdit" and you would like to use "Pe" instead for every text file !
Open the FileTypes application and select "text>Text file" :
As you can see, we can change the "preferred application", every time a "text file" is opened. Select "Pe" :
Which is confirmed by the below :
Close the window to confirm. Now let's open the "other" file by double clicking it :
Yes, "Pe" is now the default application for all "text file" in our system !
If you look at the file information : there's no indication about "Pe", but only on "Default application" to use :
And compared to the previous file, you don't have any attribute for a "preferred application" :
Great !
You should now have enough knowledge to decide how to change the application to use for a file :
I hope you find this article useful :)
This article was made 100% under Haiku with Falkon and Flameshot tools.