$network will return the name of the active connection. You can view the name of inactive connections by using $scid(<id>).network where <id> is the cid number of the network you are interested in.

-genius_at_work