Subject: RFE: Allow setting nxagent nx/nx options on the server via x2goagent.options

From: Orion Poplawski <[email-masked]>
Date: Fri, 17 Aug 2018 11:08:14 -0600

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                       [email-masked]
Boulder, CO 80301                 https://www.nwra.com/
>From d3ad2c284cd404286b2764266bed837e3da2ea71 Mon Sep 17 00:00:00 2001
From: Orion Poplawski <[email-masked]>
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

---

From: Ulrich Sibiller <[email-masked]>
Date: Fri, 17 Aug 2018 20:38:55 +0200

Well, it should be a session specific setting which means it should be
implemented at the client side and passed to the server from there.
But it is a start...

Not directIy related to your  changes: I am wondering why this piece
of code always sets client=linux although this is server-side code!?

Uli

On Fri, Aug 17, 2018 at 7:08 PM, Orion Poplawski <[email-masked]> wrote:
> _______________________________________________
> x2go-dev mailing list
> [email-masked]
> https://lists.x2go.org/listinfo/x2go-dev

---

From: Mike Gabriel <[email-masked]>
Date: Mon, 20 Aug 2018 09:33:43 +0000

Hi,

> of code always sets client=linux although this is server-side code!?

I agree with Uli, that the sleep option needs to be integrated into  
X2Go Client's / PyHoca-GUI's UI. However, the patch provided by Orion  
gives site admins the possibility to fine-tune the server-side defaults.

If a session gets attached to from the client-side, the nx/nx options  
passed to nxproxy override the system defaults IIRC. So, adding sleep  
support to X2Go Client is a second step.

/me raises his thumb for applying this patch.

Mike
-- 

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
mobile: +49 (1520) 1976 148
landline: +49 (4354) 8390 139

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: [email-masked], http://das-netzwerkteam.de