How to add a global MIME type with icons in Rox-filer

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

How to add a global MIME type with icons in Rox-filer

#1 Post by ttuuxxx »

Hi this has been a bit of a mystery for a lot of users.
So lets get started :) say if you want to make sfs as a new global mime.

first go to /usr/share/mime/packages,

make a new xml called sfs.xml and copy the following

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/sfs">
         <comment xml:lang="en">SfS archive</comment>
         <glob pattern="*.sfs"/>
  </mime-type>
</mime-info>
now open a terminal and type
update-mime-database /usr/share/mime

that will rebuild the mime data base with your new sfs added

Now your going to need an action for it.
Right click on any sfs package you have and select "Set Run Action".
Now go to /usr/sbin/filemnt and drop that on the popup window that "Set Run Action" opened. Basically filemnt is what is used to mount sfs and iso images.
That will create a link in /root/.config/rox.sourceforge.net/MIME-types/application_sfs
now thanks to that link we know what to call the mime icon :) application_sfs
Next make a 48x48 icon called application_sfs.png and place it in /etc/xdg/rox.sourceforge.net/MIME-icons/
I use /etc/xdg/rox.sourceforge.net/MIME-icons/ instead of /usr/local/apps/ROX-Filer/ROX/MIME because rox for some odd reason doesn't find it there and also that way you know which new ones you've added.

And now your done.

Note: Different versions of rox have different naming formats, some use underscore and some use hyphens. like application_sfs.png or application-sfs.png

if you don't have the update-mime-database when you try to update, below is a pet.

hope that helps :)
ttuuxxx
Attachments
update-mime-database.pet
(18.16 KiB) Downloaded 750 times
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#2 Post by Flash »

Thanks, ttuxxx. Can I make a suggestion? It would be useful to explain what MIME is, and how it fits into Puppy's grand scheme. I must have seen it defined many times, but I never can remember what the heck MIME means. :)

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#3 Post by ttuuxxx »

Flash wrote:Thanks, ttuxxx. Can I make a suggestion? It would be useful to explain what MIME is, and how it fits into Puppy's grand scheme. I must have seen it defined many times, but I never can remember what the heck MIME means. :)
One definition is "A MIME (Multipurpose Internet Mail Extension) type is an Internet standard for identifying the type of object that is being transferred across the Internet. MIME types include many variants of text, audio, image, and video data."

But how this is how I explain it "a mime is a system wide chain that allows the execution of a particular file type extension that is recognised by a specific File manager."
say you introduced a new file format like sfs. It would need 3 thing to run applications.
1st you need to tell the system what extension is going to be used.(usr/share/mime)
2nd you need to tell it what program will be used to run it (/root/.config/rox.sourceforge.net/MIME-types)
3rd you need to set an icon so it looks pretty :) (/etc/xdg/rox.sourceforge.net/MIME-icons)
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#4 Post by ttuuxxx »

also mimes work as helpers, say if you have transmission p2p installed and you downloaded a torrent file,
first you would have to open transmission
then you would have click file and search for that torrent and finally open it to begin downloading.
BUT if you had the mime file type extension installed for .torrent
all you would have to do is download a torrent and click it, it will automatically open up transmission and begin loading your torrent, all with one single click.
better yet when you download a file with rox, it gives you an option to always open this file with an application, if you set it to/root/.config/rox.sourceforge.net/MIME-types/application_x-bittorrent it will automatically load up also with no clicking involved. plus you'll still have the option of a single click load the torrent file and launch the application that uses it.
plus puppy has some defaults that are handy. like defaulttexteditor
if you have a file format say for geany its better to use the default text editor to launch it than geany itself, just in case in the future you drop geany for medit then you won't have to change your mimes, they'll automatically be changed when you set your new defaulttexteditor.
your default launchers are located at /usr/local/bin/defaulttexteditor
ttuuxxx

below is a mime setup for transmission
Attachments
torrents-transmission.pet
(3.01 KiB) Downloaded 812 times
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

Gopher
Posts: 86
Joined: Sun 28 Oct 2007, 04:33

#5 Post by Gopher »

Thanks, this is exactly what I was looking for.

EDIT: Problem: it looks like something I did wiped out all the default MIME-types. I'm going to try to restore them manually, but will that make images show thumbnails again?

EDIT2: It did, after I redefined the image type and went into the preference screen and turned them off and on.
Last edited by Gopher on Sun 26 Dec 2010, 19:48, edited 2 times in total.

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#6 Post by DaveS »

