I have a file called
foo.txt. I want to associate my own program with the mime-type
.txt so that my program opens a terminal and shows the contents of
foo.txt as standard output. I would prefer Ruby, but BASH scripting will also be OK.
An working example: I can open an HTML file with
firefox. I want to open
txt files with my own executable the same way.
I can't figure out how can I actually get it working?
Example 2: I can open a
.txt file with Geany/Mousepad/Atom/Code etc.
Let's suppose I have made a tool just like mousepad. How should my program handle the
So far I have made a small GUI program with Ruby and made it executable and tried to open
foo.txt with my program (I used the Nemo file manager). I have captured arguments, and stdins in my Ruby program so it will show the Argument and STDINs if any. But my program doesn't even show up the window if I open a
.txt file with it!
How am I supposed to achieve the result?