FET linux mime file and file icon

Started by Željko Vrabec, April 15, 2025, 05:41:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Željko Vrabec

Hi guys!

Is there chance for mime file for linux to be made? It would be nice to have "open with FET" option on right click and fet file with icon.

Thanks in advance!

Liviu Lalescu

Hello, Zeljko,

Nice to see you again! :)

Do you know that in recent FET versions you can run "fet path/file.fet" and it will work correctly?

I would like to implement your suggestions, but I never worked with "mime" and I am not sure what it is or what I should do. I can only offer linuxdeploy generated FET executables for GNU/Linux, or a "make install" option in the FET sources.

Željko Vrabec

#2
In the fet.desktop file add as the last line:

MimeType=application/vnd.fet.file;

Add option for file fet.xml with content:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
    <mime-type type="application/vnd.fet.file">
        <comment>FET timetabling file</comment>
        <sub-class-of type="application/xml"/>
        <glob pattern="*.fet"/>
        <icon name="fet"/>
    </mime-type>
</mime-info>

to be installed into /usr/share/mime/packages (owner: root:root, with permission: 644)

Of course I'm talking about fet sources which are to be compiled. fet.desktop file already in there

Liviu Lalescu

Thank you, Zeljko! I will consider this in the near future.

About the root owner, I am not sure I can do this. The tar.bz2 sources of FET should have only normal user, 644. When I copy the fet.xml file with "make install" in mime/packages, will it get automatically the owner = root? I am not sure I can change the owner at install time.

I will try a bit later to do these changes.

Željko Vrabec

#4
You are right! You make a file as normal user and make/make install sets ownership up. The same thing happens with fet.desktop file.

Liviu Lalescu

I will add it for the next version. I will work on adding it on my hard disk soon.

Unfortunately, I am not sure the two GNU/Linux executables I provide will contain this. Maybe only "make install" will work.

Liviu Lalescu

Zeljko, I have one more question: where do you suggest to put the file "fet.xml" in the FET sources archive?

Željko Vrabec

I think it should be ok to put it in root directory next to fet.desktop. Btw. how did you decide to put fet.desktop in root directory?

Liviu Lalescu

I don't remember, maybe the person(s) who suggested the fet.desktop contents suggested this. Do you have other suggestion for the location of fet.desktop and fet.xml?

Željko Vrabec

If I had an idea how make install handles fet.desktop I would make some suggestion, but I have no clue. Maybe someone else on the forum has more experience with project structuring. If so, I would be grateful for some help. 

Liviu Lalescu

#10
I can put fet.desktop and fet.xml wherever I like in the FET sources archive, and just modify a bit the fet.pro file. So, if you think of a better place for these two files, please let me know.

Liviu Lalescu

I just made your suggested changes, there is a new snapshot: https://lalescu.ro/liviu/Backup-fet/ . Could you please try? I tried "make install" on my computer, but it didn't work, even if fet.xml was copied where needed.

Volker Dirr

I didn't tried it yet. chat-gpt tells me:

Of course! Here's how you can make .fet files automatically open with your Linux program when double-clicked — using the MIME system.
🔧 Step 1: Define a custom MIME type for .fet

Create a new file at ~/.local/share/mime/packages/fet.xml with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/x-fet">
    <comment>FET File</comment>
    <glob pattern="*.fet"/>
  </mime-type>
</mime-info>

Then update the MIME database:

update-mime-database ~/.local/share/mime

🧷 Step 2: Create a .desktop file for your program

Make a file like ~/.local/share/applications/myfetprogram.desktop:

[Desktop Entry]
Name=My FET Program
Exec=/full/path/to/your/program %f
Type=Application
MimeType=application/x-fet
Categories=Utility;
Terminal=false

    Replace /full/path/to/your/program with the actual path to your executable.

    %f passes the selected file as an argument.

🔗 Step 3: Register your program for .fet files

Run this command:

xdg-mime default myfetprogram.desktop application/x-fet

This tells the system to use your program as the default for .fet files.
✅ Test it

    Make sure your .fet file is associated correctly (you can right-click → "Open With" in your file manager).

    Double-click a .fet file.

    Your app should launch and receive the file as an argument.

Let me know if you'd like help writing the .desktop file based on your program or if you want this to work system-wide for all users.

Liviu Lalescu

So, welcome ChatGPT :) This is the first time I actually see its power.

Should we edit fet.desktop, instead of "Exec=fet" put "Exec=fet %f"?

Volker Dirr

chat-gpt tells me:

Yes — exactly right! 👍

If you're editing the fet.desktop file (either system-wide or locally), and you want it to open a file that's passed in (like when double-clicking a .fet file), then you should absolutely use %f in the Exec line.
✅ Correct:

Exec=fet %f

Why?

    %f tells the system to pass a single filename (the one the user double-clicked) to your program.

    Without it (Exec=fet), your program runs — but won't receive the filename, so it won't know what file to open.