Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 01 Sep 2014, 15:29
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to add a global MIME type with icons in Rox-filer
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [13 Posts]  
Author Message
ttuuxxx


Joined: 05 May 2007
Posts: 10747
Location: Ontario Canada,Sydney Australia

PostPosted: Sat 23 Jan 2010, 23:08    Post subject:  How to add a global MIME type with icons in Rox-filer  

Hi this has been a bit of a mystery for a lot of users.
So lets get started Smile 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:

<?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 Smile 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 Smile
ttuuxxx
update-mime-database.pet
Description 
pet

 Download 
Filename  update-mime-database.pet 
Filesize  18.16 KB 
Downloaded  488 Time(s) 

_________________
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games Smile

Back to top
View user's profile Send private message Visit poster's website 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11031
Location: Arizona USA

PostPosted: Sun 24 Jan 2010, 00:01    Post subject:  

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. Smile
Back to top
View user's profile Send private message 
ttuuxxx


Joined: 05 May 2007
Posts: 10747
Location: Ontario Canada,Sydney Australia

PostPosted: Sun 24 Jan 2010, 00:17    Post subject:  

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. Smile


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 Smile (/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 Smile

Back to top
View user's profile Send private message Visit poster's website 
ttuuxxx


Joined: 05 May 2007
Posts: 10747
Location: Ontario Canada,Sydney Australia

PostPosted: Sun 24 Jan 2010, 00:49    Post subject:  

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
torrents-transmission.pet
Description 
pet

 Download 
Filename  torrents-transmission.pet 
Filesize  3.01 KB 
Downloaded  488 Time(s) 

_________________
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games Smile

Back to top
View user's profile Send private message Visit poster's website 
Gopher

Joined: 28 Oct 2007
Posts: 86

PostPosted: Sun 26 Dec 2010, 14:19    Post subject:  

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, 15:48; edited 2 times in total
Back to top
View user's profile Send private message 
DaveS


Joined: 09 Oct 2008
Posts: 3726
Location: UK

PostPosted: Sun 26 Dec 2010, 15:11    Post subject:  

Is this different from the 'set run action' dialogue?
_________________
Spup Frugal HD and USB
Root forever!
Back to top
View user's profile Send private message 
ttuuxxx


Joined: 05 May 2007
Posts: 10747
Location: Ontario Canada,Sydney Australia

PostPosted: Sun 26 Dec 2010, 20:17    Post subject:  

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 Smile

Back to top
View user's profile Send private message Visit poster's website 
TheAsterisk!


Joined: 10 Feb 2009
Posts: 403
Location: SE Wisconsin, US

PostPosted: Mon 27 Dec 2010, 07:49    Post subject:  

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!
Back to top
View user's profile Send private message Visit poster's website 
ttuuxxx


Joined: 05 May 2007
Posts: 10747
Location: Ontario Canada,Sydney Australia

PostPosted: Mon 27 Dec 2010, 09:35    Post subject:  

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 Smile
ttuuxxx

_________________
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games Smile

Back to top
View user's profile Send private message Visit poster's website 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Mon 27 Dec 2010, 10:41    Post subject:  

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

Quote:

#!/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:
#!/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


_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though

Last edited by big_bass on Wed 29 Dec 2010, 14:58; edited 1 time in total
Back to top
View user's profile Send private message 
john biles


Joined: 17 Sep 2006
Posts: 1408
Location: Australia

PostPosted: Tue 28 Dec 2010, 22:20    Post subject:  

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 2.1 LTS Released! Install me on a new! EXT2 Partition with 500Mb of swap and I'll be happy. Razz
Legacy OS 4 Released! Install to newer legacy hardware / early EeePC's Very Happy
Back to top
View user's profile Send private message Visit poster's website 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Wed 29 Dec 2010, 01:38    Post subject:  

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 Smile

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

Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Wed 29 Dec 2010, 15:20    Post subject:  

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

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [13 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0925s ][ Queries: 12 (0.0083s) ][ GZIP on ]