From orion@nwra.com  Fri Aug 17 19:14:08 2018
Received: (at submit) by bugs.x2go.org; 17 Aug 2018 17:14:10 +0000
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on
	ymir.das-netzwerkteam.de
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,URIBL_BLOCKED
	autolearn=ham autolearn_force=no version=3.4.1
Received: from localhost (localhost [127.0.0.1])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTP id 541B65DACF
	for <submit@bugs.x2go.org>; Fri, 17 Aug 2018 19:14:08 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at ymir.das-netzwerkteam.de
Received: from ymir.das-netzwerkteam.de ([127.0.0.1])
	by localhost (ymir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id zMGyMfRlvfQA for <submit@bugs.x2go.org>;
	Fri, 17 Aug 2018 19:13:59 +0200 (CEST)
X-Greylist: delayed 339 seconds by postgrey-1.35 at ymir.das-netzwerkteam.de; Fri, 17 Aug 2018 19:13:58 CEST
Received: from mail.nwra.com (mail.nwra.com [72.52.192.72])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTPS id 111EB5DACE
	for <submit@bugs.x2go.org>; Fri, 17 Aug 2018 19:13:58 +0200 (CEST)
Received: from barry.cora.nwra.com (inferno.cora.nwra.com [208.187.183.84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by mail.nwra.com (Postfix) with ESMTPS id 22D913403CB
	for <submit@bugs.x2go.org>; Fri, 17 Aug 2018 10:08:16 -0700 (PDT)
To: submit@bugs.x2go.org
From: Orion Poplawski <orion@nwra.com>
Subject: RFE: Allow setting nxagent nx/nx options on the server via
 x2goagent.options
Message-ID: <b88d77f0-392d-ecee-dc8b-479e97d6179c@nwra.com>
Date: Fri, 17 Aug 2018 11:08:14 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
Content-Type: multipart/mixed;
 boundary="------------5605AD2EF3A86B724448E089"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------5605AD2EF3A86B724448E089
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Package: x2goserver
Persion: 4.1.0.2
Tags: patch

The attached patch allows the setting of nxagent nx/nx options on the server
via x2goagent.options.  Very useful for being able to set sleep=0.

-- 
Orion Poplawski
Manager of NWRA Technical Systems          720-772-5637
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion@nwra.com
Boulder, CO 80301                 https://www.nwra.com/

--------------5605AD2EF3A86B724448E089
Content-Type: text/x-patch;
 name="0001-Allow-setting-nxagent-nx-nx-options-on-the-server-vi.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0001-Allow-setting-nxagent-nx-nx-options-on-the-server-vi.pa";
 filename*1="tch"

>From d3ad2c284cd404286b2764266bed837e3da2ea71 Mon Sep 17 00:00:00 2001
From: Orion Poplawski <orion@nwra.com>
Date: Fri, 17 Aug 2018 11:04:03 -0600
Subject: [PATCH] Allow setting nxagent nx/nx options on the server via
 x2goagent.options

---
 x2goserver-x2goagent/etc/x2goagent.options |  3 +++
 x2goserver/bin/x2gostartagent              | 11 +++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/x2goserver-x2goagent/etc/x2goagent.options b/x2goserver-x2goagent/etc/x2goagent.options
index a521d17..b7828b1 100644
--- a/x2goserver-x2goagent/etc/x2goagent.options
+++ b/x2goserver-x2goagent/etc/x2goagent.options
@@ -33,3 +33,6 @@ X2GO_NXAGENT_DEFAULT_OPTIONS+=" -nolisten tcp"
 # Disable BIG-REQUESTS, nx-libs does not implement this extension correctly.
 # Leads to all sorts of weird crashes if left enabled.
 X2GO_NXAGENT_DEFAULT_OPTIONS+=" -extension BIG-REQUESTS"
+
+# Extra nxagent nx/nx options, separated by commas.  For example: sleep=0
+X2GO_NXOPTIONS=""
diff --git a/x2goserver/bin/x2gostartagent b/x2goserver/bin/x2gostartagent
index 88d015c..af1e2c4 100755
--- a/x2goserver/bin/x2gostartagent
+++ b/x2goserver/bin/x2gostartagent
@@ -402,14 +402,17 @@ fi
 typeset xinerama_option='1'
 [[ "${x2go_xinerama}" = '0' ]] && xinerama_option='0'
 
+typeset kbtype_option="${X2GO_KBD_TYPE}"
 if [[ "${X2GO_SET_KBD}" = '0' ]] || [[ "${X2GO_KBD_TYPE}" = 'auto' ]]; then
-	X2GO_HOST="nx/nx,link=${X2GO_LINK},pack=${X2GO_PACK},limit=0,root=${SESSION_DIR},cache=8M,images=32M,type=${X2GO_TYPE},id=${SESSION_NAME},cookie=${X2GO_COOKIE},errors=${SESSION_LOG},kbtype=null/null,${option_geometry}xinerama=${xinerama_option},resize=${X2GO_RESIZE},fullscreen=${X2GO_FULLSCREEN},accept=${REMOTE},listen=${GR_PORT}${clipboard},client=linux,menu=0,state=${STATE_FILE}"
-else
-	X2GO_HOST="nx/nx,link=${X2GO_LINK},pack=${X2GO_PACK},limit=0,root=${SESSION_DIR},cache=8M,images=32M,type=${X2GO_TYPE},id=${SESSION_NAME},cookie=${X2GO_COOKIE},errors=${SESSION_LOG},kbtype=${X2GO_KBD_TYPE},${option_geometry}xinerama=${xinerama_option},resize=${X2GO_RESIZE},fullscreen=${X2GO_FULLSCREEN},accept=${REMOTE},listen=${GR_PORT}${clipboard},client=linux,menu=0,state=${STATE_FILE}"
+	kbtype_option="null/null"
 fi
 
+# Ensure X2GO_NXOPTIONS ends with a , if needed
+if [[ -n "${X2GO_NXOPTIONS}" ]]; then
+	X2GO_NXOPTIONS="${X2GO_NXOPTIONS%,},"
+fi
 
-echo "${X2GO_HOST}:${X2GO_PORT}" >"${SESSION_DIR}/options"
+echo "nx/nx,link=${X2GO_LINK},pack=${X2GO_PACK},limit=0,root=${SESSION_DIR},cache=8M,images=32M,type=${X2GO_TYPE},id=${SESSION_NAME},cookie=${X2GO_COOKIE},errors=${SESSION_LOG},kbtype=${kbtype_option},${option_geometry}xinerama=${xinerama_option},resize=${X2GO_RESIZE},fullscreen=${X2GO_FULLSCREEN},accept=${REMOTE},listen=${GR_PORT}${clipboard},client=linux,menu=0,${X2GO_NXOPTIONS}state=${STATE_FILE}:${X2GO_PORT}" >"${SESSION_DIR}/options"
 
 NX_AGENT=":${X2GO_PORT}"
 SAVED_DISPLAY="${DISPLAY}"
-- 
1.8.3.1


--------------5605AD2EF3A86B724448E089--

