From: Jonatan L. <th...@te...> - 2003-11-22 20:21:58
|
On Sat, 22 Nov 2003 10:53:57 +0000 Stephen Watson <st...@ke...> wrote: > text/x-uri is the generic solution. Basically a file ending in .uri > containg the uri to launch. What we need is an app which > > a) recognizes a file on the command line, reads it and launches the > uri therein. > b) recognizes a URI on the command line and launches that > c) when run without arguments opens an options window which can bind > the various uri schemes to apps or executables. > > Anybody want to take it? My quick hack (not exactly what you requested but halfway): Make this shellscript called rox_RunAction and put it somewhere in your PATH: #!/bin/sh if [ ! -n "$1" ]; then echo "Usage: rox_RunAction <mime-type> [arguments]" >&2 exit fi MimeType=$1 shift if [ ! -n "$CHOICESPATH" ]; then CHOICESPATH=${HOME}/Choices:/usr/local/share/Choices:/usr/share/Choices fi IFS=":" for DIR in $CHOICESPATH; do if [ -n "$DIR" ]; then App="$DIR/MIME-types/$MimeType" if [ -d $App -a -x $App/AppRun ]; then exec $App/AppRun "$@" elif [ -f $App -a -x $App ]; then exec $App "$@" fi fi done echo "No run action associated with type $1" >&2 ##################################################################### Now you can launch the application associated with mime-type "foobar" by running rox_RunAction foobar [arguments] I made a little .uri file named CupsAdmin.uri, which contains "html://localhost:631" and then selected the file and choose Set Run Action from the rox-filer menu. There I entered as shell command: rox_RunAction text_html $(cat "$@") worked perfectly! Of course, this association makes all uri's open with my html-browser. The next step will be to write a script that looks for protocol string in the URI and launch the correct application, then you just associate .uri files with that script. But your webbrowser will probably already have application-associations for different protocols, so if you have mailto:xxx in the .uri file your webbrowser will start your emailclient (if it's not using it's builtin), but you'll probably not want to start your webbrowser AND your emailclient... =) So the next thing is the OpenURI application. Toobad I have no experience or knowledge in writing GUI apps, so this will have to be done by someone else. (You'll want to set the associations by drag'n'drop, not editing configfiles by hand...) /Jonatan __ | __ ____ _ ____ |__/__ _____ _____||___ (_) ____ _____| | )(_____|( | )(_____||_____ | (______(_____| ==============|====================================== ____| http://www.kymatica.tk |