Thursday, October 22, 2009

The External Grid Selector script for Second Life/Snowglobe and Emerald viewers

I had promised to post this once I polished it up, but I think it's usable enough in it's present form to be considered as a 0.1 release. So here's the code:

#!/usr/bin/env bash

#Second Life Grid Selector and Client Launcher
#A simple grid manager for the official Second Life viewer,Emerald and Snowglobe
#(C) 2009 Jose A. Agudo aka Second Life resident Antonius Misfit
#Licensed under the terms of the GNU General Public License v3 or at your option any later version

viewer=$(zenity --file-selection --title="Client viewer to run:" 2>&1)

#retrieve grid "database" which is simply a bash array variable sourced from a file
if [ -e $HOME/.grids.db ];then
 source $HOME/.grids.db
 cat > $HOME/.grids.db << EOF
#Feel free to add grids here
grids=("Second_Life" "Localhost" "3rdrock" "OSGrid" "NixTech_Forge"
 source $HOME/.grids.db

action=$(zenity --list --title="SL Grid Launcher" --text="Choose a grid:" --column="Grids" --column="Login URI" --print-column="2" ${grids[@]:0} "Exit" "Exit")
case $action in
 Exit) exit;;
 *) $viewer --loginuri=$action;;


There's definitely room for improvement, such as the possibility of using an online database of grids and choosing from an autodetected list of clients instead of manually choosing a viewer via file selection. I'll be working on those features, but if you have any other ideas, let me know in the comments.

No comments: