The Theory:
In Puppy, clicking on a Rox file icon usually results in an appropriate default application automatically opening the file. The MIME-type of the file determines which default application should open. The mechanism is described at the ROX website http://roscidus.com/desktop/taxonomy/term/16 as follows:
File types and icons
Category:
* MIME types
* Theming
How does the filer decide what icon to show for a file, and which program to use to open it?
For each file, the filer starts by working out its MIME-Type, as follows:
* If the file's user.mime_type extended attribute it set, then that is its MIME type.
* If the file's name matches a pattern in one of the globs file (usually, /usr/share/mime/globs) then the line in that file gives the type.
* If the contents of the file match a pattern in one of the magic files (usually, /usr/share/mime/magic) then that gives the type.
[Disclaimer: If you do any of the following you must accept to do so at your own risk!]
The Method:
1. If you have a file with a MIME-type unknown or unhandled by Puppy Linux you can add the new type to the end of the file /usr/share/mime/globs
[NOTE: What I am suggesting requires that you ignore the warning given at the top of that file not to modify it manually. BarryK seems to have done likewise...].
2. /usr/share/mime/globs is a text file which can be opened and edited with any standard text editor (such as Geany or NicoEdit).
However, before modifying globs you should always check (using your editors search/find function) to make sure that it doesn't already contain an entry for the extension/mime-type you are interested in. If it does, you can jump to step 4.
3. For example, if you have a file whose extension is .tmd
you could add the following entry to the end of /usr/share/mime/globs for it:
Code: Select all
application/x-tmd:*.tmd
registered with the MIME-type authorities (http://www.iana.org/assignments/media-types/). i.e. It is a private/local type, not an IANA officially registered one.
Files of type .tmd are actually used by the SoftMaker Office wordprocessor program called TextMaker. For this example, I assume the Linux version of that program (for MS windows versions of programs that require "wine" to run under Linux, see the wine-related link at the end of this howto for some additional information required to execute the appropriate wine applications for the file type concerned).
!!! NOTE WELL that if you do add any new entry to the globs file, you should take care to make sure that your end the file with a single carriage return, or it won't work properly.
4. You now need to create an executable shell script in /usr/local/bin, which for this example I will call defaultRunTextMaker (though you can call it anything you like), for starting up the TextMaker program.
It should contain the following lines:
Code: Select all
#!/bin/sh
exec /path_to_where_the_program_is/TextMaker.exe "$@"
5. Finally, you need to tell ROX to open that default Run script should you click on a file of that mime type. To do that you create a short executable shell script in ~/Choices/MIME-types named, for this example, application_x-tmd, which should contain the lines:
Code: Select all
#!/bin/sh
exec defaultRunTextMaker "$1"
5b. EDIT: Having said the above, once you have modified the /usr/share/mime/globs file, you COULD alternatively not bother about the above step 5 code at all and just set a Run Action for the file type by right-clicking on the file icon and entering the appropriate shell command (e.g. path_to_TextMaker "$@"). That will automatically create an appropriate application_x-tmd shell script, but ROX stores that in ~/.config/rox.sourceforge.net/MIME-types rather than in ~/Choices/MIME-types. Either way should work I think. However, if you have, for example, an application_x-tmd shell script in both ~/.config/rox.sourceforge.net/MIME-types and in ~/Choices/MIME-types, then the one in ~/.config/rox.sourceforge.net/MIME-types takes precedence (i.e. ROX seems to look there first). The right-click Set Run Action mechanism thus provides a convenient means of quickly (permanently or temporarily) over-riding a previously set up default mime handler (in ~/Choices/MIME-types) for a given file type.
6. That is it!
Now any file with the extension .tmd should be recognised as having MIME type application/x-tmd. [Right clicking on the file icon and selecting Properties shows you the mime type the file is being recognised as].
The appropriate Linux TextMaker application should thus be automatically opened on clicking the .tmd file icon.
[Note, however, that you may need to close the ROX window and reopen it before clicking on the app icon after first doing all the above; I can't remember. I certainly did not need to reboot though].
For a more complicated example, involving two MS applications running over wine, see this post/thread here: http://www.murga-linux.com/puppy/viewto ... 429#363429
As forum member davids45 comments in the above "wine-user" related thread:
davids45 wrote: Creating the specific application_x now means I can use an icon for all files of the particular application without other file types also getting iconified incorrectly. The upper button option of the "Set Icon" right-click menu shows the new application type.