[Linux] .jl files are identified as "plain text documents"

On windows, I chose to open .jl files in VSCode and .txt files in notepad.

I have installed linux, and now when i change the default program for .jl files, it also changes for .txt files, as both are identified as “plain text documents”:

How do I make my system treat them differently?

name@name-ThinkPad-L390:~/GeekyStuff/Julia$ hostnamectl
 Static hostname: name-ThinkPad-L390
       Icon name: computer-laptop
         Chassis: laptop
      Machine ID: b0d275fb46fa48c6820be57edaa22cf5
         Boot ID: 3e03cae2bd9a4dc18ef5840574f56f0f
Operating System: Linux Mint 21                   
          Kernel: Linux 5.15.0-48-generic
    Architecture: x86-64
 Hardware Vendor: Lenovo
  Hardware Model: ThinkPad L390

You can create a file type for .jl files, and associate it with the editor of your choice. I don’t know what desktop Linux Mint uses, so the way to do it will depend on that. If it’s KDE Plasma, you can do it like this, using System Settings → Applications → File Associations.

I am on the cinnamon desktop. I am unable to locate a menu similar to the one you are showing. The closest I can find is “Preferred Applications”, which only offers a set of drop-down menus to change the default app for exsisting file-types. So I guess my question becomes: How to I add a new file type text/jl in Linux Mint Cinnamon?

I was finally able to fix this by following this guide. The conclusion was essentially (all steps must be done with admin priviliges):

  1. Create /usr/share/mime/packages/julia.xml (easiest way is to copy and rename one of the files in there).
  2. Change the file contents to
<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="text/julia">
      <comment>Julia source code</comment>
      <glob pattern="*.jl"/>
  1. Run sudo update-mime-database /usr/share/mime

Sidenote: rust files also had the line
<sub-class-of type="text/plain"/>, which seems very correct. However, I could not make the association work when I included that line.

Sidenote 2: I was unable to get an icon for the extension to work, but that would have been nice.

1 Like

There were already mime files present for c++, python, and rust, despite me never doing this manual process for any of those file types. This indicates to me that this process should be automated during installation of Julia.

To that end, I shamelessly ping @davidanthoff and @StefanKarpinski as two people with the power and know-how to make this happen during Julia installation.

Those files are not included in any system package but they are autogenerated from /usr/share/mime/packages/freedesktop.org.xml which is in the Debian/Ubuntu package shared-mime-info. That package already contains info in C++, Python and other programming languages, so it would be best to try and get that file updated by the maintainers rather than creating an output file for Julia. I think the right place to ask (or submit pull requests) is xdg / shared-mime-info · GitLab .

1 Like

It looks like julia is already in there! From data/freedesktop.org.xml.in · master · xdg / shared-mime-info · GitLab :

Also, it seems like I have shared-mime-info installed:

So it seems like this should have been a non-issue. I am not sure why I ended up having to add .jl manually…

1 Like

I also checked right now. It was added 5 months ago, so the update probably just has not had the time to arrive to your distro. As far as I understand updates have to go through Debian → Ubuntu → Mint, so it might take a while.

EDIT: and probably the first step is Xdg including it in their next release of the source package. Their latest release is 2.2, released one year ago, and does not include Julia yet.

1 Like

Are such processed just expected to take years? One of the main advantages of software is the ability to instantly roll out non-breaking updates, and it just seems like a very heavy process.

But things are on the way, which is great. I guess there is not much more to do than wait, and that the release cycles will move at their own pace.

There’s always Arch:


1 Like