For a course, I am using the Racket language, which bundles its own IDE (Dr Racket) with the install. I successfully installed it on my Ubuntu 22.04 machine.
However, the installer does not create a mimetype for .rkt
files (the default extension for Racket code files used by the IDE). I wanted my .rkt
files to open in the Racket IDE when I click on them, so I created a custom mimetype, called text/rkt
, which worked fine. The custom icon works and when I double click the files they open in the Racket IDE. On code files I've already created with code inside them, the custom mimetype seems to work correctly.
However, if I do touch test.rkt
for example to create a new file, this file gets assigned the text/plain
mimetype and when I double click it, it opens the text editor instead of the Racket IDE. This is not ideal, because I would like to be able to create empty files from the terminal and open them in the IDE (it's more convenient than doing Save As -> whatever every time in the IDE).
Is it possible to have my empty files with the *.rkt
extension be recognized as my custom mimetype, instead of as plain text?
Here's the code for my custom mime type in case I did something wrong:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/rkt">
<comment>Racket code file</comment>
<glob pattern="*.rkt"/>
</mime-type>
</mime-info>
I followed the Ubuntu documentation here which I can see was last edited in 2014, as well as a post here which is more recent but maybe something changed since then. I'm new to linux so maybe I don't know where to look to find the correct instructions.