WTF is this? >> Video of it in action 5mb
Provoked by a "conversation" on IRC, I set out to give implementing the nexuiz:// a shot. There are a few layers where this could be handled. The two most viable options were in the Window Manager (GNOME in my case) or the browser (Firefox in my case). Below are the two methods I've successfully implemented, though each has it's downfalls. All methods need the following bash script:
- Code: Select all
#!/bin/bash
/home/tyler/Games/Nexuiz/nexuiz-linux-x86_64-glx -basedir /home/tyler/Games/Nexuiz +connect $(echo $@ | awk -F "//" '{ print $2 }')
Path to my bin, -basedir (necessary) and +connect $ip_address, where $ip_address is a little awk statement I used to split off the front of the URL. $@ is all input passed and in my case, nexuiz://dojo.nexuizninjaz.com, that would be the entire passed value. Running it through the awk expression drops the "nexuiz://" bit.
So now I have a script that executes nexuiz with the proper base directory and connect to an ip / name server.
Save in in ~/Games/Nexuiz as "nexuiz_url.sh" or something and chmod +x it. (I saved mine in ~/nn_dev/nexuiz)
EASIEST - GNOME level:
Update for GNOME users, this was is actually easier... but unfortunately the bash script is still needed because Nexuiz doesn't accept "nexuiz://" in the +connect syntax. Otherwise, the bash script could be dropped. Anyway, this is done with 3 simple commands that add it to a GNOME like "registry"
- Code: Select all
gconftool-2 --set --type=string /desktop/gnome/url-handlers/nexuiz/command '/home/tyler/nn_dev/nexuiz/nexuiz_url.sh %s'
gconftool-2 --set --type=bool /desktop/gnome/url-handlers/nexuiz/enabled true
gconftool-2 --set --type=bool /desktop/gnome/url-handlers/nexuiz/need-terminal false
Obviously replace the path in /home/tyler/... with your information.
This does not work in Opera by default, you have to configure it similar to the firefox way below without as much trouble, edit your advanced preferences and link to the Nexuiz script.

MORE COMPLICATED - Firefox level (currently linux only but can be made to work with windows):
This method is not recommended, I keep this information as a story to share with you my trials and errors.
This firefox way is more round about... it's by no means a distributable solution and currently only for Linux users (though a batch script can be written to do the same thing) but I thought I'd share my work with everyone.
Following some advice I found on about how firefox handles URLs, I navigated to my about:config and added a new string "network.protocol-handler.app.nexuiz" with a path the Nexuiz with -basedir and +connect but soon realized that you cannot enter parameters here. So instead, I linked it to a bash script. "/home/tyler/nn_dev/nexuiz/nexuiz_url.sh" (the one seen above)

I click my test case and get the following dialog for running my script. I click it and nothing happens...

I click choose and navigate to the file and run it this way, SUCCESS!

Turns out the reason is because it gets added to ~/.mozilla/firefox/<profile>/mimeTypes.rdf
- Code: Select all
tyler@quadjutsu:~/.mozilla/firefox/b1ta3p8a.default$ grep "nexuiz_url.sh" *
mimeTypes.rdf: NC:prettyName="nexuiz_url.sh"
mimeTypes.rdf: NC:path="/home/tyler/nn_dev/nexuiz/nexuiz_url.sh" />
mimeTypes.rdf: <NC:possibleApplication RDF:resource="urn:handler:local:/home/tyler/nn_dev/nexuiz/nexuiz_url.sh"/>
mimeTypes.rdf: <RDF:Description RDF:about="urn:handler:local:/home/tyler/nn_dev/nexuiz/nexuiz_url.sh"
mimeTypes.rdf: NC:prettyName="nexuiz_url.sh"
mimeTypes.rdf: NC:path="/home/tyler/nn_dev/nexuiz/nexuiz_url.sh" />
prefs.js:user_pref("network.protocol-handler.app.nexuiz", "/home/tyler/nn_dev/nexuiz/nexuiz_url.sh");
So namely for this reason, that causes a round about install, this solution isn't ready for the mainstream. Of course other operating systems and browsers need to be supported as well but hey, this is a start.