Subject: Bug#744: [X2Go-Dev] Bug#744: user-local keystrokes.cfg does not work

From: Horst Schirmeier <[email-masked]>
Date: Fri, 16 Jan 2015 15:11:05 +0100

On Thu, 15 Jan 2015, Mike Gabriel wrote:
> >Do we actually WANT to make ~/.nx/foo override /etc/x2go/foo *for
> 
> First: We want to allow users to override system-wide settings by
> user settings.
> 
> >x2goagent*? Or do we rather want to get rid of ~/.nx and /etc/nxagent
> >entirely within x2go components (which, really, would make some sort of
> >sense, especially if $SOMETHING created ~/.nx/config/keystrokes.cfg and
> >users wonder why /etc/x2go/keystrokes.cfg does not take any effect.)
> 
> This indeed is a bit of a drama, I agree.
> 
> 1. We want to provide NX-X11 to people who still use NX (e.g. FreeNX).
> 
> To provide this, we have to think generically here. Paths like ~/.nx
> or /etc/nxagent/ are hard-coded in NX-X11 and nxagent and I think
> that is ok. All X2Go'ish paths should be overridden via env vars or
> otherwise.
> 
> In nxagent, there is some code that checks ARGV[0] (== nxagent? ==
> x2goagent?) and triggers the branding of start-up screens of desktop
> sessions (the gray X2GO logo).
> 
> Maybe for setting paths (esp. ~/.x2go/keystrokes.cfg), some similar
> mechanism should be used?

How about this variant?

patch for x2go-specific keystroke configuration files, enable user-local
keystrokes.cfg
---
 ...agent_x2go-specific-keystroke-config.full.patch | 22 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 debian/wrappers/x2goagent                          |  3 ---
 3 files changed, 23 insertions(+), 3 deletions(-)
 create mode 100644 debian/patches/321_nxagent_x2go-specific-keystroke-config.full.patch

diff --git a/debian/patches/321_nxagent_x2go-specific-keystroke-config.full.patch b/debian/patches/321_nxagent_x2go-specific-keystroke-config.full.patch
new file mode 100644
index 0000000..8ab4f93
--- /dev/null
+++ b/debian/patches/321_nxagent_x2go-specific-keystroke-config.full.patch
@@ -0,0 +1,22 @@
+--- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
++++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+@@ -27,6 +27,7 @@
+ #include "Options.h"
+ #include "Keystroke.h"
+ #include "Drawable.h"
++#include "Init.h" /* extern int nxagentX2go */
+ 
+ #include <unistd.h>
+ 
+@@ -261,6 +262,11 @@ static void parse_keystroke_file(void)
+   char *homefile = "/.nx/config/keystrokes.cfg";
+   char *etcfile = "/etc/nxagent/keystrokes.cfg";
+ 
++  if (nxagentX2go) {
++    homefile = "/.x2go/config/keystrokes.cfg";
++    etcfile = "/etc/x2go/keystrokes.cfg";
++  }
++
+   if (nxagentKeystrokeFile != NULL && access(nxagentKeystrokeFile, R_OK) == 0)
+   {
+     filename = strdup(nxagentKeystrokeFile);
diff --git a/debian/patches/series b/debian/patches/series
index 98d3e5e..c65f645 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -61,6 +61,7 @@
 301_nx-X11_use-shared-libs.full.patch
 302_nx-X11_xkbbasedir-detection.full.patch
 320_nxagent_configurable-keystrokes.full.patch
+321_nxagent_x2go-specific-keystroke-config.full.patch
 400_nxcomp-version.full+lite.patch
 #401_nxcomp_bigrequests-and-genericevent-extensions.full+lite.patch
 600_nx-X11+nxcompext+nxcompshad_unique-libnames.full.patch
diff --git a/debian/wrappers/x2goagent b/debian/wrappers/x2goagent
index 129c7ca..ba07a3f 100644
--- a/debian/wrappers/x2goagent
+++ b/debian/wrappers/x2goagent
@@ -29,7 +29,4 @@ test -x $NX_LIBS/../x2go/bin/$NXAPP && export NX_LIBS=$NX_LIBS
 
 export LD_LIBRARY_PATH
 
-NXAGENT_KEYSTROKEFILE=/etc/x2go/keystrokes.cfg
-export NXAGENT_KEYSTROKEFILE
-
 exec $NX_LIBS/../x2go/bin/$NXAPP "$@"

-- 
PGP-Key 0xD40E0E7A