From dce2de0a5a56e69e5697771d05355479637408c4 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 5 Nov 2012 00:49:39 -0800 Subject: [PATCH] Focus existing client window if already open. --- guacamole/src/main/webapp/index.xhtml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/guacamole/src/main/webapp/index.xhtml b/guacamole/src/main/webapp/index.xhtml index 0acb4cc1e..862905c44 100644 --- a/guacamole/src/main/webapp/index.xhtml +++ b/guacamole/src/main/webapp/index.xhtml @@ -190,15 +190,27 @@ var thumbnail = document.createElement("div"); thumbnail.className = "thumbnail"; - function new_client(url) { + function new_client(id) { + + // Get URL + var url = getClientURL(id) + return function() { - window.open(url); + + // Attempt to focus existing window + var current = window.open(null, id); + + // If window did not already exist, set up as + // Guacamole client + if (!current.GuacamoleUI) + window.open(url, id); + }; + } // Create link to client - var url = getClientURL(configs[i].id) - connection.onclick = new_client(url); + connection.onclick = new_client(configs[i].id); protocol.appendChild(protocolIcon);