Is this different from the 'set run action' dialogue?
Spup Frugal HD and USB
Root forever!

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#7 Post by ttuuxxx »

DaveS wrote:Is this different from the 'set run action' dialogue?
well this is the proper way to give and icon to a specific program type for rox-filer and make it recognize and specif extension type
also I would add to:
/etc/mailcap
open it and add the line:
application/x-bittorrent; /usr/bin/transmission-gtk "$@"
that will let firefox or seamonkey know that .torrent extension is for transmission and will give the option to download the torrent or just open it with your Mozilla based browser.
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
TheAsterisk!
Posts: 406
Joined: Tue 10 Feb 2009, 08:52

#8 Post by TheAsterisk! »

Finally, I can get all my old MHTML files recognized and opened in Opera from ROX! I was editing entirely the wrong files before I read your post, ttuuxxx.

Thanks!

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#9 Post by ttuuxxx »

TheAsterisk! wrote:Finally, I can get all my old MHTML files recognized and opened in Opera from ROX! I was editing entirely the wrong files before I read your post, ttuuxxx.

Thanks!
glad it helped :)
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#10 Post by big_bass »

Hey Jeff

here,s a little script I use
to auto generate the launch script

this will make it even easier
it wont over write any files so its safe to test and use


its a dragNdrop script

dragNdrop any file onto the script a launch script is created in
/tmp with the correct name

you just edit one value "defaultsomething " to the app you will use


here is an example with a gimp file
*.xcf

dragNdrop any *.xcf file



this gets auto made for you note the only line you edit in bold text
#!/bin/bash

# Joe Arose ..aka big_bass
# version 0
# image_x-xcf

# edit defaultsomething to the application name that will be used

#exec defaultsomething "$@"
exec gimp "$@"
later you copy it to
/root/Choices/MIME-types/




Joe

this script auto detects the filetype
-----------------------dragNdrop script below ---------------------------

Code: Select all

#!/bin/sh

# Joe Arose ..aka big_bass 11-1-09
# call this mime_type_info_maker
# drag N drop any file on this to see information about its file type
# and creates a mime type and places it in /tmp
# edit it to add the program name you want it to open with
# and place the file in /root/Choices/MIME-types/




FINFO=`file -b "$@" |cut  -f 2 -d ,`
MINFO=`rox -m "$@" | tr "/" "_"`
 echo "#!/bin/bash">/tmp/$MINFO
 
 echo "" >>/tmp/$MINFO
 echo "# Joe Arose ..aka big_bass">>/tmp/$MINFO
 echo "# $FINFO"  >>/tmp/$MINFO
 echo "# $MINFO" >>/tmp/$MINFO
 echo "" >>/tmp/$MINFO
 echo "# edit defaultsomething to the application name that will be used " >>/tmp/$MINFO
 echo "" >>/tmp/$MINFO
 echo 'exec defaultsomething "$@"'>>/tmp/$MINFO
 
 chmod a+x /tmp/$MINFO 

Last edited by big_bass on Wed 29 Dec 2010, 18:58, edited 1 time in total.

User avatar
john biles
Posts: 1458
Joined: Sun 17 Sep 2006, 14:05
Location: Australia
Contact:

#11 Post by john biles »

Hello ttuuxxx and big_bass,
How easy or hard would it be to create a wizard with GTKdialog that when ROX doesn't know what to do with an unknown MIME type a user can select which app they'd like to use and the wizard creates the correct MIME type puts it in the correct directory and updates your MIME list.

I remember there was another app that let you set what app your wanted to use as default for opening documents etc but this is different and could possibly be added to the rox right mouse click like "open with".

Food for Thought!

P.S maybe someones already created it a while ago and its been forgot who knows.
Legacy OS 2017 has been released.

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#12 Post by big_bass »

Hey John Biles

if you note the second script I wrote its a dragN drop script actually generates the unknown mime-type then auto generates the launcher script

which is very flexible so if you have some file you dont know how to make the correct mime it gets auto generated


now the tricky part is solved the other problem is what program do you want to open with there are a few apps here on the forum that do that part

I will try and combine the two things or write something easier
I had been meaning to do that for a long time but since I do it manually so many times while building packages I always get side tracked with something else to do :)

the correct way is when you build the package the mime types are included

Joe

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#13 Post by big_bass »

Hey john biles

Hey Jeff

I dont want to cluttter this post with a new tool so I opened a new thread
this is a gtkdialog thingy to edit mime types



http://www.murga-linux.com/puppy/viewtopic.php?t=63434
Joe

Post Reply